hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.62k stars 827 forks source link

floating windows close when mouse leaves bounding box #7261

Open enzi opened 1 month ago

enzi commented 1 month ago

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch main at commit 4b4971c06fb02df00a2bd20b6b47b5d0e7d799a7 (internal: introduce new types to avoid unsigned int rollover and signed int overflow (7216)). Date: Thu Aug 8 21:01:50 2024 Tag: v0.42.0-2-g4b4971c0, commits: 5071 flags: (if any) System Information: System name: Linux Node name: enzi-linux Release: 6.10.3-zen1-2-zen Version: #1 ZEN SMP PREEMPT_DYNAMIC Tue, 06 Aug 2024 07:47:21 +0000 GPU information: 07:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD103 [GeForce RTX 4080] [10de:2704] (rev a1) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX x86_64 Kernel Module 555.58.02 Tue Jun 25 01:39:15 UTC 2024 os-release: NAME="Garuda Linux" PRETTY_NAME="Garuda Linux" ID=garuda ID_LIKE=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://garudalinux.org/" DOCUMENTATION_URL="https://wiki.garudalinux.org/" SUPPORT_URL="https://forum.garudalinux.org/" BUG_REPORT_URL="https://gitlab.com/groups/garuda-linux/" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=garudalinux plugins: ======Config-Start====== Config File: /home/enzi/.config/hypr/hyprland.conf: Read Succeeded # _ _ _ _ # | | | |_ _ _ __ _ __| | __ _ _ __ __| | # | |_| | | | | '_ \| '__| |/ _` | '_ \ / _` | # | _ | |_| | |_) | | | | (_| | | | | (_| | # |_| |_|\__, | .__/|_| |_|\__,_|_| |_|\__,_| # |___/|_| # # ----------------------------------------------------- # IMPORTANT: Don't overwrite ML4W configuration. # Create your own custom configuration variation instead. # https://gitlab.com/stephan-raabe/dotfiles#hyprland-configuration-variations # ----------------------------------------------------- # Monitor # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/monitor.conf # ----------------------------------------------------- # Autostart # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/autostart.conf # ----------------------------------------------------- # Cursor # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/cursor.conf # ----------------------------------------------------- # Environment # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/environment.conf # ----------------------------------------------------- # Keyboard # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/keyboard.conf # ----------------------------------------------------- # Load pywal color file # ----------------------------------------------------- source = ~/.cache/wal/colors-hyprland.conf # ----------------------------------------------------- # Load configuration files # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/window.conf source = ~/dotfiles/hypr/conf/decoration.conf source = ~/dotfiles/hypr/conf/layout.conf source = ~/dotfiles/hypr/conf/misc.conf source = ~/dotfiles/hypr/conf/keybinding.conf source = ~/dotfiles/hypr/conf/windowrule.conf # ----------------------------------------------------- # Animation # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/animation.conf # ----------------------------------------------------- # Custom # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/custom.conf # ----------------------------------------------------- # ML4W Configuration # ----------------------------------------------------- source = ~/dotfiles/hypr/conf/ml4w.conf # ----------------------------------------------------- # Environment for xdg-desktop-portal-hyprland # ----------------------------------------------------- exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP Config File: /home/enzi/dotfiles/hypr/conf/monitor.conf: Read Succeeded source = ~/dotfiles/hypr/conf/monitors/default.conf Config File: /home/enzi/dotfiles/hypr/conf/monitors/default.conf: Read Succeeded # ----------------------------------------------------- # Monitor Setup # name: "Default" # ----------------------------------------------------- #monitor=,preferred,auto,1 monitor=DP-2,2560x1440@143.97,0x0,1 monitor=DP-1,2560x1440@143.97,2560x0,1 Config File: /home/enzi/dotfiles/hypr/conf/autostart.conf: Read Succeeded # ----------------------------------------------------- # Autostart # ----------------------------------------------------- # Setup XDG for screen sharing exec-once = ~/dotfiles/hypr/scripts/xdg.sh # Start Polkit exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Load Dunst Notification Manager exec-once = dunst # Load GTK settings exec-once = ~/dotfiles/hypr/scripts/gtk.sh # Using hypridle to start hyprlock exec-once = hypridle # Load cliphist history exec-once = wl-paste --watch cliphist store # Autostart ML4W App exec-once = ~/dotfiles/hypr/scripts/ml4w-welcome-autostart.sh # Start ewww daemon exec-once = ~/dotfiles/hypr/scripts/eww.sh # Initialize waypaper exec-once = waypaper --restore # Launch Waybar exec-once = ~/dotfiles/waybar/launch.sh # Start autostart cleanup exec-once = ~/dotfiles/hypr/scripts/cleanup.sh # Load configuration from ML4W Hyprland Settings App exec = ~/.config/ml4w-hyprland-settings/hyprctl.sh # Load session manager exec-once = hyprsession # Load Hyprspace exec-once = hyprpm enable Hyprspace # Load all LDM partitions exec-once = sudo ldmtool create all # set primary monitorq exec-once = xrandr --output DP-1 --primary exec-once = protonmail-bridge Config File: /home/enzi/dotfiles/hypr/conf/cursor.conf: Read Succeeded exec-once = hyprctl setcursor Sweet-cursors 24 Config File: /home/enzi/dotfiles/hypr/conf/environment.conf: Read Succeeded source = ~/dotfiles/hypr/conf/environments/default.conf Config File: /home/enzi/dotfiles/hypr/conf/environments/default.conf: Read Succeeded # ----------------------------------------------------- # Environment Variables # name: "Default" # ----------------------------------------------------- # Set in ml4w.conf env = QT_QPA_PLATFORMTHEME,qt6ct env = QT_QPA_PLATFORM,wayland env = XDG_MENU_PREFIX,plasma- Config File: /home/enzi/dotfiles/hypr/conf/keyboard.conf: Read Succeeded # ----------------------------------------------------- # Keyboard Layout # https://wiki.hyprland.org/Configuring/Variables/#input # ----------------------------------------------------- input { kb_layout = us kb_variant = altgr-intl kb_model = kb_options = numlock_by_default = true mouse_refocus = false repeat_rate=35 repeat_delay=350 # For United States # kb_layout = us # kb_variant = intl # kb_model = pc105 # kb_options = follow_mouse = 0 mouse_refocus = false touchpad { # for desktop natural_scroll = false # for laptop # natural_scroll = yes # middle_button_emulation = true # clickfinger_behavior = false } sensitivity = 0 # -1.0 - 1.0, 0 means no modification. } gestures { workspace_swipe = true } Config File: /home/enzi/.cache/wal/colors-hyprland.conf: Read Succeeded $background = rgb(0E0D0E) $foreground = rgb(ece1cc) $color0 = rgb(0E0D0E) $color1 = rgb(335569) $color2 = rgb(575D5D) $color3 = rgb(956C49) $color4 = rgb(B3966D) $color5 = rgb(6D8690) $color6 = rgb(AEA593) $color7 = rgb(ece1cc) $color8 = rgb(a59d8e) $color9 = rgb(335569) $color10 = rgb(575D5D) $color11 = rgb(956C49) $color12 = rgb(B3966D) $color13 = rgb(6D8690) $color14 = rgb(AEA593) $color15 = rgb(ece1cc) Config File: /home/enzi/dotfiles/hypr/conf/window.conf: Read Succeeded source = ~/dotfiles/hypr/conf/windows/default.conf Config File: /home/enzi/dotfiles/hypr/conf/windows/default.conf: Read Succeeded # ----------------------------------------------------- # General window layout and colors # name: "Default" # ----------------------------------------------------- general { gaps_in = 10 gaps_out = 14 border_size = 3 col.active_border = $color11 col.inactive_border = rgba(ffffffff) layout = dwindle resize_on_border = true } Config File: /home/enzi/dotfiles/hypr/conf/decoration.conf: Read Succeeded source = ~/dotfiles/hypr/conf/decorations/default.conf Config File: /home/enzi/dotfiles/hypr/conf/decorations/default.conf: Read Succeeded # ----------------------------------------------------- # General window decoration # name: "Default" # ----------------------------------------------------- decoration { rounding = 10 blur { enabled = true size = 6 passes = 2 new_optimizations = on ignore_opacity = true xray = true # blurls = waybar } active_opacity = 1.0 inactive_opacity = 0.8 fullscreen_opacity = 1.0 drop_shadow = true shadow_range = 30 shadow_render_power = 3 col.shadow = 0x66000000 } Config File: /home/enzi/dotfiles/hypr/conf/layout.conf: Read Succeeded source = ~/dotfiles/hypr/conf/layouts/default.conf Config File: /home/enzi/dotfiles/hypr/conf/layouts/default.conf: Read Succeeded # ----------------------------------------------------- # Layouts # ----------------------------------------------------- dwindle { pseudotile = true preserve_split = true } master { # new_is_master = true # new_status = master } gestures { workspace_swipe = false } Config File: /home/enzi/dotfiles/hypr/conf/misc.conf: Read Succeeded # ----------------------------------------------------- # Misc settings # ----------------------------------------------------- misc { disable_hyprland_logo = true disable_splash_rendering = true } Config File: /home/enzi/dotfiles/hypr/conf/keybinding.conf: Read Succeeded source = ~/dotfiles/hypr/conf/keybindings/default.conf Config File: /home/enzi/dotfiles/hypr/conf/keybindings/default.conf: Read Succeeded # ----------------------------------------------------- # Key bindings # name: "Default" # ----------------------------------------------------- # SUPER KEY $mainMod = SUPER # Applications bind = $mainMod, Q, exec, ~/dotfiles/.settings/terminal.sh # Open the terminal bind = $mainMod, B, exec, ~/dotfiles/.settings/browser.sh # Open the browser bind = $mainMod, E, exec, ~/dotfiles/.settings/filemanager.sh # Open the filemanager # Windows bind = $mainMod, C, killactive # Kill active window bind = $mainMod, F, fullscreen # Set active window to fullscreen bind = $mainMod, V, togglefloating # Toggle active windows into floating mode bind = $mainMod SHIFT, T, exec, ~/dotfiles/hypr/scripts/toggleallfloat.sh # Toggle all windows into floating mode bind = $mainMod, J, togglesplit # Toggle split bind = $mainMod, left, movefocus, l # Move focus left bind = $mainMod, right, movefocus, r # Move focus right bind = $mainMod, up, movefocus, u # Move focus up bind = $mainMod, down, movefocus, d # Move focus down bindm = $mainMod, mouse:272, movewindow # Move window with the mouse bindm = $mainMod, mouse:273, resizewindow # Resize window with the mouse bind = $mainMod SHIFT, right, resizeactive, 100 0 # Increase window width with keyboard bind = $mainMod SHIFT, left, resizeactive, -100 0 # Reduce window width with keyboard bind = $mainMod SHIFT, down, resizeactive, 0 100 # Increase window height with keyboard bind = $mainMod SHIFT, up, resizeactive, 0 -100 # Reduce window height with keyboard bind = $mainMod, G, togglegroup # Toggle window group # Actions bind = $mainMod SHIFT, A, exec, ~/dotfiles/hypr/scripts/toggle-animations.sh # Toggle animations bind = $mainMod, PRINT, exec, ~/dotfiles/hypr/scripts/screenshot.sh # Take a screenshot bind = $mainMod CTRL, Q, exec, wlogout # Start wlogout bind = $mainMod SHIFT, W, exec, waypaper --random # Change the wallpaper bind = $mainMod CTRL, W, exec, waypaper # Open wallpaper selector #bind = $mainMod CTRL, RETURN, exec, rofi -show drun -replace -i # Open application launcher bind = ALT, SPACE, exec, rofi -show drun -replace -i # Open application launcher bind = $mainMod CTRL, H, exec, ~/dotfiles/hypr/scripts/keybindings.sh # Show keybindings bind = $mainMod SHIFT, B, exec, ~/dotfiles/waybar/launch.sh # Reload waybar bind = $mainMod CTRL, B, exec, ~/dotfiles/waybar/toggle.sh # Toggle waybar bind = $mainMod SHIFT, R, exec, ~/dotfiles/hypr/scripts/loadconfig.sh # Reload hyprland config #bind = $mainMod, V, exec, ~/dotfiles/scripts/cliphist.sh # Open clipboard manager bind = $mainMod CTRL, T, exec, ~/dotfiles/waybar/themeswitcher.sh # Open waybar theme switcher bind = $mainMod CTRL, S, exec, ~/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage # Open ML4W Dotfiles Settings app bind = $mainMod SHIFT, S, exec, ~/dotfiles/hypr/scripts/hyprshade.sh # Toggle screenshader bind = $mainMod ALT, G, exec, ~/dotfiles/hypr/scripts/gamemode.sh # Toggle game mode # Workspaces bind = $mainMod, 1, workspace, 1 # Open workspace 1 bind = $mainMod, 2, workspace, 2 # Open workspace 2 bind = $mainMod, 3, workspace, 3 # Open workspace 3 bind = $mainMod, 4, workspace, 4 # Open workspace 4 bind = $mainMod, 5, workspace, 5 # Open workspace 5 bind = $mainMod, 6, workspace, 6 # Open workspace 6 bind = $mainMod, 7, workspace, 7 # Open workspace 7 bind = $mainMod, 8, workspace, 8 # Open workspace 8 bind = $mainMod, 9, workspace, 9 # Open workspace 9 bind = $mainMod, 0, workspace, 10 # Open workspace 10 bind = $mainMod SHIFT, 1, movetoworkspace, 1 # Move active window to workspace 1 bind = $mainMod SHIFT, 2, movetoworkspace, 2 # Move active window to workspace 2 bind = $mainMod SHIFT, 3, movetoworkspace, 3 # Move active window to workspace 3 bind = $mainMod SHIFT, 4, movetoworkspace, 4 # Move active window to workspace 4 bind = $mainMod SHIFT, 5, movetoworkspace, 5 # Move active window to workspace 5 bind = $mainMod SHIFT, 6, movetoworkspace, 6 # Move active window to workspace 6 bind = $mainMod SHIFT, 7, movetoworkspace, 7 # Move active window to workspace 7 bind = $mainMod SHIFT, 8, movetoworkspace, 8 # Move active window to workspace 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 # Move active window to workspace 9 bind = $mainMod SHIFT, 0, movetoworkspace, 10 # Move active window to workspace 10 bind = $mainMod, mouse_down, workspace, e+1 # Open next workspace bind = $mainMod, mouse_up, workspace, e-1 # Open previous workspace bind = $mainMod CTRL, down, workspace, empty # Open the next empty workspace #bind = $mainMod, S, overview:toggle bind = $mainMod SHIFT, comma, movecurrentworkspacetomonitor, l bind = $mainMod SHIFT, period, movecurrentworkspacetomonitor, r plugin { overview { #onBottom = true overrideAnimSpeed = 5 autoDrag = true } } # Passthrough SUPER KEY to Virtual Machine bind = $mainMod, P, submap, passthru # Passthrough SUPER key to virtual machine submap = passthru bind = SUPER, Escape, submap, reset # Get SUPER key back from virtual machine submap = reset # Fn keys bind = , XF86MonBrightnessUp, exec, brightnessctl -q s +10% # Increase brightness by 10% bind = , XF86MonBrightnessDown, exec, brightnessctl -q s 10%- # Reduce brightness by 10% bind = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5% # Increase volume by 5% bind = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5% # Reduce volume by 5% bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle # Toggle mute bind = , XF86AudioPlay, exec, playerctl play-pause # Audio play pause bind = , XF86AudioPause, exec, playerctl pause # Audio pause bind = , XF86AudioNext, exec, playerctl next # Audio next bind = , XF86AudioPrev, exec, playerctl previous # Audio previous bind = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle # Toggle microphone bind = , XF86Calculator, exec, qalculate-gtk # Open calculator bind = , XF86Lock, exec, hyprlock # Open screenlock bind = , XF86Tools, exec, alacritty --class dotfiles-floating -e ~/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage # Open ML4W Dotfiles Settings app Config File: /home/enzi/dotfiles/hypr/conf/windowrule.conf: Read Succeeded source = ~/dotfiles/hypr/conf/windowrules/default.conf Config File: /home/enzi/dotfiles/hypr/conf/windowrules/default.conf: Read Succeeded ## ----------------------------------------------------- # Window rules # ----------------------------------------------------- windowrule = tile,^(Microsoft-edge)$ windowrule = tile,^(Brave-browser)$ windowrule = tile,^(Chromium)$ windowrule = float,^(pavucontrol)$ windowrule = float,^(blueman-manager)$ windowrule = float,^(nm-connection-editor)$ #windowrule = float,^(qalculate-gtk)$ windowrule = float,^(qalculate-gtk)$ windowrulev2 = float,class:(unityhub) #windowrulev2 = idleinhibit none,class:(godot) #windowrulev2 = stayfocused,class:^Unity,floating:1 Config File: /home/enzi/dotfiles/hypr/conf/animation.conf: Read Succeeded source = ~/dotfiles/hypr/conf/animations/default.conf Config File: /home/enzi/dotfiles/hypr/conf/animations/default.conf: Read Succeeded # ----------------------------------------------------- # Animations # name "Default" # ----------------------------------------------------- animations { enabled = true bezier = myBezier, 0.05, 0.9, 0.1, 1.05 animation = windows, 1, 7, myBezier animation = windowsOut, 1, 7, default, popin 80% animation = border, 1, 10, default animation = borderangle, 1, 8, default animation = fade, 1, 7, default animation = workspaces, 1, 6, default } Config File: /home/enzi/dotfiles/hypr/conf/custom.conf: Read Succeeded # Add your additional Hyprland configurations here # # This is an additional key binding # bind = $mainMod CTRL, up, workspace, empty # # Example for xwayland # xwayland { # force_zero_scaling = true # } # qt5ct environment variable # env = QT_QPA_PLATFORMTHEME,qt5c Config File: /home/enzi/dotfiles/hypr/conf/ml4w.conf: Read Succeeded # ----------------------------------------------------- # ML4W configurations # ----------------------------------------------------- # Pavucontrol floating windowrulev2 = float,class:(.*org.pulseaudio.pavucontrol.*) windowrulev2 = size 700 600,class:(.*org.pulseaudio.pavucontrol.*) windowrulev2 = center,class:(.*org.pulseaudio.pavucontrol.*) # OpenAI ChatGPT floating windowrulev2 = float,title:(.*chat.openai.com.*) windowrulev2 = size 500 50%,title:(.*chat.openai.com.*) windowrulev2 = move 20 70,title:(.*chat.openai.com.*) # ML4W Welcome App floating windowrulev2 = float,class:(.*waypaper.*) windowrulev2 = size 800 700,class:(.*waypaper.*) windowrulev2 = center,class:(.*waypaper.*) # ML4W Welcome App floating windowrulev2 = float,class:(com.ml4w.welcome) windowrulev2 = size 700 600,class:(com.ml4w.welcome) windowrulev2 = center,class:(com.ml4w.welcome) windowrulev2 = float,class:(ml4w-welcome.py) windowrulev2 = size 400 500,class:(ml4w-welcome.py) windowrulev2 = center,class:(ml4w-welcome.py) # ML4W Settings App floating windowrulev2 = float,class:(com.ml4w.dotfilessettings) windowrulev2 = size 700 600,class:(com.ml4w.dotfilessettings) windowrulev2 = move 10% 20%,class:(com.ml4w.dotfilessettings) windowrulev2 = float,class:(ml4w-dotfiles-settings.py) windowrulev2 = size 400 500,class:(ml4w-dotfiles-settings.py) windowrulev2 = move 10% 20%,class:(ml4w-dotfiles-settings.py) # ML4W Hyprland App floating windowrulev2 = float,class:(com.ml4w.hyprland.settings) windowrulev2 = size 700 600,class:(com.ml4w.hyprland.settings) windowrulev2 = center,class:(com.ml4w.hyprland.settings) windowrulev2 = float,class:(ml4w-hyprland-settings.py) windowrulev2 = size 700 600,class:(ml4w-hyprland-settings.py) windowrulev2 = center,class:(ml4w-hyprland-settings.py) # General floating windowrulev2 = float,class:(dotfiles-floating) windowrulev2 = size 1000 800,class:(dotfiles-floating) windowrulev2 = center,class:(dotfiles-floating) # XDG Desktop Portal env = XDG_CURRENT_DESKTOP,Hyprland env = XDG_SESSION_TYPE,wayland env = XDG_SESSION_DESKTOP,Hyprland # QT env = QT_QPA_PLATFORM,wayland;xcb env = QT_QPA_PLATFORMTHEME,qt6ct env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 env = QT_AUTO_SCREEN_SCALE_FACTOR,1 # GTK env = GDK_SCALE,1 # Mozilla env = MOZ_ENABLE_WAYLAND,1 # Set the cursor size for xcursor env = XCURSOR_SIZE,24 # Disable appimage launcher by default env = APPIMAGELAUNCHER_DISABLE,1 ======Config-End======== ```

Description

Jetbrains Rider and Unity editor have the problem that popups auto close when the mouse leaves the bounding box of the floating window.

In some cases this can be prevented because it's known where the popup will appear but if the mouse is not inside when it opens there's no chance you can interact with the window.

I tried to get this under control with follow_mouse but that wasn't working out. The more promising workaround was with a window rule: windowrulev2 = stayfocused,class:^Unity,floating:1 for Unity and Rider. However, this rule breaks any form of drag & drop in Rider. Can't move folders, files or reposition code files anymore.

Is it possible to fix this problem without any weird workarounds? Of course I asked in Discord on several occasions but as outlined, I didn't find a solution that didn't have terrible side effects.

How to reproduce

Easiest is in Rider, press CTRL-Shift-F to open Find in files, move mouse outside the window, it will auto close. Expected behaviour: it doesn't close

Crash reports, logs, images, videos

No response

vaxerski commented 1 month ago

that's a bug in our xwayland impl, and thus not very important to me

enzi commented 1 month ago

Sorry, I didn't mention it. The same thing happens in Rider with Wayland. Checked hyperctl clients to make sure XWayland is 0.

vaxerski commented 1 month ago

that's rider's doing then

enzi commented 1 month ago

I can report the bug to Jetbrains but I don't think they can do something about it and will just refer me back to you. After all, it's working in KDE or Gnome and has to do with hyprland sending a focus event to the main rider window as soon as the mouse leaves a popup window. While this is a feature I like very much for some apps it's not working out.

What I'm asking here is a window rule so that this can be prevented. As mentioned stayfocused fixes that particular problem but creates a more severe one, breaking drag&drop, so it's not an option.

A window rule that would only switch focus on a mouse click would help here. At least I think it should.

vaxerski commented 1 month ago

it's called focus follows mouse. That's what you opted in

enzi commented 1 month ago

It happens with Wayland and follow_mouse = 0 too.

edit: okay setting follow_mouse = 0 and float_switch_override_focus = 0 fixes the problem of Find in files closing when mouse leaves but still breaks drag&drop.

enzi commented 1 month ago

I got this working now with everything I wanted which means follow_mouse, mouse_refocus and float_switch_override_focus are at default values.

I've switched Rider back to XWayland because Wayland breaks drag&drop in Hyprland no matter what. and added a small patch to InputManager.cpp so there won't be a focus change when the window is floating and they have the same class.

} else {
            if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_pLastMouseFocus.lock() != pFoundWindow)) || refocus)) {
                if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_pLastWindow.lock() != pFoundWindow || g_pCompositor->m_pLastFocus != foundSurface || refocus) {

                    if (!(pFoundWindow->m_bIsFloating && pFoundWindow->m_szInitialClass == m_pLastMouseFocus->m_szInitialClass)) // added this
                    {
                        m_pLastMouseFocus = pFoundWindow;

                        // TODO: this looks wrong. When over a popup, it constantly is switching.
                        // Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit.
                        if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_pLastWindow.lock() != pFoundWindow)
                            g_pCompositor->focusWindow(pFoundWindow, foundSurface);
                        else
                            g_pCompositor->focusSurface(foundSurface, pFoundWindow);
                    }
                }
            }
        }

If you're interested I can make a PR. I've just added this as proof of concept, though I think the logic of ignoring focus state of popups with the same class is solid enough.

edit: Wayland Rider Drag & Drop is broken in KDE Wayland too, so ignore that.

vaxerski commented 1 month ago

the patch is wrong behavior IMO.

vaxerski commented 1 month ago

popups on wayland should NOT be windows, but instead an xdg_popup. Then it would work correctly

enzi commented 1 month ago

Thanks vaxry, that's good information, I'll bring this over to the Jetbrains issue tracker.

Yeah, I can agree that this workaround should not make it into production. However, as Jetbrains Wayland isn't usable right now anyway and we have to fall back to XWayland, there's still no state that make follow_mouse = 1 work with it. As the patch also fixes the same problems in Unity (also XWayland), if you have any better idea or config, please tell me.

The patch could easily be extended to look for XWayland = 1 but that filter can also be just added to the window rule itself.

vaxerski commented 1 month ago

I'd assume that there is some atom or property set for the window to have focus precedence but idk what they use, since X11 is a total mess

For XWayland issues, I have little interest in spending hours to fix some small quirks.

For the wayland issue, this is a problem with your app

enzi commented 1 month ago

Vaxry, you have been very helpful. I can relate to the annoying XWayland quirks not finding motivation to fix them. Let's leave it at that, I found a personal patch, which others can also use if they so desire and until Jetbrains/Unity can do a proper Wayland implementation.

enzi commented 1 month ago

I reported the problem to the Jetbrains devs. Sadly didn't go so well and they have a pretty good argument against using xdg_popup.

https://youtrack.jetbrains.com/issue/RIDER-115826/Wayland-Hyprland-Problem-with-auto-focus-and-popups-spawned-as-windows

So, any ideas that are not just disable auto focus? Personally I think going back to my initial workaround, the auto focus from follow_mouse makes no sense in the context of a window that has a floating window. At least I can't think of any normal circumstance where it would.

Child windows where auto focus should be prevented can be easily classified with having the same PID or class (but PID is easier to compare) and having floating enabled.

As you mentioned wrong behavior previously. What is wrong about it?

vaxerski commented 1 month ago

in its current state, this is unsolvable properly. One way would be to use https://wayland.app/protocols/xdg-dialog-v1 to mark the popup as a dialog, but this isn't yet supported in hyprland. I can draft an implementation, though, when I get the chance (on holiday atm)

vaxerski commented 1 month ago

KWin does support it atm so it could be used for testing

enzi commented 1 month ago

Thanks again. No worry, enjoy your free time. It's already great you're even replying!

Found this merge for Mutter: https://gitlab.gnome.org/GNOME/gtk/-/commit/cf8c3be0307c3e044d23658d0cd9f0d501f01ee3 Wayland doc is probably outdated.

vaxerski commented 1 month ago

that's gdk, the client toolkit, not mutter, the gnome compositor

enzi commented 1 month ago

well damn, got my hopes up. so it needs a separate implementation. didn't even find any tracking for it. oof

vaxerski commented 1 month ago

it shouldn't be a big deal unless you use gnome though :)

you could still suggest the impl in the ide to jetbrains guys, would be a step in the good direction

enzi commented 4 weeks ago

Yeah not interested at all in gnome ^^ I already suggested it to the jetbrains devs. Not really familiar with it, I would think they can implement a fallback when xdg-dialog-v1 is not available. Gnome is kinda big so I hope it doesn't get ignored because of it.

vaxerski commented 4 weeks ago

there is no fallback mechanism AFAIK that would explicitly request this kind of treatment

vaxerski commented 4 weeks ago

this is a good thing though - it forces app developers to only assume what the protocol assumes, and write conformant apps.

You cannot assume the compositor will not switch focus to another window of yours unless you use a protocol feature that explicitly states it will. :)

Instead of X11 hell, where everything and their dog was relying on bugs and """features""" of Xorg, we get uniform, clear and standard methods to achieve what we need.

enzi commented 4 weeks ago

100% with you, I just fear when the biggest or 2nd biggest DE doesn't have it implemented they will just stick to normal modal windows (like now). So I'm not sure how that is forcing anyone. :/ Kinda surprised that Mutter has it not implemented. Can't be that hard to add.

romanstingler commented 4 weeks ago

@enzi you should watch Brodie's wayland videos :) gnome always wants to be special, and they discuss things 10 years, others have already implemented for ages.

vaxerski commented 4 weeks ago

With Gnome's default focus behavior this bug should not manifest itself anyways (in gnome)

enzi commented 4 weeks ago

@vaxerski as you suggested it, hope you know. the jetbrains dev asked me:

I don't see xdg-dialog-v1 supporting the move request, so how is it better than xdg_popup?

My reply was:

Maybe I'm not reading it right?

The xdg_wm_dialog_v1 interface is exposed as a global object allowing to register surfaces with a xdg_toplevel role as "dialogs" relative to another toplevel.

and
https://wayland.app/protocols/xdg-toplevel-drag-v1

So, a dialog can be implemented just as a window as xdg_toplevel and then marked as dialog. Does that seem accurate?

vaxerski commented 4 weeks ago

absolutely, xdg_dialog is just a "tag"

TraceLD commented 2 weeks ago

@vaxerski imo the real issue here is that if you opt out of the default mouse following to a more traditional follow_mouse = 2, you can no longer drag and drop anything in JetBrains IDEs on native Wayland. Any idea what might be causing that?

vaxerski commented 1 week ago

misc:always_follow_on_dnd default true, has to be left as true for dnd

vaxerski commented 1 week ago

FWIW imo the correct way of solving this is for jetbrains to not close the window on lost focus but rather on something like a mouse button event on a surface that isnt the dialog