Question
Using a shell scripting language, python, or anything, how can I move a window from one viewport to another?
While I'm pretty desparate, I'd prefer the solution to work in the background. As in, not activate window 1, move window 1, active window 2, move window 2, ...
, while I have to sit and wait for all this to happen. (I'll refer to this as the slow activation problem.)
I'd even appreciate references to where else I should ask this question, like forums of people knowledgeable about Linux and window managers.
Environment
I'm using Gnome Flashback with Compiz (not Unity or Metacity). I'm on Ubuntu 14.04, but hopefully solutions would work on other versions as I intend to upgrade.
What I've tried
Only command line stuff with existing programs.
wmctrl
First, wmctrl
doesn't really work apparently with compiz. Here's what I get with wmctrl -d
:
$ wmctrl -d
0 * DG: N/A VP: N/A WA: N/A N/A
wmctrl -l
isn't completely useless, but it doesn't show all windows. For example, I ran it just now and it reported 8 Chrome windows but I know I have at least 21. Slack is open but isn't in the list of windows.
compiz-dbus plugin
I used the compiz-dbus plugin with the put
plugin, and tried using ./compiz-send.py put put_viewport_1_key
, but this has several problems:
- It only works with the active window, thus gives the "slow activation" problem mentioned above. And that's presuming I could use another tool to find a window by title and activate it.
- It's buggy for maximized windows, which 95% of my windows are. For me, it'll sometimes move the window's viewport, but always put it on my middle monitor, even if it started on my right monitor. Othertimes, it'll move the viewport, then move it back! (and still put it on the middle monitor). Obviously this is no good.
Backstory
I hate restarting my computer, because all windows start on a single viewport, and it takes me several minutes to move all my windows back to the viewports they were previously on. For example, I'll have several Chrome windows on viewport 1, several on viewport 2, etc. That's a lot of window moving, every time I restart my computer.
Often, I don't restart my computer for extended periods because of this pain, which is bad for security fixes, etc. Why do I have so many windows open? I'm a contractor and work on several projects simultaneously, each with its own concerns requiring web research, code writing, command line stuff, etc. I have 32 GB of RAM so many windows is not a performance problem.
Generally the windows are easy enough to identify by title where I'd like them to be. For example, I always want "Gmail - Google Chrome" to be on viewport 1.