Arranging windows on desktops

28 views
Skip to first unread message

Joe Consultant

unread,
Oct 9, 2016, 8:22:52 PM10/9/16
to xdotool-users
I'm having some difficulty with KDE5 restoring my session.

I'm working on an autostart script to fix that. It can already find if my apps are running and start them if they are not, but has no control of where they end up.

Does anyone have an example script which finds an application window and moves it to another desktop if it's not already on the right one?

I read through the xdotool man page and it looks like the pieces are all there, but I'm not sure how to put them together.

Thanks.

Jostein Berntsen

unread,
Oct 10, 2016, 2:17:09 AM10/10/16
to xdotool-users
Something like this might work?

xdotool search --class firefox set_desktop_for_window %@ 1


Jostein

Joe Consultant

unread,
Oct 13, 2016, 1:22:43 AM10/13/16
to jbe...@broadpark.no, xdotool-users
That looks promising.

The problem is that  I just ran the first part of it and got a ton of results.

To try to reduce that, I added --maxdepth 1 which reduced the results considerably, but still yielded:

bigbird@sananda:~$ xdotool search --class --maxdepth 1 konsole
94371866
bigbird@sananda:~$ xdotool search --class --maxdepth 1 dolphin
100678032
100668442
100679860
100681686
bigbird@sananda:~$ xdotool search --class --maxdepth 1 vivaldi
121634817
121634819
121634854
bigbird@sananda:~$ xdotool search --class --maxdepth 1 thunderbird
10485761
10485857
10485895
10485901
10485911
10485945
10485948
10485951
10485986
10487536
10639246
10692850
10625671
10726762
10825282
10628254
10629247
10699576
bigbird@sananda:~$ 

Each application has only one (user visible) window open. Konsole has 3 tabs open, but in one window. Dolphin has 5 tabs open in one window.

What is this going to do with all those values?

The man page says it will add them to the stack, but I'm not sure what the rest of the command chain will do with them.

Also, I will want another separate konsole window on another desktop later. I think I can use kstart to give it a unique window title so I can tell the two apart using --name.

I also tried:
xdotool search --name '.*dolphin.*'
(with and without dolphin capitalized)

which returned nothing.

Thanks.




Jostein

--
You received this message because you are subscribed to a topic in the Google Groups "xdotool-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xdotool-users/B8FFkYyAxNI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xdotool-users+unsubscribe@googlegroups.com.
To post to this group, send email to xdotoo...@googlegroups.com.
Visit this group at https://groups.google.com/group/xdotool-users.
For more options, visit https://groups.google.com/d/optout.

Joe Consultant

unread,
Oct 13, 2016, 2:27:27 PM10/13/16
to Jostein Berntsen, xdotool-users
Your suggestion works! It got all my apps on the correct desktops.

The only wrinkle was that somebody (xdotool or KDE) uses zero-based desktop numbers. Once I figured that out, it worked as desired.

My only remaining issue is being able to differentiate between two different konsole windows which I want on different desktops. Any ideas on how to do that would be appreciated. 

I tried using --name (see previous post), but didn't get it to work.

Thanks.
Reply all
Reply to author
Forward
0 new messages