From c8ce6fd9a974174d7714f469a4fe26a7884f4a1a Mon Sep 17 00:00:00 2001 From: Simon Vedaa <80512369+simsam8@users.noreply.github.com> Date: Tue, 7 May 2024 20:30:08 +0200 Subject: [PATCH] Simplify keybind generation code for workspaces Change workspace keybind generation to use keycodes instead of numbers. This makes the code snippet work with different layouts. Removed redundant code. --- pages/Nix/Hyprland on Home Manager.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pages/Nix/Hyprland on Home Manager.md b/pages/Nix/Hyprland on Home Manager.md index c973cfb..4adc85b 100644 --- a/pages/Nix/Hyprland on Home Manager.md +++ b/pages/Nix/Hyprland on Home Manager.md @@ -137,13 +137,10 @@ module, or the flake-based Home Manager module. # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} builtins.concatLists (builtins.genList ( x: let - ws = let - c = (x + 1) / 10; - in - builtins.toString (x + 1 - (c * 10)); + ws = builtins.toString (x + 10); in [ - "$mod, ${ws}, workspace, ${toString (x + 1)}" - "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + "$mod, code:${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, code:${ws}, movetoworkspace, ${toString (x + 1)}" ] ) 10)