diff --git a/modules/home/services/waybar/default.nix b/modules/home/programs/waybar/default.nix similarity index 90% rename from modules/home/services/waybar/default.nix rename to modules/home/programs/waybar/default.nix index 15d1bb2..66cf32c 100644 --- a/modules/home/services/waybar/default.nix +++ b/modules/home/programs/waybar/default.nix @@ -4,14 +4,43 @@ pkgs, ... }: let - cfg = config.marleyos.services.waybar; + cfg = config.marleyos.programs.waybar; in { - options.marleyos.services.waybar.enable = lib.mkEnableOption "waybar"; + options.marleyos.programs.waybar = { + enable = lib.mkEnableOption "waybar"; + + keybindings-script = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = ""; + description = "The keybindings to use for a cheatsheet."; + }; + }; config = lib.mkIf cfg.enable { marleyos.services.swaync.enable = true; - programs.waybar = { + programs.waybar = let + keybindings-script = + pkgs.writeShellScript "keybindings-cheatsheet-wayland" + # bash + '' + ${lib.getExe pkgs.yad} \ + --width=800 \ + --height=650 \ + --center \ + --fixed \ + --title="Keybindings" \ + --no-buttons \ + --list \ + --column=Key: \ + --column=Description: \ + --column=Command: \ + --timeout=90 \ + --timeout-indicator=right \ + ${lib.concatStringsSep "\\\n" cfg.keybindings-script} \ + "" + ''; + in { enable = true; # https://gitlab.com/Zaney/zaneyos/-/blob/main/config/waybar.nix @@ -141,7 +170,7 @@ in { "custom/hyprbindings" = { tooltip = false; format = "󱕴"; - on-click = "sleep 0.1 && list-hypr-bindings"; + on-click = "sleep 0.1 && ${keybindings-script}"; }; "idle_inhibitor" = { diff --git a/modules/home/wayland/hyprland/default.nix b/modules/home/wayland/hyprland/default.nix index df9ef1a..eb00772 100644 --- a/modules/home/wayland/hyprland/default.nix +++ b/modules/home/wayland/hyprland/default.nix @@ -36,10 +36,12 @@ in { ]; marleyos = { - programs.wofi.enable = true; + programs = { + waybar.enable = true; + wofi.enable = true; + }; services = { swaync.enable = true; - waybar.enable = true; }; }; @@ -222,6 +224,8 @@ in { "$mod" = "SUPER"; + # When changing these, make sure to also update waybar's script, defined + # below. bind = [ "$mod, Q, killactive," "$mod SHIFT, E, exit," @@ -277,5 +281,25 @@ in { ]; }; }; + + marleyos.programs.waybar.keybindings-script = [ + ''" = SUPER" "modifier key" ""'' + ''" + ENTER" "launch terminal" ""'' + ''" + r" "launcher" ""'' + ''" + q" "kill focused window" "killactive"'' + ''" + SHIFT + E" "exit hyprland" "exit"'' + ''" + SHIFT + SPACE" "toggle floating" "togglefloating"'' + ''" + e" "toggle split direction" "togglesplit"'' + ''" + h" "move focus left" "movefocus, l"'' + ''" + j" "move focus down" "movefocus, d"'' + ''" + k" "move focus up" "movefocus, u"'' + ''" + l" "move focus right" "movefocus, r"'' + ''" + 1-0" "move to workspace 1-10" "workspace, #"'' + ''" + SHIFT + 1-0" "move window to workspace 1-10" "movetoworkspace, #"'' + ''" + MOUSE UP" "move to next workspace" "workspace, e+1"'' + ''" + MOUSE DOWN" "move to prev workspace" "workspace, e-1"'' + ''" + LMB" "move/drag window" "movewindow"'' + ''" + RMB" "resize window" "resizewindow"'' + ]; }; }