From 52ee4685575fac5159b42ee6eb0612bd8a7bf68b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 15 Jan 2025 20:25:04 +0100 Subject: ... --- accounts/gkleen@sif/niri/default.nix | 56 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'accounts') 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 { "Mod+Return".action = spawn terminal; "Mod+Q".action = close-window; - "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package); - "Mod+Shift+D".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path"; + "Mod+O".action = spawn (lib.getExe config.programs.fuzzel.package); + "Mod+Shift+O".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path"; "Mod+Alt+E".action = spawn (lib.getExe' config.services.emacs.package "emacsclient") "-c"; + "Mod+Alt+Y".action = spawn (lib.getExe (pkgs.writeShellApplication { + name = "queue-yt-dlp"; + runtimeInputs = with pkgs; [ wl-clipboard-rs socat ]; + text = '' + socat STDIO UNIX-CONNECT:"$XDG_RUNTIME_DIR"/yt-dlp.sock <<<$'{ "urls": ["'"$(wl-paste)"$'"] }' + ''; + })); + + "Mod+U".action = spawn (lib.getExe (pkgs.writeShellApplication { + name = "qalc-fuzzel"; + runtimeInputs = with pkgs; [ wl-clipboard-rs libqalculate config.programs.fuzzel.package coreutils findutils libnotify gnugrep ]; + text = '' + RESULTS_DIR="$HOME/.cache/qalc-fuzzel" + prev() { + FOUND=false + while IFS= read -r line; do + [[ -n "$line" ]] || continue + FOUND=true + echo "$line" + 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) + $FOUND || echo + } + FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> ") || exit $? + if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then + QALC_RES="$FUZZEL_RES" + QALC_RET=0 + else + QALC_RES=$(qalc "$FUZZEL_RES" 2>&1) + QALC_RET=$? + fi + [[ -n "$QALC_RES" ]] || exit 1 + EXISTING=false + grep -Fxrl "$QALC_RES" "$RESULTS_DIR" | xargs -r touch + [[ ''${PIPESTATUS[0]} -eq 0 ]] && EXISTING=true + if [[ $QALC_RET -eq 0 ]] && ! $EXISTING; then + RES_FILE="$RESULTS_DIR"/$(date -uIs).$(tr -Cd 'a-zA-Z0-9' "$RES_FILE" <<<"$QALC_RES" + fi + [[ "$QALC_RES" =~ .*\ =\ (.*) ]] && QALC_RES="''${BASH_REMATCH[1]}" + [[ $QALC_RET -eq 0 ]] && wl-copy "$QALC_RES" + notify-send "$QALC_RES" + ''; + })); + "Mod+E".action = spawn (lib.getExe (pkgs.writeShellApplication { + name = "emoji-fuzzel"; + runtimeInputs = with pkgs; [ config.programs.fuzzel.package wtype wl-clipboard-rs ]; + text = '' + FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " <"$HOME"/.local/share/emoji-data/list.txt) || exit $? + [[ -n "$FUZZEL_RES" ]] || exit 1 + wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste + ''; + })); "Mod+H".action = focus-column-left; "Mod+T".action = focus-window-down; -- cgit v1.2.3