Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11 window manager is not detected when XDG_SESSION_TYPE is incorrect #165

Open
Absolpega opened this issue Aug 29, 2023 · 2 comments
Open

Comments

@Absolpega
Copy link
Contributor

I was just setting up a testing setup to try and fix #9.
I am on hyprland.
I have a Xephyr x session opened as display :3.
I ran DISPLAY=:3 awesome to run the wm.
Then I ran DISPLAY=:3 env -u WAYLAND_DISPLAY alacritty to get a terminal in the x session
but when I ran my fetch no wm was detected.

In the libmacchina code when deciding if to check for X11 or Wayland the XDG_SESSION_TYPE env variable is used.
This was still set to wayland so it ran detect_wayland_window_manager() which obviously failed on x11.

This could be prevented by doing detect_wayland_window_manager().or_else(|_| detect_xorg_window_manager()).
But that sounds like a very lazy and incomplete solution.

I just tried to run a regular x session with startx but XDG_SESSION_TYPE was now set to tty creating the same problem.

I don't think we should be relying on XDG_SESSION_TYPE.

@Absolpega
Copy link
Contributor Author

elkowar/eww uses this to detect wayland

fn detect_wayland() -> bool {
    let session_type = std::env::var("XDG_SESSION_TYPE").unwrap_or_default();
    let wayland_display = std::env::var("WAYLAND_DISPLAY").unwrap_or_default();
    session_type.contains("wayland") || (!wayland_display.is_empty() && !session_type.contains("x11"))
}

@Absolpega
Copy link
Contributor Author

don't know how to work with github
did not mean to do that

@Absolpega Absolpega reopened this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant