Keep window position

My qubes was always on.
Now, electrical problems make me turn it off daily, and when turn it back on, move all the window to their desktop and positions makes me crazy.
What solutions do you know?
Thank you.

Hi,

these related topics may help you.

from these two topics, you can use devilspie2 (see example in the first one).

Also note the warning.

devilspie2 must be installed in dom0.
Review your threat model before doing so. :slight_smile:

3 Likes

Or in sys-gui?

No proper solution. Unlike KDE, the current and the only available DE out of the box is XFCE, which is not good with windows management (sounds funny).
It has no ability to set default windows position for starting apps, nor to fix window at some space, nor to properly remember maximized and other states. Eventually it forgets and breaks stuff.

The workaround is to use devilspie2, as other proposed. It is reasonably good.

But it has its problems, too:

  1. You will install it to dom0 manually, it is half-abandoned project.
  2. It will probably break after migration to Wayland in future (unlike DE’s features)
  3. It will require from you to manually write scripts in Lua language (not difficult, though).
  4. No GUI if you are not OK with GUI-less apps.
  5. Most important: it only affects new opening windows, it does not react to any changes and does not control window’s live-time, if you need to fix window or do something tricky - no way.
1 Like

I didn’t play with sys-gui, but I guess yes.

I almost forgot, but it’s not Qubes specific. :slight_smile:

Instead of devilspie2, you could also use wmctrl or (maybe) xdotool.

from https://wiki.xfce.org/faq#window_manager

How can I programmatically switch workspaces, move windows, etc?
You can use a tool such as wmctrl to switch workspaces, move windows between workspaces, change window positions, maximize windows, and much more. libwnck is a library that also does similar things.

from https://docs.xfce.org/xfce/xfce4-session/start

Xfce4-session is a session manager for Xfce. Its task is to save the state of your desktop (opened applications and their location) and restore it during a next startup. You can create several different sessions and choose one of them on startup.

Apps Menu > System Tools > Session and Startup > Automatically save session on logout
or / and
When you logout: there is an option Save session for future logins
It could work.

And, of course, search engine are your friend. :slight_smile:
e.g. https://www.startpage.com/do/search?q=xfce+open+app+in+specific+workspace

3 Likes

I use script with wmcrl and hotkey for it.
Something like

#!/bin/bash                                                                                                                                                    
                                                                                                                                                               
##### Distribute windows into workspaces                                                                                                                       
##### wmctrl -lx  - to see windows WM_CLASS            
##### (wmctrl -x -r detects only first window of the same WM_CLASS, to move all of them need to find their hex)
                                                                                                                                                               
find_windows_hex() {                                                                                                                                           
  # $1 - window WM_CLASS                                                                                                                                       
  wmctrl -lx | grep "$1" | cut -d' ' -f1                                                                                                                       
}                                                                                                                                                              
                                                                                                                                                               
move_windows_to_workspace() {                                                                                                                                  
  # $1 - window WM_CLASS                                                                                                                                       
  # $2 - workspace number                                                                                                                                      
  for hex in $(find_windows_hex $1)                                                                                                                            
  do                                                                                                                                                           
    wmctrl -i -r $hex -t $2                                                                                                                                    
  done                                                                                                                                                         
}                                                                                                                                                              
                                                                                                                                                               
                                                                                                                                                               
### WORKSPACE 0                                                                                                                                                
# Work FF                                                                                                                                                      
move_windows_to_workspace WORK:Navigator.WORK:firefox 0

### WORKSPACE 1
# Work Skype
move_windows_to_workspace WORK:skype.WORK:Skype 1