Browse Source

Add username and password retrieval

master
= 3 years ago
parent
commit
454bee1d6f
2 changed files with 73 additions and 15 deletions
  1. +4
    -1
      README.md
  2. +69
    -14
      prompt

+ 4
- 1
README.md View File

@@ -11,7 +11,7 @@ All of them are optional except suckless-tools. Many of the features aren't inte
## prompt ## prompt
It's the central script that gives the rest of the features interactivity. Read the source code for more details. It's the central script that gives the rest of the features interactivity. Read the source code for more details.
### Usage ### Usage
prompt [ launch | action | cmd | ddg | pass | manual ]
prompt [ launch | action | cmd | ddg | manual ]
pages [ open ] pages [ open ]


## pages ## pages
@@ -41,3 +41,6 @@ Use it to automagically select and run terminal applications, send signals to da
- system of additional clipboards using /tmp files - system of additional clipboards using /tmp files
- use attach-session -t . -c /dir for selecting multiplexer directory - use attach-session -t . -c /dir for selecting multiplexer directory
- ddg fill options should be taken from bookmarks or history - ddg fill options should be taken from bookmarks or history
- Make password prompts green
- Figure out range selecting for parsing passwords
- Figure out using dmenu instead of gnome key prompt

+ 69
- 14
prompt View File

@@ -17,19 +17,19 @@ launch() {
Processes" | tr -d '\t' | Processes" | tr -d '\t' |
dmenu -i -p "Launcher") dmenu -i -p "Launcher")


case $app in
Notes) st -e vim "+cd ~/Notes/text" "+CtrlP";;
Files) st -e nnn;;
Editor) st -e vim;;
Terminal) st;;
Multiplexer) st -e tmux $*;;
LBRY) lbry;;
Chat) element-desktop;;
Music) st -e ncmpcpp;;
Browser) $browser_cmd;;
Email) $browser_cmd mail.protonmail.com/login;;
Processes) st -e htop;;
esac
case $app in
Notes) st -e vim "+cd ~/Notes/text" "+CtrlP";;
Files) st -e sh -lc nnn;;
Editor) st -e vim;;
Terminal) st;;
Multiplexer) st -e tmux $*;;
LBRY) lbry;;
Chat) element-desktop;;
Music) st -e ncmpcpp;;
Browser) $browser_cmd;;
Email) $browser_cmd mail.protonmail.com/login;;
Processes) st -e htop;;
esac
} }


action() { action() {
@@ -50,6 +50,9 @@ action() {
Rebind Keys Rebind Keys
Disable Bar Disable Bar
Man Man
Password
Username
Alternate password
Enable Bar" | tr -d '\t' | Enable Bar" | tr -d '\t' |
dmenu -i -p "Actions") dmenu -i -p "Actions")


@@ -66,6 +69,9 @@ case $action in
'Open page') pages pager "$(printf "1\n2\n3\n" | dmenu -p 'page')";; 'Open page') pages pager "$(printf "1\n2\n3\n" | dmenu -p 'page')";;
'Command') cmd;; 'Command') cmd;;
'Command to clipboard') cmd_clip;; 'Command to clipboard') cmd_clip;;
'Username') username;;
'Password') password;;
'Alternate password') other_password;;
'Man') st -e man "$(printf "" | dmenu -p 'man')";; 'Man') st -e man "$(printf "" | dmenu -p 'man')";;
'Go page') num=$(go_page); pages pager $num;; 'Go page') num=$(go_page); pages pager $num;;
esac esac
@@ -181,7 +187,9 @@ infowindow() {
} }


cmd() { cmd() {
sh -c "$(printf '' | dmenu -i -p 'cmd')"
c="$(printf '' | dmenu -i -p 'cmd')"
output=$( $c )
notify-send -u low 'command output' "$output"
} }


cmd_clip() { cmd_clip() {
@@ -191,6 +199,49 @@ cmd_clip() {
printf "%s" "$value" | xclip -selection clipboard printf "%s" "$value" | xclip -selection clipboard
} }


username() {
account=$(find ~/.password-store/[!\.]* -type f |
sed -e "s:$HOME/.password-store/::" -e "s:\.gpg::" |
dmenu -p 'account')
if [ -z "$account" ]; then exit; fi
name=$(pass show "$account" | sed -n -e "s/^username: //p" |
dmenu -p 'which username' | xclip -f -selection clipboard)
if [ -z "$name" ]; then exit; fi
notify-send -u low -t 2000 "username copied" "$account: $name"
}

password() {
account=$(find ~/.password-store/[!\.]* -type f |
sed -e "s:$HOME/.password-store/::" -e "s:\.gpg::" |
dmenu -p 'which service')
pass -c $account
notify-send -u low -t 1000 'password copied' "Copied $account"

}

other_password() {
account=$(find ~/.password-store/[!\.]* -type f |
sed -e "s:$HOME/.password-store/::" -e "s:\.gpg::" |
dmenu -p 'service')
if [ -z "$account" ]; then exit; fi
name=$(pass show "$account" | sed -n -e "s/^username: //p" |
dmenu -p 'which user password')
if [ -z "$name" ]; then exit; fi
notify-send -u low -t 2000 "password copied" "$account: $name"

#figure out range selections
sed -n -e ""
}

edit_password() {
account=$(find ~/.password-store/[!\.]* -type f |
sed -e "s:$HOME/.password-store/::" -e "s:\.gpg::" |
dmenu -p 'which service')
if [ -z "$account" ]; then exit; fi
error=$(st -e pass edit "$account" 2>&1)
if [ -n "$error" ]; then notify-send -u low -t 3000 "password edit error" "$error"; fi
}

case $1 in case $1 in
launch) launch;; launch) launch;;
action) action;; action) action;;
@@ -201,5 +252,9 @@ case $1 in
godoc) godoc;; godoc) godoc;;
goinfo) goinfo;; goinfo) goinfo;;
manual) manual;; manual) manual;;
username) username;;
password) password;;
other_password) other_password;;
edit_password) edit_password;;
*) printf "Invalid argument";; *) printf "Invalid argument";;
esac esac

Loading…
Cancel
Save