static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", font0, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
static const char *quitcmd[] = { "killall", "xinit", NULL };
-static const char *passmenu[] = { "/usr/share/doc/pass/examples/dmenu/passmenu", "-m", dmenumon, "-fn", font0, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
-static const char *passmenu_type[] = { "/usr/share/doc/pass/examples/dmenu/passmenu", "--type", "-m", dmenumon, "-fn", font0, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+static const char *passmenu[] = { "passmenu", "-m", dmenumon, "-fn", font0, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+static const char *passmenu_tmux[] = { "passmenu", "--tmux", "-m", dmenumon, "-fn", font0, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *scr[] = { "scr", NULL };
static const char *scr_sel[] = { "scr", "selection", NULL };
static const char *lock[] = { "xautolock", "-locknow", NULL };
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_y, spawn, {.v = passmenu } },
- { MODKEY|ShiftMask, XK_y, spawn, {.v = passmenu_type } },
+ { MODKEY|ShiftMask, XK_y, spawn, {.v = passmenu_tmux } },
{ MODKEY|ShiftMask, XK_l, spawn, {.v = lock } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
--- /dev/null
+#!/usr/bin/env bash
+
+shopt -s nullglob globstar
+
+typeit=0
+if [[ $1 == "--type" ]]; then
+ typeit=1
+ shift
+elif [[ $1 == "--tmux" ]]; then
+ typeit=2
+ shift
+fi
+
+prefix=${PASSWORD_STORE_DIR-~/.password-store}
+password_files=( "$prefix"/**/*.gpg )
+password_files=( "${password_files[@]#"$prefix"/}" )
+password_files=( "${password_files[@]%.gpg}" )
+
+password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
+
+[[ -n $password ]] || exit
+
+if [[ $typeit -eq 0 ]]; then
+ pass show -c "$password" 2>/dev/null
+elif [[ $typeit -eq 1 ]]; then
+ pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } |
+ xdotool type --clearmodifiers --file -
+else
+ tmux set-buffer "$(pass show "$password")"
+fi