I'd like to know what desktop a window is on before I do anything with it.
I have a script which first makes sure konsole is running (by looking at ps -ef).
If KDE 5 continues to be almost useless at restoring sessions as it is now, there will be exactly one instance of konsole running (from a user's point of view) when this script runs.
(Later, it may have multiple tabs open, but I haven't implemented that yet.)
I'm trying to get the following command right.
dt=$(xdotool search --class konsole get_desktop_for_window %@ )
This doesn't work because the search returns -1 6 . (6 is the correct desktop where konsole is.)
I tried adding --maxdepth 2 or --maxdepth 1 which didn't help.
I also tried using %1 instead of %@ which didn't work either.
Next, I tried
dt=$(xdotool search --class konsole get_desktop_for_window %2 )
which worked, but I have no idea if it will continue to work.
Where does the -1 come from?
How do I do this correctly?
-----
Also, when I run a search by itself on windows from other applications, I sometimes get a bunch of results. How do I figure out which of those is the one I really want?
E.g. If I have dolphin running with 5 tabs and search returns 4 (not 5) results. How can I tell which one is the "master/top" one? - if I want to manipulate/move the whole application, not just one of its tabs.
TIA