diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-06-04 22:13:15 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-06-04 22:13:15 +0200 |
commit | 575592a12de700d00dc7219abc45270242ee4e24 (patch) | |
tree | b7f0432df42d197f42475f9901806ace19346f00 | |
parent | d72ce588fba98750aae8831f78ecda3b77900840 (diff) |
Hyprland: fix background of ui not rendering, if waybar is running and it's running in dock mode
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | src/Overlay.cpp | 31 |
3 files changed, 36 insertions, 3 deletions
@@ -61,8 +61,8 @@ I'm looking for somebody that can create sound effects for the notifications.  # Known issues -* When the UI is open the wallpaper is shown instead of the game on Hyprland. This is an issue with Hyprland. It cant be fixed until the UI is redesigned to not be a fullscreen overlay. -* Opening the UI when a game is fullscreen can mess up the game window a bit on Hyprland. This is an issue with Hyprland. +* When the UI is open the wallpaper is shown instead of the game on Hyprland. This is an issue with Hyprland. It cant be fixed until the UI is redesigned to not be a fullscreen overlay. Change your waybar dock mode to "dock" in its config to fix this. +* Opening the UI when a game is fullscreen can mess up the game window a bit on Hyprland. This is an issue with Hyprland. Change your waybar dock mode to "dock" in its config to fix this. * The background of the UI is black when opening the UI while a Wayland application is focused on COSMIC. This is an issue with COSMIC. * Unable to close the region selection with escape key while a Wayland application is focused on COSMIC. This is an issue with COSMIC. @@ -183,3 +183,7 @@ Support freetype for text rendering. Maybe load freetype as runtime (with dlopen Show .webm container option. It's currently chosen automatically if vp8/vp9 is chosen. The available containers should automatically switch depending on the video codec. In settings show audio levels for each audio. Maybe show audio level image beside the audio name in the dropdown box and switch to a different image (have 3-4 different images for each level) depending on the volume. + +Only use fake cursor on wayland if the focused x11 window is fullscreen. + +Create window as a real overlay window, using layer shell protocol, when possible. This will however minimize windows on floating wms. Check if this can be fixed somehow, or only use layer shell in tiling wms.
\ No newline at end of file diff --git a/src/Overlay.cpp b/src/Overlay.cpp index eaa91b6..2d9b275 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -273,6 +273,33 @@ namespace gsr { return true; } + static bool is_hyprland_waybar_running_as_dock() { + const char *args[] = { "hyprctl", "layers", nullptr }; + std::string stdout_str; + if(exec_program_on_host_get_stdout(args, stdout_str) != 0) + return false; + + int waybar_layer_level = -1; + int current_layer_level = 0; + string_split_char(stdout_str, '\n', [&](const std::string_view line) { + if(line.find("Layer level 0") != std::string_view::npos) + current_layer_level = 0; + else if(line.find("Layer level 1") != std::string_view::npos) + current_layer_level = 1; + else if(line.find("Layer level 2") != std::string_view::npos) + current_layer_level = 2; + else if(line.find("Layer level 3") != std::string_view::npos) + current_layer_level = 3; + else if(line.find("namespace: waybar") != std::string_view::npos) { + waybar_layer_level = current_layer_level; + return false; + } + return true; + }); + + return waybar_layer_level >= 0 && waybar_layer_level <= 1; + } + static Hotkey config_hotkey_to_hotkey(ConfigHotkey config_hotkey) { return { (uint32_t)mgl::Keyboard::key_to_x11_keysym((mgl::Keyboard::Key)config_hotkey.key), @@ -904,6 +931,8 @@ namespace gsr { const std::string wm_name = get_window_manager_name(display); const bool is_kwin = wm_name == "KWin"; const bool is_wlroots = wm_name.find("wlroots") != std::string::npos; + const bool is_hyprland = wm_name.find("Hyprland") != std::string::npos; + const bool hyprland_waybar_is_dock = is_hyprland && is_hyprland_waybar_running_as_dock(); std::optional<CursorInfo> cursor_info; if(cursor_tracker) { @@ -1035,7 +1064,7 @@ namespace gsr { // Owlboy seems to use xi events and XGrabPointer doesn't prevent owlboy from receiving events. xi_grab_all_mouse_devices(xi_display); - if(!is_wlroots) + if(!is_wlroots && !hyprland_waybar_is_dock) window->set_fullscreen(true); visible = true; |