diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-01-15 20:25:04 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-01-15 20:25:04 +0100 |
commit | 52ee4685575fac5159b42ee6eb0612bd8a7bf68b (patch) | |
tree | 02186898b9c9196fd7ff5e4d43c38f283a4db89d /accounts/gkleen@sif/niri | |
parent | 34c72bbc7ac419a81e1ae4b14a18979bfafbb671 (diff) | |
download | nixos-52ee4685575fac5159b42ee6eb0612bd8a7bf68b.tar nixos-52ee4685575fac5159b42ee6eb0612bd8a7bf68b.tar.gz nixos-52ee4685575fac5159b42ee6eb0612bd8a7bf68b.tar.bz2 nixos-52ee4685575fac5159b42ee6eb0612bd8a7bf68b.tar.xz nixos-52ee4685575fac5159b42ee6eb0612bd8a7bf68b.zip |
...
Diffstat (limited to 'accounts/gkleen@sif/niri')
-rw-r--r-- | accounts/gkleen@sif/niri/default.nix | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index fa39fdd4..fc3a0a2b 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix | |||
@@ -281,10 +281,62 @@ in { | |||
281 | 281 | ||
282 | "Mod+Return".action = spawn terminal; | 282 | "Mod+Return".action = spawn terminal; |
283 | "Mod+Q".action = close-window; | 283 | "Mod+Q".action = close-window; |
284 | "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package); | 284 | "Mod+O".action = spawn (lib.getExe config.programs.fuzzel.package); |
285 | "Mod+Shift+D".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path"; | 285 | "Mod+Shift+O".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path"; |
286 | 286 | ||
287 | "Mod+Alt+E".action = spawn (lib.getExe' config.services.emacs.package "emacsclient") "-c"; | 287 | "Mod+Alt+E".action = spawn (lib.getExe' config.services.emacs.package "emacsclient") "-c"; |
288 | "Mod+Alt+Y".action = spawn (lib.getExe (pkgs.writeShellApplication { | ||
289 | name = "queue-yt-dlp"; | ||
290 | runtimeInputs = with pkgs; [ wl-clipboard-rs socat ]; | ||
291 | text = '' | ||
292 | socat STDIO UNIX-CONNECT:"$XDG_RUNTIME_DIR"/yt-dlp.sock <<<$'{ "urls": ["'"$(wl-paste)"$'"] }' | ||
293 | ''; | ||
294 | })); | ||
295 | |||
296 | "Mod+U".action = spawn (lib.getExe (pkgs.writeShellApplication { | ||
297 | name = "qalc-fuzzel"; | ||
298 | runtimeInputs = with pkgs; [ wl-clipboard-rs libqalculate config.programs.fuzzel.package coreutils findutils libnotify gnugrep ]; | ||
299 | text = '' | ||
300 | RESULTS_DIR="$HOME/.cache/qalc-fuzzel" | ||
301 | prev() { | ||
302 | FOUND=false | ||
303 | while IFS= read -r line; do | ||
304 | [[ -n "$line" ]] || continue | ||
305 | FOUND=true | ||
306 | echo "$line" | ||
307 | done < <(export LC_ALL=C.UTF-8; echo; find "$RESULTS_DIR" -type f -printf $'%T@ %p\n' | sort -n | cut -d' ' -f2- | xargs -r cat) | ||
308 | $FOUND || echo | ||
309 | } | ||
310 | FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> ") || exit $? | ||
311 | if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then | ||
312 | QALC_RES="$FUZZEL_RES" | ||
313 | QALC_RET=0 | ||
314 | else | ||
315 | QALC_RES=$(qalc "$FUZZEL_RES" 2>&1) | ||
316 | QALC_RET=$? | ||
317 | fi | ||
318 | [[ -n "$QALC_RES" ]] || exit 1 | ||
319 | EXISTING=false | ||
320 | grep -Fxrl "$QALC_RES" "$RESULTS_DIR" | xargs -r touch | ||
321 | [[ ''${PIPESTATUS[0]} -eq 0 ]] && EXISTING=true | ||
322 | if [[ $QALC_RET -eq 0 ]] && ! $EXISTING; then | ||
323 | RES_FILE="$RESULTS_DIR"/$(date -uIs).$(tr -Cd 'a-zA-Z0-9' </dev/random | head -c 10) | ||
324 | cat >"$RES_FILE" <<<"$QALC_RES" | ||
325 | fi | ||
326 | [[ "$QALC_RES" =~ .*\ =\ (.*) ]] && QALC_RES="''${BASH_REMATCH[1]}" | ||
327 | [[ $QALC_RET -eq 0 ]] && wl-copy "$QALC_RES" | ||
328 | notify-send "$QALC_RES" | ||
329 | ''; | ||
330 | })); | ||
331 | "Mod+E".action = spawn (lib.getExe (pkgs.writeShellApplication { | ||
332 | name = "emoji-fuzzel"; | ||
333 | runtimeInputs = with pkgs; [ config.programs.fuzzel.package wtype wl-clipboard-rs ]; | ||
334 | text = '' | ||
335 | FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " <"$HOME"/.local/share/emoji-data/list.txt) || exit $? | ||
336 | [[ -n "$FUZZEL_RES" ]] || exit 1 | ||
337 | wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste | ||
338 | ''; | ||
339 | })); | ||
288 | 340 | ||
289 | "Mod+H".action = focus-column-left; | 341 | "Mod+H".action = focus-column-left; |
290 | "Mod+T".action = focus-window-down; | 342 | "Mod+T".action = focus-window-down; |