1
votes

I'm attempting to resize and relocate various windows I use for work using Autokey to make my morning a little faster. From what I've googled, Autokey uses python to run its scripts. I've also seen half a dozen programs that could do the job for me, but I'm trying to do this with only the tools I have available to me.

I don't necessarily need it spelled out to me. Any direction to the right documentation would help, or a link to a similar script. I'm currently running fedora 20, and open my windows with a little shell script:

google-chrome "http://google.com/"&
google-chrome  "http://leafdns.com/"&
pidgin&
konsole --noclose -e &
autokey-gtk&
gedit "test"&

As far as I can tell, there's nothing I can do in this shell script that can handle window movement.

1

1 Answers

1
votes

I believe wmctrl is what you're looking for. An example using gedit and a script to get the window id:

gedit --new-window &
sleep 1
get_window_id gedit
wmctrl -i -r "$window_id" -e 0,1025,0,953,1000

(example pulled from here, which also shows you how to create the get_window_id script)

To understand how to get the window id, run the following

wmctrl -l

You will get a list of all detected windows and their names (some will be named by the program's actual name, but not all; in Google Chrome's case it is the name of the currently open website, at least for me)

The first value (something like 0x03a00006) is the window's id. It might not be the easiest solution, but it is one. As for how to invoke it through python, read up on system commands here.

The alternatives to wmctrl would have to be either xdotool or xprop, but I doubt they would be any easier to operate. You can also look into tiling window management, which might be a good alternative to all this trouble.