summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-01-16 10:02:16 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2025-01-16 10:02:16 +0100
commit5e770b536c71c1a136c7db391200b5563d8516ec (patch)
treea943bed9715f96f46da0eb3acf4d3926ea1a5832 /accounts/gkleen@sif
parentbf5ffe04635753a796fd9f3d39392a15e5542ff2 (diff)
downloadnixos-5e770b536c71c1a136c7db391200b5563d8516ec.tar
nixos-5e770b536c71c1a136c7db391200b5563d8516ec.tar.gz
nixos-5e770b536c71c1a136c7db391200b5563d8516ec.tar.bz2
nixos-5e770b536c71c1a136c7db391200b5563d8516ec.tar.xz
nixos-5e770b536c71c1a136c7db391200b5563d8516ec.zip
...
Diffstat (limited to 'accounts/gkleen@sif')
-rw-r--r--accounts/gkleen@sif/niri/default.nix60
-rw-r--r--accounts/gkleen@sif/niri/waybar.nix8
2 files changed, 58 insertions, 10 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);
99in { 121in {
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;