diff options
| -rw-r--r-- | accounts/gkleen@sif/niri/default.nix | 60 | ||||
| -rw-r--r-- | accounts/gkleen@sif/niri/waybar.nix | 8 | ||||
| -rw-r--r-- | flake.lock | 8 | ||||
| -rw-r--r-- | flake.nix | 2 |
4 files changed, 63 insertions, 15 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index afedd6e3..36811d21 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix | |||
| @@ -96,6 +96,28 @@ let | |||
| 96 | ''; | 96 | ''; |
| 97 | }; | 97 | }; |
| 98 | with-unnamed-workspace-action = config.lib.niri.actions.spawn (lib.getExe with_unnamed_workspace); | 98 | with-unnamed-workspace-action = config.lib.niri.actions.spawn (lib.getExe with_unnamed_workspace); |
| 99 | |||
| 100 | with_select_window = pkgs.writeShellApplication { | ||
| 101 | name = "with-unnamed-workspace"; | ||
| 102 | runtimeInputs = [ niri pkgs.gojq pkgs.socat config.programs.fuzzel.package pkgs.gawk ]; | ||
| 103 | text = '' | ||
| 104 | window_select="$1" | ||
| 105 | shift | ||
| 106 | action="$1" | ||
| 107 | shift | ||
| 108 | |||
| 109 | windows_json="$(niri msg -j windows)" | ||
| 110 | active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")" | ||
| 111 | window="$(gojq -r --arg active_workspace "$active_workspace" '.[] | select('"$window_select"') | "\(.title)\t\(.id)"' <<<"$windows_json" | fuzzel --log-level=warning --dmenu)" | ||
| 112 | window_id="$(awk -F $'\t' '{print $2}' <<<"$window")" | ||
| 113 | window_json="$(jq -r --arg window_id "$window_id" '.[] | select(.id == ($window_id | tonumber))' <<<"$windows_json")" | ||
| 114 | |||
| 115 | [[ -z "$window_json" ]] && exit 1 | ||
| 116 | |||
| 117 | jq -c "$action" <<<"$window_json" | socat STDIO "$NIRI_SOCKET" | ||
| 118 | ''; | ||
| 119 | }; | ||
| 120 | with-select-window-action = config.lib.niri.actions.spawn (lib.getExe with_select_window); | ||
| 99 | in { | 121 | in { |
| 100 | imports = [ | 122 | imports = [ |
| 101 | ./waybar.nix | 123 | ./waybar.nix |
| @@ -152,7 +174,7 @@ in { | |||
| 152 | }; | 174 | }; |
| 153 | 175 | ||
| 154 | outputs = { | 176 | outputs = { |
| 155 | "Samsung Display Corp. 0x4141 Unknown" = { | 177 | "eDP-1" = { |
| 156 | scale = 1.5; | 178 | scale = 1.5; |
| 157 | position = { x = 0; y = 0; }; | 179 | position = { x = 0; y = 0; }; |
| 158 | }; | 180 | }; |
| @@ -209,11 +231,11 @@ in { | |||
| 209 | cursor.hide-when-typing = true; | 231 | cursor.hide-when-typing = true; |
| 210 | 232 | ||
| 211 | workspaces = { | 233 | workspaces = { |
| 212 | "001".name = "pwctl"; | 234 | "001" = { name = "pwctl"; open-on-output = "eDP-1"; }; |
| 213 | "002".name = "kpxc"; | 235 | "002" = { name = "kpxc"; open-on-output = "eDP-1"; }; |
| 214 | "003".name = "bmgr"; | 236 | "003" = { name = "bmgr"; open-on-output = "eDP-1"; }; |
| 215 | "004".name = "term"; | 237 | "004" = { name = "term"; open-on-output = "eDP-1"; }; |
| 216 | "005".name = "edit"; | 238 | "005" = { name = "edit"; open-on-output = "eDP-1"; }; |
| 217 | "101".name = "comm"; | 239 | "101".name = "comm"; |
| 218 | "102".name = "web"; | 240 | "102".name = "web"; |
| 219 | "104".name = "read"; | 241 | "104".name = "read"; |
| @@ -329,8 +351,10 @@ in { | |||
| 329 | fi | 351 | fi |
| 330 | [[ -n "$QALC_RES" ]] || exit 1 | 352 | [[ -n "$QALC_RES" ]] || exit 1 |
| 331 | EXISTING=false | 353 | EXISTING=false |
| 354 | set +e | ||
| 332 | grep -Fxrl "$QALC_RES" "$RESULTS_DIR" | xargs -r touch | 355 | grep -Fxrl "$QALC_RES" "$RESULTS_DIR" | xargs -r touch |
| 333 | [[ ''${PIPESTATUS[0]} -eq 0 ]] && EXISTING=true | 356 | [[ ''${PIPESTATUS[0]} -eq 0 ]] && EXISTING=true |
| 357 | set -e | ||
| 334 | if [[ $QALC_RET -eq 0 ]] && ! $EXISTING; then | 358 | if [[ $QALC_RET -eq 0 ]] && ! $EXISTING; then |
| 335 | RES_FILE="$RESULTS_DIR"/$(date -uIs).$(tr -Cd 'a-zA-Z0-9' </dev/random | head -c 10) | 359 | RES_FILE="$RESULTS_DIR"/$(date -uIs).$(tr -Cd 'a-zA-Z0-9' </dev/random | head -c 10) |
| 336 | cat >"$RES_FILE" <<<"$QALC_RES" | 360 | cat >"$RES_FILE" <<<"$QALC_RES" |
| @@ -349,6 +373,26 @@ in { | |||
| 349 | wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste | 373 | wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste |
| 350 | ''; | 374 | ''; |
| 351 | })); | 375 | })); |
| 376 | "Print".action = spawn (lib.getExe (pkgs.writeShellApplication { | ||
| 377 | name = "screenshot"; | ||
| 378 | runtimeInputs = with pkgs; [ grim slurp wl-clipboard-rs coreutils ]; | ||
| 379 | text = '' | ||
| 380 | grim -g "$(slurp -b 00000080 -c FFFFFFFF -s 00000000 -w 1)" - \ | ||
| 381 | | tee "$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png" \ | ||
| 382 | | wl-copy --type image/png | ||
| 383 | ''; | ||
| 384 | })); | ||
| 385 | "Shift+Print".action = spawn (lib.getExe (pkgs.writeShellApplication { | ||
| 386 | name = "screenshot"; | ||
| 387 | runtimeInputs = with pkgs; [ grim niri gojq wl-clipboard-rs coreutils ]; | ||
| 388 | text = '' | ||
| 389 | grim -o "$(niri msg -j workspaces | jq -r '.[] | select(.is_focused) | .output')" - \ | ||
| 390 | | tee "$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png" \ | ||
| 391 | | wl-copy --type image/png | ||
| 392 | ''; | ||
| 393 | })); | ||
| 394 | "Mod+B".action = with-select-window-action ".workspace_id == ($active_workspace | tonumber)" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; | ||
| 395 | "Mod+Shift+B".action = with-select-window-action "true" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; | ||
| 352 | 396 | ||
| 353 | "Mod+H".action = focus-column-left; | 397 | "Mod+H".action = focus-column-left; |
| 354 | "Mod+T".action = focus-window-down; | 398 | "Mod+T".action = focus-window-down; |
| @@ -406,8 +450,8 @@ in { | |||
| 406 | "Mod+Shift+F".action = maximize-column; | 450 | "Mod+Shift+F".action = maximize-column; |
| 407 | "Mod+Shift+Ctrl+F".action = fullscreen-window; | 451 | "Mod+Shift+Ctrl+F".action = fullscreen-window; |
| 408 | 452 | ||
| 409 | "Mod+B".action = switch-focus-between-floating-and-tiling; | 453 | "Mod+V".action = switch-focus-between-floating-and-tiling; |
| 410 | "Mod+Shift+B".action = toggle-window-floating; | 454 | "Mod+Shift+V".action = toggle-window-floating; |
| 411 | 455 | ||
| 412 | "Mod+Left".action = set-column-width "-10%"; | 456 | "Mod+Left".action = set-column-width "-10%"; |
| 413 | "Mod+Down".action = set-window-height "-10%"; | 457 | "Mod+Down".action = set-window-height "-10%"; |
diff --git a/accounts/gkleen@sif/niri/waybar.nix b/accounts/gkleen@sif/niri/waybar.nix index 2d00c6d8..1c328ea6 100644 --- a/accounts/gkleen@sif/niri/waybar.nix +++ b/accounts/gkleen@sif/niri/waybar.nix | |||
| @@ -80,7 +80,9 @@ | |||
| 80 | exec = "${lib.getExe pkgs.worktime} today"; | 80 | exec = "${lib.getExe pkgs.worktime} today"; |
| 81 | tooltip = false; | 81 | tooltip = false; |
| 82 | }; | 82 | }; |
| 83 | "niri/workspaces" = {}; | 83 | "niri/workspaces" = { |
| 84 | ignore = ["pwctl" "kpxc" "bmgr" "edit" "term"]; | ||
| 85 | }; | ||
| 84 | "niri/window" = { | 86 | "niri/window" = { |
| 85 | separate-outputs = true; | 87 | separate-outputs = true; |
| 86 | icon = true; | 88 | icon = true; |
| @@ -164,7 +166,9 @@ | |||
| 164 | modules-center = [ "niri/window" ]; | 166 | modules-center = [ "niri/window" ]; |
| 165 | modules-right = [ "clock" ]; | 167 | modules-right = [ "clock" ]; |
| 166 | 168 | ||
| 167 | "niri/workspaces" = {}; | 169 | "niri/workspaces" = { |
| 170 | ignore = ["pwctl" "kpxc" "bmgr" "edit" "term"]; | ||
| 171 | }; | ||
| 168 | "niri/window" = { | 172 | "niri/window" = { |
| 169 | separate-outputs = true; | 173 | separate-outputs = true; |
| 170 | icon = true; | 174 | icon = true; |
| @@ -966,16 +966,16 @@ | |||
| 966 | ] | 966 | ] |
| 967 | }, | 967 | }, |
| 968 | "locked": { | 968 | "locked": { |
| 969 | "lastModified": 1734278650, | 969 | "lastModified": 1737014022, |
| 970 | "narHash": "sha256-z9FiyHDbKC2nwfd/qsHCxLBEogzQj73zo85lW3zIlzY=", | 970 | "narHash": "sha256-5cG3lbjvrqvotI3oEPham3jGq8Fd96NfrqCGvC1e6Qw=", |
| 971 | "owner": "gkleen", | 971 | "owner": "gkleen", |
| 972 | "repo": "Waybar", | 972 | "repo": "Waybar", |
| 973 | "rev": "5432f9c1697a8d2d3e1264a5ce820d7eac26e2c6", | 973 | "rev": "83765e0f8e99a7d344eae511a4090a76a27e5791", |
| 974 | "type": "github" | 974 | "type": "github" |
| 975 | }, | 975 | }, |
| 976 | "original": { | 976 | "original": { |
| 977 | "owner": "gkleen", | 977 | "owner": "gkleen", |
| 978 | "ref": "feat/privacy-ignore", | 978 | "ref": "feat/niri-workspaces-hide", |
| 979 | "repo": "Waybar", | 979 | "repo": "Waybar", |
| 980 | "type": "github" | 980 | "type": "github" |
| 981 | } | 981 | } |
| @@ -172,7 +172,7 @@ | |||
| 172 | type = "github"; | 172 | type = "github"; |
| 173 | owner = "gkleen"; | 173 | owner = "gkleen"; |
| 174 | repo = "Waybar"; | 174 | repo = "Waybar"; |
| 175 | ref = "feat/privacy-ignore"; | 175 | ref = "feat/niri-workspaces-hide"; |
| 176 | inputs = { | 176 | inputs = { |
| 177 | nixpkgs.follows = "nixpkgs"; | 177 | nixpkgs.follows = "nixpkgs"; |
| 178 | flake-compat.follows = "flake-compat"; | 178 | flake-compat.follows = "flake-compat"; |
