Skip to content

Commit 217aeef

Browse files
committed
feat: add automated submap for games in hyprland
1 parent 364b787 commit 217aeef

File tree

1 file changed

+48
-1
lines changed
  • home/hosts/rune/config/desktop/_hyprland

1 file changed

+48
-1
lines changed

home/hosts/rune/config/desktop/_hyprland/binds.nix

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,56 @@ let
1111
system = pkgs.stdenv.hostPlatform.system;
1212
zen-browser = inputs.zen-browser.packages.${system}.beta;
1313
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+
'';
1451
in
1552
{
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+
1662
wayland.windowManager.hyprland.settings = {
63+
exec-once = [ "${submap-switcher}" ];
1764
# Use Alt as primary mod (like niri config)
1865
"$mod" = "ALT";
1966

@@ -61,8 +108,8 @@ in
61108
"$mod, D, centerwindow"
62109
"$mod, D, layoutmsg, fit visible" # fits all visible windows onto screen space
63110
"$mod, P, togglefloating"
64-
"$mod, S, togglegroup" # Column tabbed display equivalent
65111
"$mod SUPER, F, fullscreen"
112+
"$mod, S, togglespecialworkspace, scratch" # Scratch layer - toggle visibility of all floating windows
66113

67114
#
68115
# ══════════════════════════════════════════════════════════════════════════

0 commit comments

Comments
 (0)