As I get back into actively programming, I look for opportunities to make my life easier. Being a Software Toolsmith, I try to write tools to make my life simpler.
Whenever I have reptitive actions I do, I see how to automate it. There were some window management functions that I often do that I knew I could easily script and then assign hotkeys to. I finally took the time to figure them out today.
Swapping which monitor a window is on
When I’m at home, I always have an external monitor hooked up to my laptop. I often want to swap a window to the other monitor and having to reach for the mouse to do so. My first script simply moves the active window to the upper left corner of the opposite monitor. It is only set up for the 2 monitor configuration. Download swap_monitors.pyand make it executable.
Maximizing a window and showing on all desktops
Another action I do refrequently is maximizing a window and then making it show on all of my virtual desktops. If I’m watching a video or have another program that I want acessible no matter which desktop I’m on, I’ll do this. Sure, I can just do a Alt-Space and then ‘x’ to maximize and then Alt-Space and then ‘a’ to always show on visible workspace, but I’d like to do it in one keystroke. To do so, download maximize_all_workspaces.py
The only dependencies are Python and the python-gtk2 package.