|
11 | 11 | system = pkgs.stdenv.hostPlatform.system; |
12 | 12 | zen-browser = inputs.zen-browser.packages.${system}.beta; |
13 | 13 | hyprnavi = lib.getExe inputs.hyprnavi-psm.packages.${system}.default; |
| 14 | + |
| 15 | + # Window classes that should trigger passthrough submap (disables mouse keybinds) |
| 16 | + passthrough-classes = [ |
| 17 | + "gamescope" |
| 18 | + ".gamescope-wrapped" |
| 19 | + "marvel-win64-shipping.exe" |
| 20 | + "steam_app_3228590" # Deadzone Rouge |
| 21 | + ]; |
| 22 | + |
| 23 | + # Auto-switch submap based on focused window class |
| 24 | + submap-switcher = pkgs.writeScript "hypr-submap-switcher" '' |
| 25 | + #!${lib.getExe pkgs.fish} |
| 26 | + set socket "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" |
| 27 | + set passthrough_classes ${lib.concatStringsSep " " passthrough-classes} |
| 28 | +
|
| 29 | + ${lib.getExe pkgs.socat} -U - "UNIX-CONNECT:$socket" | while read -l line |
| 30 | + set parts (string split ">>" $line) |
| 31 | + set event $parts[1] |
| 32 | + set data $parts[2] |
| 33 | +
|
| 34 | + if test "$event" = activewindow |
| 35 | + set class (string split "," $data)[1] |
| 36 | + set is_game false |
| 37 | + for pattern in $passthrough_classes |
| 38 | + if string match -q $pattern $class |
| 39 | + set is_game true |
| 40 | + break |
| 41 | + end |
| 42 | + end |
| 43 | + if test $is_game = true |
| 44 | + hyprctl dispatch submap passthrough |
| 45 | + else |
| 46 | + hyprctl dispatch submap reset |
| 47 | + end |
| 48 | + end |
| 49 | + end |
| 50 | + ''; |
14 | 51 | in |
15 | 52 | { |
| 53 | + # Passthrough submap for games - disables mouse keybinds |
| 54 | + # Switched automatically by submap-switcher listening to IPC |
| 55 | + wayland.windowManager.hyprland.extraConfig = '' |
| 56 | + submap = passthrough |
| 57 | + bind = $mod SUPER, Escape, submap, reset |
| 58 | + bind = $mod SUPER, F, fullscreen |
| 59 | + submap = reset |
| 60 | + ''; |
| 61 | + |
16 | 62 | wayland.windowManager.hyprland.settings = { |
| 63 | + exec-once = [ "${submap-switcher}" ]; |
17 | 64 | # Use Alt as primary mod (like niri config) |
18 | 65 | "$mod" = "ALT"; |
19 | 66 |
|
|
61 | 108 | "$mod, D, centerwindow" |
62 | 109 | "$mod, D, layoutmsg, fit visible" # fits all visible windows onto screen space |
63 | 110 | "$mod, P, togglefloating" |
64 | | - "$mod, S, togglegroup" # Column tabbed display equivalent |
65 | 111 | "$mod SUPER, F, fullscreen" |
| 112 | + "$mod, S, togglespecialworkspace, scratch" # Scratch layer - toggle visibility of all floating windows |
66 | 113 |
|
67 | 114 | # |
68 | 115 | # ══════════════════════════════════════════════════════════════════════════ |
|
0 commit comments