{ hyprLib, mainMod, ... }: let inherit (hyprLib) bind makeSubmap muldsp pass sendShortcut submap ; makePassthrough = window: binds: let customBinds = map (mapping: let k = builtins.elemAt mapping 0; v = builtins.elemAt mapping 1; d = if builtins.length mapping >= 3 then builtins.elemAt mapping 2 else ""; in [k (muldsp [(sendShortcut v window) (submap "reset")]) d] ) binds; in customBinds ++ [["ESCAPE" (submap "reset")]]; fehBinds = [ [ "RETURN" "0"] [ "1" "1"] [ "2" "2"] [ "3" "3"] [ "4" "4"] [ "W" "5"] [ "A" "6"] [ "D" "7"] [ "F" "8"] [ "Z" "9"] [ "Q" "LEFT"] [ "E" "RIGHT"] [ "S" "h"] [ "H" "h"] ]; feishinBinds = [ [ "0" "0" "Send '0' to feishin"] [ "1" "1" "Send '1' to feishin"] [ "2" "2" "Send '2' to feishin"] [ "3" "3" "Send '3' to feishin"] [ "4" "4" "Send '4' to feishin"] [ "W" "5" "Send '5' to feishin"] [ "S" "h" "Send 'h' to feishin"] [ "H" "h" "Send 'h' to feishin"] [ "Q" "q" "Send 'q' to feishin"] [ "E" "e" "Send 'e' to feishin"] [ "SPACE" "space" "Send 'space' to feishin"] [ "A" "a" "Send 'a' to feishin"] [ "D" "d" "Send 'd' to feishin"] ]; in { home-manager.users."djai".wayland.windowManager.hyprland.settings = { bind = [ (bind "${mainMod} + SHIFT + A" (submap "feh") "") (bind "${mainMod} + SHIFT + F" (submap "feishin") "Enter feishin passthrough mode") (bind "F7" (pass "class:^(com.obsproject.Studio)$") "Send F7 to obs studio") (bind "F8" (pass "class:^(com.obsproject.Studio)$") "Send F8 to obs studio") (bind "F9" (pass "class:^(com.obsproject.Studio)$") "Send F9 to obs studio") ]; define_submap = [ (makeSubmap "feh" (makePassthrough "class:^*hideme)$" fehBinds)) (makeSubmap "feishin" (makePassthrough "class:^(feishin)$" feishinBinds)) ]; }; }