~lucidiot's wiki

JS console as a Windows Sidebar gadget

Windows Vista introduced the Windows Sidebar, on which gadgets may be placed. Windows 7 removed the sidebar but kept the gadgets, and Windows 8 removed the gadgets.

Gadgets are nothing more than a webpage shown in a strange way, similar to Active Desktop. They get access to some extra features:

  • An ActiveX object on the window.System global variable, giving access to many methods such as System.Shell.execute to run any command, System.Sound.beep to be annoying, or System.Shell.RecycleBin.emptyAll to empty the trash;
  • Some XHTML elements under the g namespace: g:background, g:image and g:text;
  • The undocumented x-gadget:/// protocol gives access to the gadget’s files, with special handling for localized files;
  • The documented gimage:/// protocol, a proxy for local image files that can use the Windows thumbnail cache in some cases.

Microsoft published a security advisory encouraging the removal of gadgets from Windows Vista and 7. The “vulnerabilities” are that gadgets can behave like any other program: they can run arbitrary commands and access files. You can do this from any webpage as well, provided you have allowed it to run ActiveX objects. The gadgets documentation has a whole page on security that documents this behavior, takes User Access Control and Parental Controls into account, explains the Internet Explorer settings that could affect gadgets, etc. Gadgets are installed like any other program, and are treated as a program more than a web page. It is very likely that most users would have no idea that those are JavaScript powered. So if Microsoft wanted to remove gadgets because they are programs, why not also remove the ability to execute any program?

Anyway, since gadgets are web pages, it is pretty easy to slap the console in there. The console needed very little modification to work, other than having to force a width and height for the gadget to display correctly. The Vista sidebar limits the console’s width, so I added support for the undocked mode, which becomes a “larger size” mode in Windows 7, to allow for a more comfortable console.

Installation

  1. Create a ZIP or CAB file containing all of the files within the Console.Gadget directory of this repository.
  2. Rename the .zip or .cab extension to .gadget.
  3. Open the file in Windows Vista or Windows 7.
  4. When the security warning for an unverified publisher appears, click Install.
  5. ???
  6. Profit.

Screenshot

The Console as a gadget on Windows 7

Official documentation