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
21.5k stars 899 forks source link

no_cursor_warps prevents focusing window on another monitor #2967

Open SpoodyTheOne opened 1 year ago

SpoodyTheOne commented 1 year ago

Hyprland Version

Hyprland, built from branch at commit b08b72358ad549fd066e5be0fc3aa4c9df367607 dirty (). Tag: v0.27.2 flags: (if any)

Bug or Regression?

Bug

Description

When no_cursor_warps is enabled you can't switch to another monitor where the mouse isn't, as the focus is instantly given back to the window the cursor is hovering.

The expected behavior should be that a window on the other monitor stays focused when switching.

How to reproduce

1) Have 2 monitors 2) Open a window on each monitor 3) Hover over a window on one monitor, then change workspace to the one on the other monitor 4) Observe the border briefly changing to focused, before focus is given back to the other workspace

Crash reports, logs, images, videos

No response

MightyPlaza commented 1 year ago

cannot repro

gekoke commented 1 year ago

I am experiencing the same issue.

Here is my hyprland.conf (pinned to when I was experiencing the issue).

Output of hyprctl version:

Hyprland, built from branch  at commit 664827473583f8e986f9fb2a37a13e9b3a232cc2  ().
Tag: ?

flags: (if any)
debug

Using the Nix flake version from revision 664827473583f8e986f9fb2a37a13e9b3a232cc2, with enableNvidiaPatches = true;

MightyPlaza commented 1 year ago

nop, nothing I have no idea what I'm missing

gekoke commented 1 year ago

I should note that I also have WLR_NO_HARDWARE_CURSORS set to 1 (not through hyprland.conf). I have some additional configuration appended to my config file, generated through Nix (though I'm doubtful it makes any difference). You can try it if you feel like testing this further (you should omit the first line):

exec-once=/nix/store/2g5287nbipd9xr1mqjp1m9pmg292nhal-dbus-1.14.8/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target
input {
    kb_layout = ee
    kb_variant = us
    kb_options = caps:ctrl_modifier
}

layerrule = blur, (waybar|notifications|gtk-layer-shell|rofi)

general {
    gaps_out = 10
    gaps_in = 5

    border_size = 1
    col.active_border = rgb(f5bde6) rgb(c6a0f6) rgb(8bd5ca) rgb(91d7e3) rgb(7dc4e4) rgb(8aadf4) rgb(b7bdf8)
    col.inactive_border = rgb(494d64)
}

decoration {
    rounding = 1;
    blur {
        enabled = true
        size = 8
        passes = 3
    }
}

bezier = overshot, 0.05, 0.9, 0.1, 1.1
bezier = easeInOutQuint, 0.86, 0, 0.07, 1
bezier = easeOutExpo, 0.19, 1, 0.22, 1

animations {
    animation = workspaces, 1, 3, easeInOutQuint, slidevert
    animation = windows, 1, 4, easeOutExpo, popin
}

source = ~/.config/hypr/monitors.conf

binde = SUPER, apostrophe, exec, kitty

# Prefer high refresh rate
monitor=,highrr,auto,1

input {
    # 0 - Cursor movement will not change focus.
    # 1 - Cursor movement will always change focus to the window under the cursor.
    # 2 - Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window.
    # 3 - Cursor focus will be completely separate from keyboard focus. Clicking on a window will not change keyboard focus.
    follow_mouse = 2
}

general {
    layout = master
    no_cursor_warps = true
}

master {
    mfact = 0.5
}

misc {
    animate_manual_resizes = true
    animate_mouse_windowdragging = true
    enable_swallow = true
    swallow_regex = ^(Alacritty)$
}

binde = SUPER, C, killactive,
binde = SUPER, V, togglefloating,
binde = SUPER, F, fullscreen, 0 # Fullscreen
binde = SUPER, U, fullscreen, 1 # Maximized

binde = SUPER, H, movefocus, l
binde = SUPER, J, layoutmsg, cyclenext
binde = SUPER, K, layoutmsg, cycleprev
binde = SUPER, L, movefocus, r

binde = SUPER SHIFT, H, resizeactive, -60 0
binde = SUPER SHIFT, J, resizeactive, 0 60    
binde = SUPER SHIFT, K, resizeactive, 0 -60
binde = SUPER SHIFT, L, resizeactive, 60 0

binde = SUPER, return, layoutmsg, swapwithmaster
binde = SUPER SHIFT, return, layoutmsg, focusmaster

binde = SUPER, space, layoutmsg, swapnext
binde = SUPER SHIFT, space, layoutmsg, swapprev

binde = CTRL SUPER, H, moveactive, -60 0
binde = CTRL SUPER, J, moveactive, 0 60
binde = CTRL SUPER, K, moveactive, 0 -60
binde = CTRL SUPER, L, moveactive, 60 0

bind = SUPER ALT, W, layoutmsg, orientationtop
bind = SUPER ALT, A, layoutmsg, orientationleft
bind = SUPER ALT, S, layoutmsg, orientationbottom
bind = SUPER ALT, D, layoutmsg, orientationright
bind = SUPER ALT, C, layoutmsg, orientationcenter

bind = SUPER, 1, workspace, 1
bind = SUPER, 2, workspace, 2
bind = SUPER, 3, workspace, 3
bind = SUPER, 4, workspace, 4
bind = SUPER, 5, workspace, 5
bind = SUPER, 6, workspace, 6
bind = SUPER, 7, workspace, 7
bind = SUPER, 8, workspace, 8
bind = SUPER, 9, workspace, 9
bind = SUPER, 0, workspace, 10

binde = SUPER SHIFT, 1, movetoworkspacesilent, 1
binde = SUPER SHIFT, 2, movetoworkspacesilent, 2
binde = SUPER SHIFT, 3, movetoworkspacesilent, 3
binde = SUPER SHIFT, 4, movetoworkspacesilent, 4
binde = SUPER SHIFT, 5, movetoworkspacesilent, 5
binde = SUPER SHIFT, 6, movetoworkspacesilent, 6
binde = SUPER SHIFT, 7, movetoworkspacesilent, 7
binde = SUPER SHIFT, 8, movetoworkspacesilent, 8
binde = SUPER SHIFT, 9, movetoworkspacesilent, 9
binde = SUPER SHIFT, 0, movetoworkspacesilent, 10

bind = SUPER CTRL, H, movecurrentworkspacetomonitor, l
bind = SUPER CTRL, J, movecurrentworkspacetomonitor, d
bind = SUPER CTRL, K, movecurrentworkspacetomonitor, u
bind = SUPER CTRL, L, movecurrentworkspacetomonitor, r

# LMB
bindm = SUPER, mouse:272, movewindow
# RMB
bindm = SUPER, mouse:273, resizewindow
$kw = master:no_gaps_when_only
binde = SUPER, M, exec, hyprctl keyword $kw $(($(hyprctl getoption $kw -j | /nix/store/rp0bkxz69iry91676ymw64gw9x2av0ky-jq-1.6-bin/bin/jq '.int') ^ 1))
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia

bind = SUPER, Q, exec, pkill wlogout || wlogout -p layer-shell

general {
  cursor_inactive_timeout = 5
}

bind = SUPER SHIFT, S, exec, grimblast copy area

bind = SUPER, P, exec, pkill rofi || rofi -show drun

bindle = ,XF86AudioRaiseVolume, exec, volumectl -u up
bindle = ,XF86AudioLowerVolume, exec, volumectl -u down
bindle = ,XF86AudioMute, exec,  volumectl toggle-mute
bindle = ,XF86AudioMicMute, exec, volumectl -m toggle-mute

bindle = ,XF86MonBrightnessUp, exec, lightctl up
bindle = ,XF86MonBrightnessDown, exec, lightctl down
memchr commented 1 year ago

Can you upload the logs after reproducing this issue? /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log.

ArtemSmaznov commented 7 months ago

Interesting, I have exactly the same behavior but not with monitors (switching focus between monitors if fine for me), but with steam (from pacman) - if I have steam and some other window on the screen then when I switch focus between steam and other window then the focus jumps back to the window which has the cursor over. So I think this would have the same root cause - can open a separate issue if this turns our to be a separate issue though.

Focus works fine between many non-steam windows. The logic of the issues on my side seems to be: if focus changes between steam and any other window then move focus to the window under cursor. I can confirm that this was not an issue in the past, I don't remember when this regressed but it was at least a month ago, I think.

Can also confirm that the issue doesn't happen with Brave which is also Xwayland on my side as that was my first guess.

I have commented my entire config side from my keybindings and genera.no_cursor_warps = true and the issue is reproducible.

Minimal config:

general {
    no_cursor_warps = true 
}
bind = SUPER     , h   , movefocus , l    # focus left window
bind = SUPER     , j   , movefocus , d    # focus below window
bind = SUPER     , k   , movefocus , u    # focus above window
bind = SUPER     , l   , movefocus , r    # focus right window

This is what is being logged when I have my cursor and focus on my terminal and movefocus to steam:

[LOG] Keybind triggered, calling dispatcher (64, , 104)
[LOG] Searching for matching rules for Alacritty (title: Alacritty)
[LOG] Set keyboard focus to surface 5ec8a769c600, with [Window 5ec8a769f070: title: "Steam"]
[LOG] Callback 5ec8a76e4d78 -> 5ec8a76e4d70, CTextInput removed.
[LOG] Callback 5ec8a76e4de0 -> 5ec8a76e4dd8, CTextInput removed.
[LOG] Searching for matching rules for steam (title: Steam)
[LOG] cursorImage request: surface 5ec8a75b1d80
[LOG] Registered signal for owner 5ec89ac48a78: 5ec8a75b2098 -> 5ec89ac48ac0 (owner: CWLSurface)
[LOG] Registered signal for owner 5ec89ac48a78: 5ec8a75b2058 -> 5ec89ac48b28 (owner: CWLSurface)
[LOG] CWLSurface 5ec89ac48a78 called init()
[LOG] Callback 5ec8a75e8228 -> 5ec8a75e8220, IME Keyboard Grab removed.
[LOG] IME TextInput Keyboard Grab destroy
[LOG] Searching for matching rules for steam (title: Steam)
[LOG] Set keyboard focus to surface 5ec8a58540e0, with [Window 5ec8a5542f50: title: "Alacritty"]
[LOG] Registered signal for owner 5ec8a76e4b90: 5ec8a58543d8 -> 5ec8a76e4d50 (owner: CTextInput)
[LOG] Registered signal for owner 5ec8a76e4b90: 5ec8a58543f8 -> 5ec8a76e4db8 (owner: CTextInput)
[LOG] Searching for matching rules for Alacritty (title: Alacritty)
[LOG] TI ENABLE
[LOG] cursorImage request: shape 9
[LOG] Callback 5ec89ac48ae8 -> 5ec89ac48ae0, CWLSurface removed.
[LOG] Callback 5ec89ac48b50 -> 5ec89ac48b48, CWLSurface removed.
[LOG] CWLSurface 5ec89ac48a78 called destroy()
[LOG] IME TextInput Keyboard Grab new
[LOG] Registered signal for owner 5ec8a576ead0: 5ec8a565b820 -> 5ec8a576eae0 (owner: IME Keyboard Grab)