You are not logged in.

#1 2009-06-18 11:22:25

whoops
Member
Registered: 2009-03-19
Posts: 891

Set window position/width/height/desktop (compiz/viewport compatible)?

Hi!


I'm trying to make a "pseudo load session script" for my compiz standalone desktop. My first idea was to use wmctrl, but that thing for some reason wasn't displaying/recognizing all windows (it was p.e. missing firefox), so I tried devilspie. I noticed, that it wrote a nice complete list of windows when it was started, so maybe I could just have all of those lines transformed to that devilspie syntax thing and after that have an easy time just commenting the matching rules I don't want out (like title for apps that change it dynamically) and leave the rest... so I began like that...:

devilspie > out.txt & killall devilspie

while read file; 

# stuff me write later: echo | sed("...")  or something

# from output expression
"Window Title: '(.*)'; Application Name: '(.*)'; Class: '(.*)'; Geometry: (.*)"
# transform to devilspie window manipulate syntax thing
"
(if
    (and
#        (is (window_title) \"\1\")
        (is (application_name) \"\2\")
        (is (window_role) \"\3\")
    )
    (begin
        (geometry \"\4\")
)
"

# more stuff me write later: echo syntax to ~/.devilspie/application_name.ds or something

done < <(cat out.txt)
rm out.txt

Well, about at this point I noticed, that I didn't have window roles in the devilspie output (which are really useful to match some of my windows)... and that maybe I'm doing something much more complicated that it has to be... so:


- There's gotta be a better solution than what I'm trying to do here, right? Where?
- I am really not supposed to let the attributes I already got get "piped" trough some impractical improvised xprop | grep loop or something to add the WM_WINDOW_ROLE to the matching rules set, or am I? There gotta be something better for that too?
- Uhm... yes, what now? Thanks for all hints! wink

Last edited by whoops (2009-06-18 11:24:04)

Offline

#2 2009-06-18 11:36:03

Tyriel
Member
From: Melbourne, Australia
Registered: 2009-01-20
Posts: 161
Website

Re: Set window position/width/height/desktop (compiz/viewport compatible)?

I am not exactly sure if this will be able to exactly do what you need to but I recently had a similar issue as you when using devils pie.  Then I realised you can easily allocate width, height, x/y co-ordinates window state (ie full screen/maximised/etc.) as well as which desktop to display in Compiz with its plugins.

- Winddows Rules plugin will allow you to set the size of a window as well as other goodies like it being maximised etc.

- Place Windows plugin allows you to allocate a windows position.  I have mine set to centered horizontally and vertically by default then allocate specific positions for other windows.  Eg. my terminal opens on the bottom left corner of the screen.

I hope this helps you out.


The software required Windows XP or better, so I installed archlinux.

Offline

#3 2009-06-18 11:39:49

Tyriel
Member
From: Melbourne, Australia
Registered: 2009-01-20
Posts: 161
Website

Re: Set window position/width/height/desktop (compiz/viewport compatible)?

Oh sorry I should have mentioned that it is better to use window class and window title instead of window role when it comes to recognising windows.

For instance firefox will be recognised with the window class of 'Gran Paradiso'.

Hope this helps.


The software required Windows XP or better, so I installed archlinux.

Offline

#4 2009-06-18 15:02:46

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: Set window position/width/height/desktop (compiz/viewport compatible)?

Thanks, but that's not really what I'm searching for, as it requires a lot of tinkering with gui's when changing/saving/loading the "workspace layout" and does not seem to work quite so well too... during start-up, the plugins seem not to do anything (they might only affect windows that are started/allocated or whatever while they are already running and have been for a while or something?) and later they push windows around that I started manually, so I would have to disable them after I had everything placed. I'm not sure, how to explain that - it's just all in all setting up those two plugins does not seem to get me my "working enviroment" any easier than just dragging the windows to their place every time I start up.

So, still trying devilspie ATM - while I don't even know, if it will do any good when it's finished yet - still hoping there's something better. Like maybe using some xorg utils and nothing else, but I don't even manage to get a list of all windows without devilspie... while devilspie seems to be designed to be running in the background, I can easily kill it after it positioned all the windows. Well, you might have noticed by now, I'm sort of lost here and really don't know what to "research" ATM so much...

The "update script" looks like this so far:

rm auto.ds;
devilspie > out.txt & sleep 3 && killall devilspie;
echo '(begin

' > auto.ds;

while read line; 
do synta=$(echo $line | sed "s/Window Title: '\(.*\)'; Application Name: '\(.*\)'; Class: '\(.*\)'; Geometry: \(.*\)/\n(if\n    (and\n#        (is (window_title) \"\1\")\n        (is (application_name) \"\2\")\n        (is (window_class) \"\3\")\n    )\n    (begin\n        (geometry \"\4\")\n    )\n)\n/");


echo "$synta" >> "auto.ds";

    
done < <(cat out.txt)
echo '

)' >>auto.ds;
rm out.txt;

and after a 5 seconds manual cleanup the ds file it generates looks about like this:

(begin



(if
    (and
        (is (application_name) "claws-mail")
        (is (window_class) "Claws-mail")
    )
    (begin
        (geometry "1600x1168+1600+-1200")
    )
)

(if
    (and
        (is (window_title) "Downloads")
        (is (application_name) "Firefox")
        (is (window_class) "Shiretoko")
    )
    (begin
        (geometry "800x584+2400+584")
    )
)

(if
    (and
        (is (window_title) "terminalA")
        (is (application_name) "Terminal")
        (is (window_class) "Terminal")
    )
    (begin
        (geometry "799x1162+3200+-1200")
    )
)

(if
    (and
        (is (window_title) "Transmission")
        (is (application_name) "Transmission")
        (is (window_class) "Transmission")
    )
    (begin
        (geometry "1600x584+0+-616")
    )
)

(if
    (and
        (is (application_name) "Thunar")
        (is (window_class) "ThunarA")
    )
    (begin
        (geometry "800x584+2400+584")
    )
)

(if
    (and
        (is (application_name) "Firefox")
        (is (window_class) "Shiretoko")
    )
    (begin
        (geometry "1600x1168+0+0")
    )
)

(if
    (and
        (is (application_name) "geany")
        (is (window_class) "Geany")
    )
    (begin
        (geometry "800x1168+1600+0")
    )
)

(if
    (and
        (is (application_name) "xfce4-panel")
        (is (window_class) "Xfce4-panel")
    )
    (begin
        (geometry "1600x32+1600+1168")
    )
)

(if
    (and
        (is (application_name) "Thunar")
        (is (window_class) "ThunarB")
    )
    (begin
        (geometry "800x1168+3200+-1200")
    )
)

(if
    (and
        (is (application_name) "Thunar")
        (is (window_class) "ThunarC")
    )
    (begin
        (geometry "890x1168+3910+-1200")
    )
)

(if
    (and
        (is (window_title) "terminalB")
        (is (application_name) "Terminal")
        (is (window_class) "Terminal")
    )
    (begin
        (geometry "1599x582+0+-1200")
    )
)

(if
    (and
        (is (window_title) "terminalA")
        (is (application_name) "Terminal")
        (is (window_class) "Terminal")
    )
    (begin
        (geometry "799x582+2400+0")
    )
)

(if
    (and
        (is (application_name) "xfce4-panel")
        (is (window_class) "Xfce4-panel")
    )
    (begin
        (geometry "1600x32+0+1168")
    )
)


)

... which is still far from perfect, but I gotta get it running somehow to even see if it works fine
- when being started shortly after or even before fusion-icon
- when not run in an xterm (devilspie seems to do relative coordinates, that are different depending on what viewport it runs on or something)
- when killed shortly after it's started...
... and stuff.

So to be able to "fine-tune" (which is an horrible euphemism in this case;)), I would first have to get rid of devilspie complaining about:

** (devilspie:8706): WARNING **: Error in parsing: Invalid format for a boolean value
Cannot parse /home/user/.devilspie/auto.ds: Invalid format for a boolean value

... with the example above and I've got no idea what script/language/whatever that "config file" is or where to find a documentation or something...

$ man devilspie wrote:

BUGS
       This manpage is almost useless, as it was thrown together on a train.

SO... trying to put that chaos into a few simple points...:
- I'm not sure if I'm even using the right tools
- I'm not sure if I'm using them the right way
- Can't find better alternative
- Can't find manual.

Last edited by whoops (2009-06-18 15:11:31)

Offline

Board footer

Powered by FluxBB