From c6d381fc583bb4de3b17f6d70a5613f40c7f0acc Mon Sep 17 00:00:00 2001 From: pagedmov Date: Thu, 31 Oct 2024 18:20:09 -0400 Subject: [PATCH] keyring no longer copies plaintext passwords to cliphist database, can now escape from cliphist window back to the toolbelt menu --- modules/home/scripts/commands/toolbelt.nix | 1 + modules/home/scripts/wm-controls/keyring.nix | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/home/scripts/commands/toolbelt.nix b/modules/home/scripts/commands/toolbelt.nix index c2a8e8c..83442b3 100644 --- a/modules/home/scripts/commands/toolbelt.nix +++ b/modules/home/scripts/commands/toolbelt.nix @@ -12,6 +12,7 @@ cliphistory() { else \ cliphist decode \"\$index\" | fmt -w 30; \ fi" --prompt="> " | awk '{print $1}') + [ -z "$selection" ] && return 1 cliphist decode "$selection" | wl-copy } btop_cmd() { diff --git a/modules/home/scripts/wm-controls/keyring.nix b/modules/home/scripts/wm-controls/keyring.nix index caac6d3..2fc42fa 100644 --- a/modules/home/scripts/wm-controls/keyring.nix +++ b/modules/home/scripts/wm-controls/keyring.nix @@ -15,8 +15,20 @@ pkgs.writeShellScriptBin "keyring" '' [ $? = 0 ] || { [ -f /tmp/keyringfile ] && /run/current-system/sw/bin/rm /tmp/keyringfile; exit 1; } - # pass it through fmt for soft word wrapping - pass -c "$pass_string" | fmt -w 45 + # prevents cliphist from writing passwords to the clipboard history + pkill -STOP wl-paste + + # copy password + pass -c "$pass_string" > /dev/null + echo "Password copied. Clearing clipboard in 10 seconds." + + # start a timer for 10 seconds, clear clipboard, resume cliphist tracking + nohup bash <<- EOF & + sleep 10 + wl-copy -c + pkill -CONT wl-paste + EOF + /run/current-system/sw/bin/rm /tmp/keyringfile sleep 0.5 exit 0