Is it possible to mirror a live section of one workspace so that it is visible in the current workspace as a window that can be moved around?
The other day I had a Windows 10 VM running on my Ubuntu 16.04 host that took a really long time to complete updating. I kept checking on its progress via Expo (Super+S) on Ubuntu. That got me thinking that this problem has most likely been solved already since tools such as simplescreenrecorder can be configured to record just a portion of the screen. However, I don't know the proper terminology to use for my Google search.
I'd like to see the 300×150 screenshot below in the form of a floating window (with live updates) in the top right corner of whichever workspace happens to be current.
Best Answer
EDIT
(New answer)
DONE.
The answer below is now available in a polished form, as an indicator, as a ppa for Trusty, Xenial, Yakkety and Zesty :
Th indicator (including preview window) is now nicely low on juice. Options include a settings window, setting window border size/color, window size.
In the meantime, I found it useful to keep an eye on the AU window; see if there are any messages :)
OLD ANSWER
(
firstsecond rough concept)Have a minimized representation of a window on another workspace
To my own (big) surprise, it can be effectively done, be it with trickery and deceit; have an updated representation of a window on another workspace. Not fit to watch a movie, definitely good enough to keep an eye on a window elsewhere (example: my tv-card window):
How it works in practice
With the window in front, press a shortcut key:
(the window will minimize)
Move to another workspace, press the shortcut key again, a small representation of the window will appear, updated every 4 seconds:
The window always shows on top of other windows. As it is, the window is 300px (width), but can be set to any size.
To end it, press (again) the shortcut key. The small window will close, you will move to the viewport of the original window, which will appear again, unminimized.
The scripts
The control script
The window representatiom
How to use
Install
python3-pil
,xdotool
andwmctrl
Create, if it doesn't exist yet, the directory
~/bin
.showcase_control
(no extension) in~/bin
, and make it executable.showmin
(no extension) in~/bin
, and make it executable.Log out and back in, and add the following command to a shortcut of your choice:
Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
and it should work!
Downsides?
The setup, as it is currently, adds some work for your processor. On my (very) old system however, it adds (on average) appr. 4-5% I reckon, which I did not notice in any way.
Update: It turns out
import
can resize the image in one step, together with fetching the window image. This means a substantial reduction in processor load. At the same time the refresh time is shorter (3 seconds now), still at lower "costs".Explanation
import
-command, once we have the window id. While this both works on minimized windows or windows without focus, there is however one issue: the window needs to be on the current workspace.wmctrl
, but minimized at the same time.In short:
Specifically for VirtualBox
When the VBox window is in front, it turns out Ubuntu shortcut keys are disabled(!), so the control script needs to be launched in another way. Below a few brief ones.
Option 1
I edited the control script. Now only in the case of VirtualBox:
Click anywhere on the desktop, Then press your shortcut key. After that, simply use the shortcut key to show the window and exit.
Explanation: The control script was made to exit if the window was of type "desktop", since you wouldn't want to minimize the desktop. Now the script first looks for possibly existing VirtualBox windows, to target, if the currently active window is the desktop.
Option 2
Copy the icon below (right- click -> save as), save it as
minwinicon.png
Copy the lines below into an empty file, save it as
minwin.desktop
in~/.local/share/applications
:You'd need to log out and back in for the launcher to "find" the local
~/bin
path!Drag the icon on to the launcher to use it.
The second solution has an important downside: after using it from the launcher, it will keep blinking for a few seconds, waiting for a window to appear. During that, clicking again won't have any effect. That can be solved, as described here, but including that in this answer would really make it too long. If you want to use option two, please look into the link.