The easiest way to do this would be using wmctrl. You can read man wmctrl
to see how to use it.
sudo apt-get install wmctrl
You could basically bind the command line to a 'Window' class and add methods to it that use wmctrl commands in the background.
class Window
@@windows = []
def self.windows
@@windows
end
def self.get_windows
@@windows.clear
`wmctrl -l`.split("\n").map do |str|
@@windows << self.class.new(str.split(' ')*)
end
end
def initialize window_id, desktop_id, client_machine, window_title
#set up object here
end
#add other methods here
end
That should be a good starting point. It's not tested or anything but you should be able to work it out from here. You could now add instance methods, eg. change_geometry
, which could utilise the -r <WIN> -e <MVARG>
option.
You should familiarise your self with pipes and IO in general before doing this.
Perhaps when you have accomplished what you need to, you can distribute this as a ruby library and package it for Debian/Ubuntu.