You are not logged in.
Pages: 1
When I start a session the first thing I normally do is open about five xterms and spread them over my three monitors. Since the window switcher buttons don't give you any indication of where the terminals are, I just carefully open them in order, left to right: |0,1|2,3|4| (pipe symbol is the edge of a monitor) and I know by habit which xterm number is on which monitor. But on restarting, whereas the buttons are in the same order, the xterms themselves are in fact seemingly distributed over my desktop at random. I'm not sure if there's any logic to it at all. For example opening xterms, going left to right I' get: |1,0|2,3|4| (two terms on the first two monitors, one term on the rightmost monitor). Note that on monitor #1, the primary, the xterms open R>L by themselves but on monitor #2 they open L>R. Anyway on restart the layout is: |3,4|2,1|0| ...no resemblance to how I created them. Logging out and restarting again the order is: |1,0|2,3|4| ... back to my original! Restart again: |3,4|2,1|0| ... there seems to be a hopping back and forth between two layouts. Can this be fixed? I'd like my xterms where I left them, or at least to have some idea how xfce might want to reorder them so I can cooperate.
Last edited by rayandrews (2022-10-09 15:19:20)
Offline
Hi Rayandrews,
What about creating a script that opens the terminals at startup in the sequence you want and where you want with wmctrl? (or devilspie2 or xdotool)
If you want to see the windows properties to gather information for your wmctrl/xdotool/devilspie2 settings use the command xprop and click on the window.
I think that:
The windows manager saves the windo positions at logout in /.cache/sessions/ and if you give a look at the file you will see that all terminals are (re-) created in one line, same priority. I'm guessing that your "window buttons"-bar is ordering the terminals according to the timestamp they finished to complete, which may be pretty random.
You could try to play around with the cache file after xfwm has closed, but I would not know how.
But if you start the terminals in order and them place them on the screens with wmctrl ... they should show up according to your configuration.
Offline
Hi bggf1:
Yeah, I took a quick look at wmctrl but never got it working. There is probably some way of doing it, but it seems to me that xfce should take care of it internally. All other open programs come back where I left them, it's only terminals that pop up placed randomly. Hard to believe that a few lines of code wouldn't take care of it. Interesting that sizes *are* remembered tho. I have three monitors, one much older and low res so the terminal open there is smaller. On restart it might be placed on another monitor, but it's unique size is remembered, I just hafta drag it back to where it should be. Thanks for the suggestions, if I dive into this more seriously I'll consider the programs you mention. Since the devs seem uninterested maybe that's the way to go.
Offline
Hhhmm wmctrl manages opened windows. You could try the other way:
I'm only speculating here, but
This is my terminal section in the sessions file .0
I had opened multiple xterminals (random)
...
Client6_CloneCommand=xfce4-terminal
Client6_RestartCommand=xfce4-terminal,--geometry=80x24,--display,:0.0,--role=xfce4-terminal-1679099926-4072753459,--show-menubar,--show-borders,--hide-toolbar,--active-tab,--working-directory,/home/...,--window,--geometry=80x24,--display,:0.0,--role=xfce4-terminal-1679151573-383930871,--show-menubar,--show-borders,--hide-toolbar,--active-tab,--working-directory,/home/...,--window,--geometry=80x24,--display,:0.0,--role=xfce4-terminal-1679151579-2725219238,--show-menubar,--show-borders,--hide-toolbar,--active-tab,--working-directory,/home/...,--window,--geometry=80x24,--display,:0.0,--role=xfce4-terminal-1679151583-1480841963,--show-menubar,--show-borders,--hide-toolbar,--active-tab,--working-directory,/home/...,--window,--geometry=80x24,--display,:0.0,--role=xfce4-terminal-1679151609-3228084245,--show-menubar,--show-borders,--hide-toolbar,--active-tab,--working-directory,/home/...,--sm-client-id,29e30e2f7-67f9-4132-b726-8b3243a01ac2
The positions are all there, but according to your experience it seems a race condition which window will finish first. The first one should show up first on the bar.
You could try to run a script before logging into your session, and try to separate these entries to Client 7,8....
Not be sure how to do that, but at that stage,login, there is an active, special user "lightdm" with home /var/lib/lightdm. Perhaps a .bashrc?
I tried to use wimctrl only once, got it kind of working, but never found a real use for it.
Devilspie2 seemed the most flexibal option, see https://www.linux-magazine.com/Issues/2 … Devilspie2, a bit more work, but it can also make a window open somewhere (rather than waiting for it to open).
I just want to mention that I have not tested any of this of course..just thinking out loud.
Offline
Thanks, those are useful observations. I'm occupied with other things right now but when I get back to thinking about this issue, your comments will get me on the right track.
Offline
Hello,
I tried to use wimctrl only once, got it kind of working, but never found a real use for it.
I use it at the start of the session in a script which launch applications on the right workspace (-s), at the right place (-e).
Something like this :
#!/bin/bash
sleep 2s
wmctrl -s 0
firefox &
sleep 1s
wmctrl -r "firefox" -e 0,15,36,1880,1020
sleep 2s
wmctrl -s 1
terminator &
sleep 1s
wmctrl -r "/bin/zsh" -e 0,10,30,912,620
I found out that I needed some delays between commands (time to launch the app or to switch workspace) and wmctrl works sometimes with window names and sometimes with window classes, if one doesn't work, try the other.
I used xprop to identify the class or name of a window :
xprop | grep -i class
or
xprop | grep -i name
EndeavourOS
Xfce+gtk3-classic (no CSD)+Picom
Offline
Thanks, nothing like an actual example, and all I need is to position xterms so that's something to chew on. As it is I normally like two open side by side on my two big monitors and the smaller, older monitor entirely dedicated to another xterm full size. Five total.
Last edited by rayandrews (2023-03-19 20:57:29)
Offline
Hi Gogogadget,
Thanks for the example and the tip with the workspace!
I had tried wmctrl and got it working, but having one screen...it wasn't super useful.
I however love the fact that it could toggle the windows to always be on top with:wmctrl -r "test1" -b toggle, so I had a program sitting at the corner of my screen in "always above" mode. Still opening a window by default on ONE screen stopped me using it.
But the idea with the workspace is very good! Thanks!
I had to laugh when I saw the sleep solution in the script. At the time I had tried all kinds of stuff to get wmctrl running AFTER the window was open, &&, ";" etc. but the command (xterm or firefox?) had always come back with "finished" after it started up, but before the window was drawn by the windows manager. Wmctrl almost always started before the window was there and came back with an error message similar to "no window found" .The only thing that worked was a sleep command too. I thought my system was slow, but I'm happy to see it is a standard solution LOL.
@ Rayandrews as your windows are currently drawn by xfce, you will have to change the settings in "Session and Startup" settings not to save your session OR if the setting is "ask me" make sure to uncheck the small (tiny??, OK that could be my eyes checkbox at the bottom of the popup.
Also as they are all xterminals, the best way to distinguish them may be to name them in the script and call up with a title:
xfce4-terminal --title test1
wmctrl -r "test1" -e 0,10,30,912,620
By default all your terminals will have the same title and wmctrl will take the first it finds.
Offline
"xfce4-terminal --title test1"
As I have it, the title is always the number of the terminal so that should be ok.
Offline
Pages: 1
[ Generated in 0.015 seconds, 7 queries executed - Memory usage: 575.27 KiB (Peak: 592.12 KiB) ]