Add passmenu2 script
This commit is contained in:
parent
281e8e7265
commit
bae469832e
6
Makefile
6
Makefile
@ -34,7 +34,7 @@ clean:
|
|||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dmenu-$(VERSION)
|
mkdir -p dmenu-$(VERSION)
|
||||||
cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
|
cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
|
||||||
drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\
|
drw.h util.h dmenu_path dmenu_run passmenu2 stest.1 $(SRC)\
|
||||||
dmenu-$(VERSION)
|
dmenu-$(VERSION)
|
||||||
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
|
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
|
||||||
gzip dmenu-$(VERSION).tar
|
gzip dmenu-$(VERSION).tar
|
||||||
@ -42,10 +42,11 @@ dist: clean
|
|||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin
|
cp -f dmenu dmenu_path dmenu_run passmenu2 stest $(DESTDIR)$(PREFIX)/bin
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
|
||||||
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/passmenu2
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
|
||||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||||
sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
|
sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
|
||||||
@ -57,6 +58,7 @@ uninstall:
|
|||||||
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
|
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_path\
|
$(DESTDIR)$(PREFIX)/bin/dmenu_path\
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
|
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
|
||||||
|
$(DESTDIR)$(PREFIX)/bin/passmenu2\
|
||||||
$(DESTDIR)$(PREFIX)/bin/stest\
|
$(DESTDIR)$(PREFIX)/bin/stest\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
||||||
|
59
passmenu2
Executable file
59
passmenu2
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
shopt -s nullglob globstar
|
||||||
|
|
||||||
|
typeit=0
|
||||||
|
if [[ $1 == "--type" ]]; then
|
||||||
|
typeit=1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
STARTDIR=${PASSWORD_STORE_DIR-~/.password-store}
|
||||||
|
BASEDIR=$STARTDIR
|
||||||
|
DONE=0
|
||||||
|
LEVEL=0
|
||||||
|
PREVSELECTION=""
|
||||||
|
SELECTION=""
|
||||||
|
|
||||||
|
while [ "$DONE" -eq 0 ] ; do
|
||||||
|
password_files=( "$STARTDIR"/* )
|
||||||
|
password_files=( "${password_files[@]#"$STARTDIR"/}" )
|
||||||
|
password_files=( "${password_files[@]%.gpg}" )
|
||||||
|
|
||||||
|
if [ "$LEVEL" -ne 0 ] ; then
|
||||||
|
password_files=(".." "${password_files[@]}")
|
||||||
|
fi
|
||||||
|
entry=$(printf '%s\n' "${password_files[@]}" | dmenu "$@" -l 15)
|
||||||
|
|
||||||
|
echo "entry: $entry"
|
||||||
|
if [ -z "$entry" ] ; then
|
||||||
|
DONE=1
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$entry" != ".." ] ; then
|
||||||
|
PREVSELECTION=$SELECTION
|
||||||
|
SELECTION="$SELECTION/$entry"
|
||||||
|
|
||||||
|
# check if another dir
|
||||||
|
if [ -d "$STARTDIR/$entry" ] ; then
|
||||||
|
STARTDIR="$STARTDIR/$entry"
|
||||||
|
LEVEL=$((LEVEL+1))
|
||||||
|
else
|
||||||
|
# not a directory so it must be a real password entry
|
||||||
|
if [[ $typeit -eq 0 ]]; then
|
||||||
|
pass show -c "$SELECTION" 2>/dev/null
|
||||||
|
else
|
||||||
|
xdotool - <<<"type --clearmodifiers -- $(pass show "$SELECTION" | head -n 1)"
|
||||||
|
fi
|
||||||
|
DONE=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
LEVEL=$((LEVEL-1))
|
||||||
|
SELECTION=$PREVSELECTION
|
||||||
|
STARTDIR="$BASEDIR/$SELECTION"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user