Commit: 718f1e096093ba2c70474287780473fe3306d612
Parent: ecbd2d114b5f1bd0d62d67407b300baf68098f11
Author: Randy Palamar
Date: Fri, 5 Mar 2021 01:15:15 -0700
use dmenu to copy passwords to the clipboard
gpg-agent gets started to facilitate this
Diffstat:
3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/.config/ksh/kshrc b/.config/ksh/kshrc
@@ -65,10 +65,6 @@ alias yt-mus='mpv --shuffle "$YT_MUS"'
alias yt-ab='yt --config-location ~/.config/youtube-dl/audiobooks'
alias pwgen='pwgen -Cnsy'
-pwclip() {
- spm show "${1}" | sed 1q | tr -d \\n |
- xclip -i -selection clipboard -loops 1 -quiet |2> /dev/null
-}
rmimg() {
for file; do
@@ -111,14 +107,6 @@ fi
###############
# Completions #
###############
-#if [ -d ~/.spm ]; then
-# SPM_LIST=$(
-# cd ~/.spm
-# find . -type f -name \*.gpg | sed 's:^\./::; s:\.gpg$::g'
-# )
-# set -A complete_spm -- $SPM_LIST
-#fi
-
set -A complete_ifconfig_1 -- $(ifconfig | sed -n '/^[a-z]/s,:.*,,p')
if [ $UNAME == "OpenBSD" ]; then
diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc
@@ -1,12 +1,14 @@
bgs -z ~/.config/h_wallpaper.jpg
+gpg_flags="--daemon --default-cache-ttl 7200 --max-cache-ttl 36000 --no-allow-external-cache"
[ -z $SSH_AGENT_PID ] && eval $(ssh-agent)
+[ $(pgrep gpg-agent) ] || gpg-agent $gpg_flags
[ $(pgrep mpd) ] || mpd
[ $(pgrep cron) ] || cron -f ~/.config/crontab
[ $(pgrep xbanish) ] || xbanish &
-[ $(prgrep status) ] || status &
+[ $(pgrep status) ] || status &
[ -d /tmp/downloads ] || mkdir /tmp/downloads
diff --git a/bin/passmenu b/bin/passmenu
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# uses dmenu to select a password to copy to the clipboard
+# it is removed from the clipboard once pasted
+# make sure gpg-agent is running and unlocked
+
+PASS_DIR=~/.spm
+
+password=$(cd $PASS_DIR; find . -type f -name \*.gpg | \
+ sed 's:^\./::; s:\.gpg$::' | dmenu -i -p "Password:") || exit 0
+
+spm show "$password" | head -1 | tr -d \\n | \
+ xclip -i -selection clipboard -loops 1 -quiet |2> /dev/null