aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-06-13 13:49:15 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-06-13 13:49:15 +0200
commita059e16f31f1053ff05de579e3220bab65d17860 (patch)
tree4c0802e082b8f2db0716f74063db1b7bcd1d0c23 /.local
parent93c51d657299919af2b9cd624f4572869453162a (diff)
Update ipass script for wayland
However, it would appear that KDE doesn't support wtype. Neither does Gnome. Additionally, wl-copy doesn't seem to work on KDE if its called through a script launched through a shortcut. So effectively, the ipass script is known broken for wayland use, and there is no potential workaround.
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/ipass48
1 files changed, 40 insertions, 8 deletions
diff --git a/.local/bin/ipass b/.local/bin/ipass
index b19137a..4b0b2ee 100755
--- a/.local/bin/ipass
+++ b/.local/bin/ipass
@@ -1,19 +1,51 @@
#! /usr/bin/env sh
-main()
-{
+main() {
cd -- "$HOME/.password-store" || exit 1
- file="$(find ./* -type f | sed 's-^\./--' | sed 's-\.gpg$--' | dmenu)"
- dmenu_exit=$?
+ if [ -n "$WAYLAND_DISPLAY" ]
+ then
+ file="$(pass_list | fuzzel -d)"
+ wtype "$(pass_get "$file")"
+
+ notify "Copied $file to clipboard!"
+ exit 0
+ fi
- if [ "$dmenu_exit" -ne 0 ]
+ if [ -n "$DISPLAY" ]
then
- exit 2
+ file="$(pass_list | dmenu)"
+ pass_get "$file" | xdotool type --file -
+ dmenu_exit=$?
+
+ if [ "$dmenu_exit" -ne 0 ]
+ then
+ notify "Error typing $file"
+ exit 2
+ fi
+
+ notify "Typing $file"
+
+ exit 0
fi
- pass show "$file" | head -n 1 | perl -pe 'chomp' | xdotool type --file -
- notify-send -i "dialog-password" "ipass" "$file"
+ notify "No graphical environment detected"
+}
+
+pass_list() {
+ find ./* -type f \
+ | sed 's-^\./--' \
+ | sed 's-\.gpg$--'
+}
+
+pass_get() {
+ pass show "$1" \
+ | head -n 1 \
+ | perl -pe 'chomp'
+}
+
+notify() {
+ notify-send -i "dialog-password" "ipass" "$*"
}
main "$@"