Wednesday, September 10, 2014

Make an application stay on top by default

Certain applications such as a calculator have typical use patterns which indicate window behavior settings contrary to the norm.  A calculator application like gcalctool is often used alongside work being performed in other windows. In these cases, i prefer the window mode to be set such that it stays on top of all other windows.  This way i can go back and forth between the calculator and other work without the results of my calculations disappearing under a stack of other windows.  This is only more of a hassle since i have the window manager set to auto-focus and auto-raise windows.  Since the application may be opened and closed often, efforts to manually set window modes are usually wasted.

wmctrl can be used to set the mode flags of a window (among a bunch of other things).
For gcalctool:
#!/bin/bash

gcalctool &
sleep 1
wmctrl -r "Calculator" -b add,above


For xzoom magnifier:
#!/bin/bash

xzoom &
sleep 1
wmctrl -r "xzoom x2" -b add,above,sticky


this time, including the sticky flag

No comments:

Post a Comment