From bc1af0160c03bec46b1e7ffc9a7f9c2273d840bb Mon Sep 17 00:00:00 2001 From: sioodmy Date: Thu, 30 May 2024 09:15:59 +0200 Subject: [PATCH] feat: niri workspace keybinds --- home/rice/niri/binds.nix | 92 ++++++++++++++++++++++++++++++++++++ home/rice/niri/config.nix | 77 +----------------------------- home/rice/waybar/default.nix | 2 +- 3 files changed, 94 insertions(+), 77 deletions(-) create mode 100644 home/rice/niri/binds.nix diff --git a/home/rice/niri/binds.nix b/home/rice/niri/binds.nix new file mode 100644 index 00000000..8f99d14a --- /dev/null +++ b/home/rice/niri/binds.nix @@ -0,0 +1,92 @@ +{ + config, + pkgs, + lib, + ... +}: { + programs.niri.settings.binds = with config.lib.niri.actions; let + sh = spawn "sh" "-c"; + in + { + "Mod+Return" = { + action = spawn "${pkgs.foot}/bin/foot"; + cooldown-ms = 500; + }; + "Mod+Space".action = spawn "${pkgs.fuzzel}/bin/fuzzel"; + "Mod+V".action = sh "${pkgs.cliphist}/bin/cliphist list | fuzzel --dmenu | cliphist decode | wl-copy"; + "Mod+Shift+Period".action = spawn "emoji"; + "Mod+Shift+L".action = sh "niri msg action power-off-monitors; gtklock"; + + "XF86AudioRaiseVolume".action = spawn "pamixer" "-i" "5"; + "XF86AudioLowerVolume".action = spawn "pamixer" "-d" "5"; + "XF86AudioMute".action = spawn "pamixer" "-t"; + "XF86AudioMicMute".action = spawn "micmute"; + + "XF86Bluetooth".action = spawn "bcn"; + + "XF86MonBrightnessUp".action = spawn "brightnessctl" "set" "+5%"; + "XF86MonBrightnessDown".action = spawn "brightnessctl" "set" "5%-"; + + "Mod+Period".action = expel-window-from-column; + "Mod+Comma".action = consume-window-into-column; + + "Mod+WheelScrollDown".action = focus-workspace-down; + "Mod+WheelScrollDown".cooldown-ms = 500; + "Mod+WheelScrollUp".action = focus-workspace-up; + "Mod+WheelScrollUp".cooldown-ms = 500; + "Mod+WheelScrollRight".action = focus-column-right; + "Mod+WheelScrollLeft".action = focus-column-left; + + "Mod+H".action = focus-column-left; + "Mod+L".action = focus-column-right; + "Mod+J".action = focus-workspace-down; + "Mod+K".action = focus-workspace-up; + "Mod+Left".action = focus-column-left; + "Mod+Right".action = focus-column-right; + "Mod+Down".action = focus-window-down; + "Mod+Up".action = focus-window-up; + + "Mod+Print".action = screenshot-window; + "Mod+Shift+Print".action = screenshot-screen; + "Mod+Shift+S".action = screenshot; + + "Mod+Ctrl+H".action = move-column-left; + "Mod+Ctrl+J".action = move-window-down; + "Mod+Ctrl+K".action = move-window-up; + "Mod+Ctrl+L".action = move-column-right; + + "Mod+U".action = move-workspace-down; + "Mod+I".action = move-workspace-up; + + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Equal".action = set-column-width "+10%"; + "Mod+Shift+Minus".action = set-window-height "-10%"; + "Mod+Shift+Equal".action = set-window-height "+10%"; + + "Mod+Shift+J".action = focus-monitor-down; + "Mod+Shift+K".action = focus-monitor-up; + + "Mod+Shift+Ctrl+H".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+J".action = move-column-to-monitor-down; + "Mod+Shift+Ctrl+K".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+L".action = move-column-to-monitor-right; + + "Mod+R".action = switch-preset-column-width; + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+C".action = center-column; + + "Mod+Q".action = close-window; + + "Mod+Shift+P".action = power-off-monitors; + } + // (lib.attrsets.mergeAttrsList ( + map (x: let + xStr = builtins.toString x; + in { + "Mod+${xStr}".action = focus-workspace x; + "Mod+Shift+${xStr}".action = move-column-to-workspace x; + }) + (builtins.genList (x: x + 1) 9) + )); +} diff --git a/home/rice/niri/config.nix b/home/rice/niri/config.nix index 6195addb..4a7f60a5 100644 --- a/home/rice/niri/config.nix +++ b/home/rice/niri/config.nix @@ -1,10 +1,9 @@ { - pkgs, theme, - config, ... }: with theme.colors; { + imports = [ ./binds.nix ]; programs.niri.settings = { spawn-at-startup = [ { @@ -103,80 +102,6 @@ with theme.colors; { } ]; - binds = with config.lib.niri.actions; let - sh = spawn "sh" "-c"; - in { - "Mod+Return" = { - action = spawn "${pkgs.foot}/bin/foot"; - cooldown-ms = 500; - }; - "Mod+Space".action = spawn "${pkgs.fuzzel}/bin/fuzzel"; - "Mod+V".action = sh "${pkgs.cliphist}/bin/cliphist list | fuzzel --dmenu | cliphist decode | wl-copy"; - "Mod+Shift+Period".action = spawn "emoji"; - "Mod+Shift+L".action = sh "niri msg action power-off-monitors; gtklock"; - - "XF86AudioRaiseVolume".action = spawn "pamixer" "-i" "5"; - "XF86AudioLowerVolume".action = spawn "pamixer" "-d" "5"; - "XF86AudioMute".action = spawn "pamixer" "-t"; - "XF86AudioMicMute".action = spawn "micmute"; - - "XF86Bluetooth".action = spawn "bcn"; - - "XF86MonBrightnessUp".action = spawn "brightnessctl" "set" "+5%"; - "XF86MonBrightnessDown".action = spawn "brightnessctl" "set" "5%-"; - - "Super+WheelScrollDown".action = focus-workspace-down; - "Super+WheelScrollDown".cooldown-ms = 500; - "Super+WheelScrollUp".action = focus-workspace-up; - "Super+WheelScrollUp".cooldown-ms = 500; - "Super+WheelScrollRight".action = focus-column-right; - "Super+WheelScrollLeft".action = focus-column-left; - - "Super+H".action = focus-column-left; - "Super+L".action = focus-column-right; - "Super+J".action = focus-workspace-down; - "Super+K".action = focus-workspace-up; - "Super+Left".action = focus-column-left; - "Super+Right".action = focus-column-right; - "Super+Down".action = focus-window-down; - "Super+Up".action = focus-window-up; - - "Super+Print".action = screenshot-window; - "Super+Shift+Print".action = screenshot-screen; - "Super+Shift+S".action = screenshot; - - "Super+Ctrl+H".action = move-column-left; - "Super+Ctrl+J".action = move-window-down; - "Super+Ctrl+K".action = move-window-up; - "Super+Ctrl+L".action = move-column-right; - - "Super+U".action = move-workspace-down; - "Super+I".action = move-workspace-up; - - "Super+Minus".action = set-column-width "-10%"; - "Super+Equal".action = set-column-width "+10%"; - "Super+Shift+Minus".action = set-window-height "-10%"; - "Super+Shift+Equal".action = set-window-height "+10%"; - - "Super+Shift+H".action = focus-monitor-left; - "Super+Shift+J".action = focus-monitor-down; - "Super+Shift+K".action = focus-monitor-up; - "Super+Shift+L".action = focus-monitor-right; - - "Super+Shift+Ctrl+H".action = move-column-to-monitor-left; - "Super+Shift+Ctrl+J".action = move-column-to-monitor-down; - "Super+Shift+Ctrl+K".action = move-column-to-monitor-up; - "Super+Shift+Ctrl+L".action = move-column-to-monitor-right; - - "Super+R".action = switch-preset-column-width; - "Super+F".action = maximize-column; - "Super+Shift+F".action = fullscreen-window; - "Super+C".action = center-column; - - "Mod+Q".action = close-window; - - "Mod+Shift+P".action = power-off-monitors; - }; prefer-no-csd = true; hotkey-overlay.skip-at-startup = true; diff --git a/home/rice/waybar/default.nix b/home/rice/waybar/default.nix index 2f78780b..9d76cc77 100644 --- a/home/rice/waybar/default.nix +++ b/home/rice/waybar/default.nix @@ -75,7 +75,7 @@ in { format-icons = ["󰂃" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; }; network = { - format-wifi = "󰤨 {essid} {signalStrength}"; + format-wifi = "󰤨 {essid} {signalStrength}%"; format-ethernet = "󰈀"; format-alt = "󰤨"; format-disconnected = "󰤭";