yazgoo / umberwm

:ram: a minimalistic X window manager based on tinywm, inspired by qtile.
57 stars 3 forks source link

Bug: Windows become uncontrollable after restart #22

Closed mfdorst closed 3 years ago

mfdorst commented 3 years ago

I implemented a simple way to restart like so: main.rs

...
custom_actions: vec![
    // ...
    ("q".to_string(), Box::new(|| std::process::exit(1))),
    ("r".to_string(), Box::new(|| std::process::exit(0))),
]

umberwm-start (the script I use to start umberwm)

while true; do
    # Restart if exit code is zero, otherwise quit
    umberwm || break
done

and what I found is that when restarting, the existing windows just sit where they were to begin with. They are interactable, and if it's a terminal you can still close it by typing exit, but you cannot close it or move it with keybindings, and when making new windows they just cover the old windows like they aren't even there.

I assume there is some list of window handles somewhere, and making a new window will add the handle to the list, but umberwm probably does not check for existing windows on startup, so that's probably what's causing the problem. I'll look into this.

mfdorst commented 3 years ago

I've been looking through the dwm source to see how they do it, and I think it's the scan() function that's responsible for this. https://github.com/mfdorst/dwm/blob/master/dwm.c#L1385

yazgoo commented 3 years ago

having this would be awesome. Another thing we could do is serialize the state and load it at startup (then delete the serialized state to make sure that next startups won't try and load it).

yazgoo commented 3 years ago

see #25 for first implementation based on state serialization