sminez / penrose

A library for writing an X11 tiling window manager
https://sminez.github.io/penrose/
MIT License
1.27k stars 88 forks source link

Question: how to make xfce4-panel persist on all tags? #255

Closed MrFoxPro closed 1 year ago

MrFoxPro commented 1 year ago

Thanks for this project. I've sucessfully setup penrose and launched it with xfce4-panel via .xinitrc and via SpawnOnStartup. Also tried with/w/o args: -d --disable-sm-client. In all cases panel appeared only on first tag, after switching to another it disappears. https://youtu.be/AifQyUyuG28 sorry for video, wasn't able to record screen on fresh WM

Corbanator commented 1 year ago

I encountered this same issue when trying to set up polybar. I couldn't find anything online, so I wrote a function that finds the polybar window and moves it to the tag I'm moving to and kind of spliced it into my keybinding to switch workspaces, and that seems to work pretty well. It's kind of hacky, but I figure if it works, it works

MrFoxPro commented 1 year ago

I encountered this same issue when trying to set up polybar. I couldn't find anything online, so I wrote a function that finds the polybar window and moves it to the tag I'm moving to and kind of spliced it into my keybinding to switch workspaces, and that seems to work pretty well. It's kind of hacky, but I figure if it works, it works

could you please share code of your function?

Corbanator commented 1 year ago

Sure.

fn change_workspace<X: XConn> (tag: String) -> Box<dyn KeyEventHandler<X>> {
    key_handler(move |state, x:&X| {
        let app_name_query = AppName {
            0: "polybar"
        };
        let clients = state.client_set.clone();
        let mut client_iter = clients.clients();
        let mut matched_clients: Vec<&Xid> = vec!();
        while let Some(cli) = client_iter.next() {
            if x.query(&app_name_query, *cli)? {
                matched_clients.push(cli);
            }
        }
        for cli in matched_clients {
            x.modify_and_refresh(state, |cli_set|{cli_set.move_client_to_tag(cli, &tag); cli_set.focus_tag(&tag)})?;
        }
        Ok(())
    })
}

replace "polybar" with the name of the program you want and it will always just move with you

edit: replace the function that it normally runs to change workspaces with this one.

sminez commented 1 year ago

Workspace detection should work just fine if you are adding in the provided EWMH support that programs like polybar and xfce4-panel require.

https://sminez.github.io/penrose/extensions/ewmh.html

https://github.com/sminez/penrose/blob/develop/examples/ewmh_compatability/main.rs

MrFoxPro commented 1 year ago

Workspace detection should work just fine if you are adding in the provided EWMH support that programs like polybar and xfce4-panel require.

https://sminez.github.io/penrose/extensions/ewmh.html

https://github.com/sminez/penrose/blob/develop/examples/ewmh_compatability/main.rs

Yes, I used sources from this example. Panel detects and switches tags, but just disappears, like it is overflowed by something or isn't rendered at all on tags 2-9. It works fine on tag 1.

sminez commented 1 year ago

That sounds a lot like the bar is getting managed as a regular window and placed on the first workspace rather than being mapped and then left alone. Which is really odd...it should be setting override redirect and Penrose should be honouring that.

https://github.com/sminez/penrose/blob/develop/src/core/handle.rs#L64-L67

There is an action you can bind which will log out the current internal state which you can use to confirm if that's what's going on: https://github.com/sminez/penrose/blob/develop/src/builtin/actions/mod.rs#L77-L83

Corbanator commented 1 year ago

Oh, I fixed mine. Turns out there's a setting I needed to manually enable to override redirect in the polybar config. Maybe it's the same for xfce4-panel? I couldn't find anything online about it, which is kinda weird. It also fixed the issue I was having where I would accidentally move focus up to the polybar (possible because penrose was actually managing it) and accidentally close polybar instead of the window I wanted to close

Corbanator commented 1 year ago

Is there a way I could get it not to display on a certain workspace, though? I've had some issues with video games where I need a workspace where polybar doesn't show up, but now it shows up on that one as well

sminez commented 1 year ago

The ewmh support also lets you set a program to be full screen.

The only thing I'd point out is that Penrose is deliberately a very minimal system so you are likely to find other pieces of missing functionality if you expect it to work like a normal desktop environment.

The idea is to use it as a starting point and build up what you need: I've purposely removed features from other WMs / DEs that I didn't like 😉

MrFoxPro commented 1 year ago

Oh, I fixed mine. Turns out there's a setting I needed to manually enable to override redirect in the polybar config. Maybe it's the same for xfce4-panel? I couldn't find anything online about it, which is kinda weird. It also fixed the issue I was having where I would accidentally move focus up to the polybar (possible because penrose was actually managing it) and accidentally close polybar instead of the window I wanted to close

i3 and awesomeWM handles xfce4-panel correctly somehow.

MrFoxPro commented 1 year ago

https://github.com/i3/i3/issues/1694

MrFoxPro commented 1 year ago

Maybe that's because Penrose trying to send event to panel and it switches to some "configuration" state? I see in my case it appears on top even in config it should be at bottom of screen.

MrFoxPro commented 1 year ago

image image image image I'm completely new to Rust, attempted to debug manage_existing_clients. It detects xfce4-panel. override_redirect is true

MrFoxPro commented 1 year ago

Tbh I can switch away from xfce... But I thought it could be more gradual.

MrFoxPro commented 1 year ago

That's odd. I was able to setup panel correctly inside Xephyr even without change_workspace function. But it disappears when switching tags when running in tty.