feat(home): Add keybindings-script

This commit is contained in:
punkfairie 2025-01-12 19:26:13 -08:00
parent 051b44df9f
commit 8e1a1ab478
No known key found for this signature in database
GPG key ID: B3C5488E9A1A7CA6
2 changed files with 59 additions and 6 deletions

View file

@ -4,14 +4,43 @@
pkgs, pkgs,
... ...
}: let }: let
cfg = config.marleyos.services.waybar; cfg = config.marleyos.programs.waybar;
in { 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 { config = lib.mkIf cfg.enable {
marleyos.services.swaync.enable = true; 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; enable = true;
# https://gitlab.com/Zaney/zaneyos/-/blob/main/config/waybar.nix # https://gitlab.com/Zaney/zaneyos/-/blob/main/config/waybar.nix
@ -141,7 +170,7 @@ in {
"custom/hyprbindings" = { "custom/hyprbindings" = {
tooltip = false; tooltip = false;
format = "󱕴"; format = "󱕴";
on-click = "sleep 0.1 && list-hypr-bindings"; on-click = "sleep 0.1 && ${keybindings-script}";
}; };
"idle_inhibitor" = { "idle_inhibitor" = {

View file

@ -36,10 +36,12 @@ in {
]; ];
marleyos = { marleyos = {
programs.wofi.enable = true; programs = {
waybar.enable = true;
wofi.enable = true;
};
services = { services = {
swaync.enable = true; swaync.enable = true;
waybar.enable = true;
}; };
}; };
@ -222,6 +224,8 @@ in {
"$mod" = "SUPER"; "$mod" = "SUPER";
# When changing these, make sure to also update waybar's script, defined
# below.
bind = [ bind = [
"$mod, Q, killactive," "$mod, Q, killactive,"
"$mod SHIFT, E, exit," "$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"''
];
}; };
} }