Proof-of-concept packaged app for keeping device from going to sleep***GPL'ed source code available via this app's Website link (github.com/StrawnPoint04/WakeUp), in case other developers see this and want to tinker***
Thanks to the awesomeness that is the chrome.power API, I now have a treat for my fellow Chromebook users: a packaged app that allows users to control when their Chromebooks go to sleep... WITHOUT entering developer mode! Also displays rich notifications to let the user know that the system is being kept awake.
Let me know what you think...
Edit: Found out there's a Chrome extension that serves a similar purpose (and happens to be an official one), but given that it uses a browser action (like ~90% of extensions out there), browser action clutter (like in my case) can easily be an issue there. Not to mention that unlike extensions, packaged apps can open even without a need for a browser window to be open, making access to the controls as easy as opening and closing the app, instead of opening a browser window and THEN opening and closing a browser action.
~~~~Changelog below~~~~
1.0: Created
1.6:
* Tweaked notifications so that they launch the app when clicked
* Crash fixes, CSS bug fixes, minor improvements
1.7:
* Attempted trailing, unfinished JavaScript function that causes CSS to get screwed up, but misseed trailing closing brace...
1.9: Actually fixed bug described above
2.0:
* Reduced app window size to make it feel more natural to Chromebook Pixel users who are used to using touch screens
* Added additional background page that listens for updates to send users notifications so that in case any negative reviews are submitted, the user(s) in question will be notified to edit/update their reviews to ensure that the motivation for reviews is as up-to-date as possible
* Added marquee tile image
2.1:
* Fixed bug in update notifier that was introducing syntax errors in the console, thus preventing user from being notified as expected
3.0.1:
* Function to listen for updates was being called on startup instead of immediately. Updated to call the update listener function right after it's defined to ensure that notifications to edit reviews are being sent on a prompt basis.
* Fixed bug that was causing users to get annoyingly notified when app is newly installed, not just when updated.
* Modified notification banner to word the description in a more friendly manner, such that the banner doesn't automatically assume the user has negative reviews in the store.
3.1:
* Fixed a notifications bug that caused all notifications to, when clicked or closed, have the same behavior when they really shouldn't
3.2:
* There were two background pages in previous versions. They have now been consolidated. Yay! One background page for all tasks that need to be completed in the background.
* Added runtime.onUpdateAvailable listener, to restart/reload previous versions if users happen to have them running at the time updates are pushed.
4.0:
* Changed main app background image
* Added "frame: none" along with in-app window controls. Now, there's finally no need to depend on the system for window style!
4.1:
* Removed poorly-functional maximize/restore button. Given that this app is meant to be a simple keep-awake utility, there's no need to maximize... so therefore there's no need for a maximize button.
4.2:
* Added onBoundsChanged listener to reset the window bounds to the defaults whenever a resize attempt is made, as a temporary solution until Google provides a way for developers to lock app windows to a given size.
4.3:
* Modified background page to run runtime.requestUpdateCheck every 5 seconds, to make sure future updates are delivered to all devices on a prompt basis.
4.4:
* Re-introduced maximize button, which now actually works
* Used larger app background image that can actually take advantage of the maximization ability on (non-Pixel) Chromebooks
* Introduced better window size management, so that the controls will, instead of always being positioned at 'left: 0', actually position themselves to the center of the window as it's being resized
4.4.0.2:
* Restrained minimum bounds -- this is something that was overlooked in 4.4; apparently there was an older version of the .zip file exported than I thought...
* Nested an onUpdateAvailable listener within the requestUpdateCheck mentioned in 4.3... this is to make sure that copies of the app are even more promptly pushed.
4.4.0.3:
* Resolved CSP compliance issue in constant update checker
4.4.0.4:
* Made window draggable again from the window bar... except via the controls, which causes the controls to not be functional.
4.4.0.5:
* After finding out that setInerval is milliseconds-based, I decided to increase it by 1000 to avoid unnecessarily requesting update checks 200 times per second. Obviously this will result in a performance improvement.
4.4.1:
* App is now open source GPL3 software: https://github.com/KennyStrawn177/WakeUp
4.4.1.1:
* Changed notification click and close handler URLs from "/reviews" to "/details" so people can see what changes are submitted before editing their reviews, as previously redirecting users directly to the reviews page seemed a bit too spammy...
5.0:
* Have a special treat for you guys who happen to have other Chrome apps or extensions installed that use experimental APIs (The transparency simply won't work if the flag isn't set; however, the transparency setting in chrome.app.window is an API that does NOT require the "experimental" permission, and as such, apps that use it are still submittable): the app window, in its entirety, is now transparent!
* Fallback mode: if the aforementioned flag isn't set, the stock beach background that came with the app is used
* Merged title statement with title bar, to make the UI more unified
* Snappier maximize button: rather than actually calling "maximize()", it actually resets the bounds to screen.availWidth and availHeight, and back again, resulting in, you guessed it, zero maximize animation lag.
5.0.1:
* Fixed bug that allowed window to be dragged when maximized
5.0.2:
* Added maxWidth and maxHeight to disable the tendency for the system to override the snappier maximization if one double-clicks the app's title bar
5.1:
* Knowing that checking if chrome.experimental was undefined to fall back on a different background image didn't do much good, and transparentBackground can only be accessed within the background page, I decided to (well, attempt to) resort to a different tactic: sending a notification if the experimental APIs are not enabled. Well, testing it still came up empty, and enabling the "experimental" permission would ban this app from the store... Oh, well.
5.1.1:
* Decided to make the fallback version easier to read and use as an alternative to the above.
5.1.2:
* Made "Not a Chromebook" notification for non-Chrome OS users more user-friendly in explaining their lack of a use case for this app
* Increased update check request frequency to every second instead of every 5 seconds.
5.1.3:
* Removed unused image to trim down bloat and make app faster
* Fixed a bug that could have prevented a notification from behaving correctly
5.2.0:
* Changed around some notification text to send users notifications to submit legitimate bug reports instead of reviews entirely and make more use of the bug reporting tool than the reviewing box.
* Added a bug reporting button in the upper right corner of the window to allow one-click access to the bug tracker for this app.
5.2.1:
* Fixed bug that caused window to not be capable of being dragged when first opened.
6.0:
* Updated the button click handlers to let ARM users know to switch to the beta channel if they want to work around the issue of this app somehow mysteriously not working on their ends, as ARM users of Chrome OS 33.x can confirm that it does indeed work for them.
6.0.1:
* Fixed a notoriously annoying rendering bug that previously required a bounds change to work around
6.1:
* Made bug report button easier to recognize by replacing a skeuomorphic image of a beetle with the more easily recognizable question mark
* Removed 3K of software bloat by deleting the image in question, orphaned by the above change
6.1.1:
* Made double-sure that the prompt to change channels if the user is on Chrome 32 ONLY affects ARM users, NEVER x86 users...
6.2.1:
* Trimmed even more software bloat by defining a global variable for the user agent and removing the no-longer-needed review notifications that have been obsoleted by the in-app help button
6.2.2:
* Perform a total of not one, or two, but THREE checks to ensure that the alert telling people to switch to beta or dev versions of Chrome OS ONLY gets fired on ARM, and ONLY on 32.x versions of Chrome OS.
6.2.3:
* Fixed bug (well, really, typo in some JavaScript code) that was causing "Keep display awake" button to function improperly
6.3.0:
* An app or extension uninstalling itself has the undesirable property of syncing that uninstallation to all of a user's devices. Since this is not only a multi-screen but also a multi-OS world we're talking about here, I figured it's a better idea to just pop up a new tab containing google.com/intl/en/chrome/devices whenever the "Not a Chromebook!" notification is clicked (or closed) instead of calling uninstallSelf, which is a very harsh way to go indeed...
7.0:
* All New Look:
* Transparency (unfortunately deprecated by the latest Canary build) has given way to glowing drop shadows that give the app a futuristic look and feel
* Window control strip has given way to a Material-style pull-out menu which contains the window controls
* Numerous bug fixes involving the deprecation of the transparentBackground: true API
7.1:
* More Material Design:
* <paper-ripple> elements throughout the UI
* Temporary bug workaround: Remove minimize and maximize buttons that were inadvertently closing the window during tests (this app is open source, as a reminder, so if something doesn't look right and an end user happens to be a developer, might want to help me out on this)
7.1.1:
* Font improvements
* Notification bug fix
7.1.2:
* Fixed critical bug that made version 7.1.1 fail to start
8.0:
* Reintroduced minimize button
* Material Design improvements:
* Consistent use of Polymer core-icons throughout the app
* Replaced labels on close and minimize buttons with Material icons
* More consistent use of drop shadows to convey a sense of elevation