summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmpass
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dmpass')
-rwxr-xr-x.local/bin/dmpass39
1 files changed, 30 insertions, 9 deletions
diff --git a/.local/bin/dmpass b/.local/bin/dmpass
index d5b0494..c315be1 100755
--- a/.local/bin/dmpass
+++ b/.local/bin/dmpass
@@ -1,5 +1,6 @@
#!/bin/sh
+name=0
full=0
color='#cc241d';
if [ "$1" = "--full" ]; then
@@ -7,16 +8,21 @@ if [ "$1" = "--full" ]; then
if echo "$2" | grep '^#' 2>&1; then
color="$2"
fi
+elif [ "$1" = "--name" ]; then
+ name=1
+ if echo "$2" | grep '^#' 2>&1; then
+ color="$2"
+ fi
elif echo "$1" | grep '^#' 2>&1; then
color="$1"
fi
if [ -n "$WAYLAND_DISPLAY" ]; then
- dmenu=dmenu-wl
- xdotool="ydotool type --file -"
+ dmenu="wmenu -i -l 15 -S $color"
+ xdotool="ydotool type --delay 15 --file -"
elif [ -n "$DISPLAY" ]; then
- dmenu=dmenu
+ dmenu="dmenu -i -l 15 -sb $color -shb $color"
xdotool="xdotool type --delay 15 --clearmodifiers --file -"
else
echo "Error: No Wayland or X11 display detected" >&2
@@ -26,19 +32,34 @@ fi
prefix=${PASSWORD_STORE_DIR-~/.local/share/pass}
rprefix=$(printf "%s" $prefix | sed 's/\//\\\//g')
password_files=$(ls "$prefix"/*.gpg "$prefix"/*/*.gpg | sed 's/^'${rprefix}'\///g' | sed 's/\.gpg//g')
-password=$(printf "%s\n" "${password_files}" | "$dmenu" -i -l 15 -sb "$color" -shb "$color")
+password=$(printf "%s\n" "${password_files}" | $dmenu)
[ -n "$password" ] || exit
p="$(pass show "$password")"
-if [ $full -eq 1 ]; then
+if [ $full -eq 1 ] || [ $name -eq 1 ]; then
id=$(printf "%s" "$password" | sed 's/.*___//')
printf "%s\n" $id | { IFS= read -r pass; printf %s "$id"; } | $xdotool
- xdotool key Tab
- printf "%s\n" "$p" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
- xdotool key Return
- exit
+ if [ $name -eq 1 ]; then
+ exit
+ fi
+fi
+
+if [ $full -eq 1 ]; then
+ if [ -n "$WAYLAND_DISPLAY" ]; then
+ ydotool key 15:1 15:0
+ else
+ xdotool key Tab
+ fi
fi
printf "%s\n" "$p" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
+
+if [ $full -eq 1 ]; then
+ if [ -n "$WAYLAND_DISPLAY" ]; then
+ ydotool key 28:1 28:0
+ else
+ xdotool key Return
+ fi
+fi