modular password management
This commit is contained in:
parent
d34e8e77bc
commit
ba6ee9bd99
7 changed files with 31 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -200,3 +200,4 @@ ksslcertificatemanager
|
||||||
kwalletmanager5rc
|
kwalletmanager5rc
|
||||||
soffice.binrc
|
soffice.binrc
|
||||||
systemmonitorrc
|
systemmonitorrc
|
||||||
|
menu-config
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
PROMPT="$1" ; MODE="$2"
|
PROMPT="$1" ; MODE="$2"
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
MENU="dmenu"
|
MENU="fzf" # Default to fzf
|
||||||
col_nb="#121212" # Normal background
|
col_nb="#121212" # Normal background
|
||||||
col_nf="#665c54" # Normal foreground
|
col_nf="#665c54" # Normal foreground
|
||||||
col_sb="#d3869b" # Selected background
|
col_sb="#d3869b" # Selected background
|
||||||
|
@ -12,6 +12,8 @@ col_sf="#121212" # Selected foreground
|
||||||
font="JetbrainsMono"
|
font="JetbrainsMono"
|
||||||
font_size="10"
|
font_size="10"
|
||||||
|
|
||||||
|
[ -e "$HOME/.config/menu-config" ] && MENU="$(cat "$HOME/.config/menu-config")"
|
||||||
|
|
||||||
# Print help
|
# Print help
|
||||||
if [ "$PROMPT" = "" -o "$PROMPT" = "-h" ] ; then
|
if [ "$PROMPT" = "" -o "$PROMPT" = "-h" ] ; then
|
||||||
printf "Usage: menu [prompt] [run/pass/empty]"
|
printf "Usage: menu [prompt] [run/pass/empty]"
|
||||||
|
@ -51,7 +53,6 @@ BEMENU_OPTS=" \
|
||||||
|
|
||||||
# dmenu opts
|
# dmenu opts
|
||||||
DMENU_OPTS=" \
|
DMENU_OPTS=" \
|
||||||
-c \
|
|
||||||
-i \
|
-i \
|
||||||
-l 10 \
|
-l 10 \
|
||||||
-nb $col_nb \
|
-nb $col_nb \
|
||||||
|
@ -63,6 +64,12 @@ DMENU_OPTS=" \
|
||||||
$DPASS \
|
$DPASS \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
# dmenu opts
|
||||||
|
FZF_OPTS=" \
|
||||||
|
--cycle \
|
||||||
|
--reverse \
|
||||||
|
"
|
||||||
|
|
||||||
# If chosen bemenu, use this args
|
# If chosen bemenu, use this args
|
||||||
[ "$MENU" = "bemenu" ] &&
|
[ "$MENU" = "bemenu" ] &&
|
||||||
OPTS="$BEMENU_OPTS" &&
|
OPTS="$BEMENU_OPTS" &&
|
||||||
|
@ -73,6 +80,11 @@ DMENU_OPTS=" \
|
||||||
OPTS="$DMENU_OPTS" &&
|
OPTS="$DMENU_OPTS" &&
|
||||||
RUN="_run"
|
RUN="_run"
|
||||||
|
|
||||||
|
# If chosen fzf, use this args
|
||||||
|
[ "$MENU" = "fzf" ] &&
|
||||||
|
OPTS="$FZF_OPTS" &&
|
||||||
|
RUN=""
|
||||||
|
|
||||||
[ "$MODE" = "run" ] && $MENU$RUN $OPTS
|
[ "$MODE" = "run" ] && $MENU$RUN $OPTS
|
||||||
[ "$MODE" = "pass" ] && < /dev/null | $MENU $OPTS
|
[ "$MODE" = "pass" ] && < /dev/null | $MENU $OPTS
|
||||||
[ "$MODE" = "empty" ] && < /dev/null | $MENU $OPTS
|
[ "$MODE" = "empty" ] && < /dev/null | $MENU $OPTS
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Script for 'pass'
|
# menu for 'pass'
|
||||||
|
|
||||||
PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
|
PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
|
||||||
|
|
||||||
# Ask for password name in vault
|
password="$(find "$PASSWORD_STORE_DIR" -type f -name '*.gpg' | sed "s@$PASSWORD_STORE_DIR/@@g ; s@.gpg@@g" | menu "Password:")"
|
||||||
password="$(find "$PASSWORD_STORE_DIR" -type f -name '*.gpg' |
|
|
||||||
sed "s@$PASSWORD_STORE_DIR/@@g ; s@.gpg@@g" | menu "Password:")"
|
|
||||||
|
|
||||||
# Exit if none chosen
|
! [ -z "$password" ] && printf '%s' "$password"
|
||||||
[ -z "$password" ] && exit
|
|
||||||
|
|
||||||
# If chosen, use xdotool to type it
|
|
||||||
xdotool type "$(pass $password | head -1)" &&
|
|
||||||
[ -e /usr/bin/notify-send ] && notify-send " $password" "Successfully decrypted"
|
|
||||||
|
|
|
@ -16,10 +16,9 @@ alias \
|
||||||
vid="cd $HOME/Videos/ && ls" \
|
vid="cd $HOME/Videos/ && ls" \
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
|
|
||||||
alias \
|
alias \
|
||||||
ll="exa -al --group-directories-first" \
|
ll="exa -al --group-directories-first" \
|
||||||
ls="ls -Alh --color=auto" \
|
ls="ls -A --color=auto" \
|
||||||
fzf="fzf --cycle --reverse" \
|
fzf="fzf --cycle --reverse" \
|
||||||
diff="diff --color=auto" \
|
diff="diff --color=auto" \
|
||||||
grep="grep --color=auto" \
|
grep="grep --color=auto" \
|
||||||
|
|
4
wrappers/passc
Executable file
4
wrappers/passc
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PASS="$(menu-pass)"
|
||||||
|
pass -c "$PASS"
|
4
wrappers/passw
Executable file
4
wrappers/passw
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PASS="$(menu-pass)"
|
||||||
|
pass "$PASS" | head -n 1 | wtype -
|
4
wrappers/passx
Executable file
4
wrappers/passx
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PASS="$(menu-pass)"
|
||||||
|
xdotool type "$(pass "$PASS" | head -n 1)"
|
Loading…
Reference in a new issue