aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2022-05-21 02:02:13 +1200
committerTom Ryder <tom@sanctum.geek.nz>2022-05-21 02:12:53 +1200
commitec401dcd28815aed5da3d5fbf53f247ed003b03e (patch)
tree62d4260ee332e8fc97db5e412695ddc583c59f14
parentDon't copy PRIMARY to CLIPBOARD from urxvt anymore (diff)
downloaddotfiles-ec401dcd28815aed5da3d5fbf53f247ed003b03e.tar.gz
dotfiles-ec401dcd28815aed5da3d5fbf53f247ed003b03e.zip
Rewrite dmp(1df) as dmenu_pass(1df)
-rw-r--r--.gitignore2
-rw-r--r--Makefile2
-rw-r--r--README.md3
-rw-r--r--bin/dmenu_pass.sh14
-rw-r--r--bin/dmp.sh31
-rw-r--r--man/man1/dmenu_pass.1df17
-rw-r--r--man/man1/dmp.1df17
-rw-r--r--man/man7/dotfiles.7df4
-rw-r--r--sxhkd/sxhkdrc2
9 files changed, 38 insertions, 54 deletions
diff --git a/.gitignore b/.gitignore
index b4596e61..d5431855 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,7 +25,7 @@
/bin/dfv
/bin/dfv.m4
/bin/dfv.sh
-/bin/dmp
+/bin/dmenu_pass
/bin/dub
/bin/edda
/bin/edda.m4
diff --git a/Makefile b/Makefile
index 79a1edc3..52246ad6 100644
--- a/Makefile
+++ b/Makefile
@@ -117,7 +117,7 @@ BINS = bin/ap \
bin/ddup \
bin/defang \
bin/dfv \
- bin/dmp \
+ bin/dmenu_pass \
bin/dub \
bin/edda \
bin/eds \
diff --git a/README.md b/README.md
index a9bb6825..77babf0d 100644
--- a/README.md
+++ b/README.md
@@ -526,7 +526,8 @@ These scripts are installed by the `install-bin` target:
- `dam(1df)` buffers all its input before emitting it as output.
- `ddup(1df)` removes duplicate lines from unsorted input.
- `defang(1df)` prevents dangerous URLs from being made into clickable links.
-- `dmp(1df)` copies a pass(1) entry selected by `dmenu(1)` to the X CLIPBOARD.
+- `dmenu_pass(1df)` copies a pass(1) entry selected by `dmenu(1)` to the
+ X CLIPBOARD.
- `dub(1df)` lists the biggest entries in a directory.
- `edda(1df)` provides a means to run `ed(1)` over a set of files preserving
any options, mostly useful for scripts.
diff --git a/bin/dmenu_pass.sh b/bin/dmenu_pass.sh
new file mode 100644
index 00000000..bfb687b1
--- /dev/null
+++ b/bin/dmenu_pass.sh
@@ -0,0 +1,14 @@
+# Pick a pass(1) password with dmenu(1)
+self=dmenu_pass
+cd -- "${PASSWORD_STORE_DIR:-"$HOME"/.password-store}" || exit
+# shellcheck disable=SC2016
+name=$(
+ find . -name \*.gpg ! -type d |
+ sed -e 's_^\./__' -e 's_\.gpg$__' |
+ LC_ALL=C sort -f |
+ dmenu
+)
+pass show --clip -- "$name" || exit
+notify-send --app-name="$self" -- \
+ "Password saved to CLIPBOARD" \
+ "$name"
diff --git a/bin/dmp.sh b/bin/dmp.sh
deleted file mode 100644
index ab09c20e..00000000
--- a/bin/dmp.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-# Pick a pass(1) password with dmenu(1)
-
-# Get the password store directory, bail if we can't
-pwsd=${PASSWORD_STORE_DIR:-"$HOME"/.password-store}
-pwsd=${pwsd%/}
-[ -n "$pwsd" ] || exit
-
-# Get the password; get all the names from find(1)
-# shellcheck disable=SC2016
-pw=$(
- cd -- "$pwsd" || exit
- # Get all the names from find(1)
- find ./ -name \*.gpg |
- # Sort them
- sort |
- # Strip the leading directory and the trailing .gpg
- sed 's_^\./__;s_\.gpg$__' |
- # Use dmenu(1) to prompt the user to select one
- dmenu
-) || exit
-
-# Bail if we don't have a password
-[ -n "$pw" ] || exit
-
-# Pump the first line of the password into the clipboard
-pass show "$pw" | sed 1q | xsel -ib || exit
-
-# If we have notify-send(1), alert that the password has been copied
-if command -v notify-send >/dev/null >&2 ; then
- notify-send "$(printf '%s in clipboard' "$pw")"
-fi
diff --git a/man/man1/dmenu_pass.1df b/man/man1/dmenu_pass.1df
new file mode 100644
index 00000000..51c32adb
--- /dev/null
+++ b/man/man1/dmenu_pass.1df
@@ -0,0 +1,17 @@
+.TH DMENU_PASS 1df "May 2022" "Manual page for dmenu_pass"
+.SH NAME
+.B dmenu_pass
+\- pick a pass(1) password with dmenu(1)
+.SH SYNOPSIS
+.B dmenu_pass
+.SH DESCRIPTION
+.B dmenu_pass
+applies dmenu(1) to pick a password entry from a pass(1) store and put it into
+the X CLIPBOARD using the "show" command.
+.P
+A notification with the default priority is sent when the password is
+successfully clipped.
+.SH SEE ALSO
+dmenu(1), notify-send(1), pass(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/dmp.1df b/man/man1/dmp.1df
deleted file mode 100644
index d663e3d0..00000000
--- a/man/man1/dmp.1df
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH DMP 1df "August 2016" "Manual page for dmp"
-.SH NAME
-.B dmp
-\- pick a pass(1) password with dmenu(1)
-.SH SYNOPSIS
-.B dmp
-.SH DESCRIPTION
-.B dmp
-applies dmenu(1) to pick a password entry from a pass(1) store and put it into
-the X CLIPBOARD for a period of time.
-.P
-If notify-send(1) is installed, a notification with the default priority will
-be written when the password is successfully clipped.
-.SH SEE ALSO
-dmenu(1), notify-send(1), pass(1), xsel(1)
-.SH AUTHOR
-Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df
index f3c46b1f..f40500d0 100644
--- a/man/man7/dotfiles.7df
+++ b/man/man7/dotfiles.7df
@@ -804,8 +804,8 @@ read from the input.
\f[C]defang(1df)\f[R] prevents dangerous URLs from being made into
clickable links.
.IP \[bu] 2
-\f[C]dmp(1df)\f[R] copies a pass(1) entry selected by \f[C]dmenu(1)\f[R]
-to the X CLIPBOARD.
+\f[C]dmenu_pass(1df)\f[R] copies a pass(1) entry selected by
+\f[C]dmenu(1)\f[R] to the X CLIPBOARD.
.IP \[bu] 2
\f[C]dub(1df)\f[R] lists the biggest entries in a directory.
.IP \[bu] 2
diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc
index d71e510d..f8a44ebf 100644
--- a/sxhkd/sxhkdrc
+++ b/sxhkd/sxhkdrc
@@ -26,7 +26,7 @@ super + m
x-terminal-emulator -e tm
super + p
- dmp
+ dmenu_pass
super + t
thunar