Ubuntu / Linux news and application reviews.

WindowSpy is a new Unity AppIndicator that allows displaying a small live (well, almost) preview of a window on another workspace.


Created by Jacob Vlijm as a response to an AskUbuntu question, the tool is useful if you want to keep an eye on a window on another workspace, waiting for something to finish.

For example, you can use it to see the progress of something that's running in a virtual machine. WindowSpy is not exactly useful if you want to use it to watch a video in the preview, because the preview is updated every 3 seconds.


WindowSpy allows some preview window customization, like the size, border width, background color and window position. The interval between preview updates is not configurable, at least for now.

You may also want to check out Jacob's other projects: Take A Break, NoNotifications, SpaceView, Unity WallpaperSwitcher and Unity LauncherSwitcher.


Using WindowSpy


Using WindowSpy may be a bit confusing at first, so here's how it works. The first thing you'll need to do is focus the window that you want to keep an eye on in the preview, then select "Represent active window elsewhere" from the WindowSpy indicator menu.

Next, you can move to another viewport and from the WindowSpy indicator menu, select "Show preview on this viewport" to create the preview.

Once you do this, the window is minimized and set to sticky (is displayed on all workspaces). That's because for the preview to work, the window needs to be on the current workspace. This is undone automatically once you close the preview from the indicator menu.

The preview doesn't have any window borders so to move it, hold Alt and left-click, dragging the window to the desired position.

To close the preview window, simply select "Close preview and move to original viewport" from the WindowSpy indicator menu.

You can cycle through these 3 stages (represent window elsewhere, show preview and close preview) using a keyboard shortcut, which you must set manually. To do this, go to System Settings > Keyboard > Shortcuts, then under "Custom Shortcuts" click "+" to add a new shortcut, use "/opt/windowspy/code/cycle" (without the quotes) for the command and assign it any keyboard shorcut you want (make sure the keyboard shortcut is not already in use).

For more about how WindowSpy works, check out THIS AskUbuntu answer. 

I should also mention that in Ubuntu 16.10, getting a VirtualBox machine in a preview is a bit tricky. That's because at least on my computer, when a virtual machine is focused, indicators are not clickable (bug report). Furthermore, using the keyboard shortcut doesn't work directly because VirtualBox disables the host keyboard shortcuts when a virtual machine is focused.

WindowSpy has a built-in workaround for this - it automatically looks for VirtualBox virtual machine windows if the user clicks on the desktop and then uses the keyboard shortcut. But this didn't work for me in Ubuntu 16.10.

My workaround for this issue was to create a small script which adds a delay before running the "cycle" script, so I can use the keyboard shorcut, then activate the VirtualBox machine window. To do this, simply paste "sleep 2 && /opt/windowspy/code/cycle" (without the quotes; "2" is the number of seconds to delay running the cycle script) in a file, make it executable, and use that for the keyboard shortcut command instead of "/opt/windowspy/code/cycle" directly.


Install WindowSpy in Ubuntu


WindowSpy is available in a PPA for Ubuntu 17.04, 16.10, 16.04 and 14.04. To add the PPA and install the application, use the following commands:
sudo add-apt-repository ppa:vlijm/windowspy
sudo apt update
sudo apt install windowspy
Alternatively, you can download the deb from HERE.

Report any bugs you may find @ Launchpad.

Thanks to Jacob for the tip!