Procházet zdrojové kódy

Add username and password retrieval

master
= před 3 roky
rodič
revize
454bee1d6f
2 změnil soubory, kde provedl 73 přidání a 15 odebrání
  1. +4
    -1
      README.md
  2. +69
    -14
      prompt

+ 4
- 1
README.md Zobrazit soubor

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

## 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
- use attach-session -t . -c /dir for selecting multiplexer directory
- 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 Zobrazit soubor

@@ -17,19 +17,19 @@ launch() {
Processes" | tr -d '\t' |
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() {
@@ -50,6 +50,9 @@ action() {
Rebind Keys
Disable Bar
Man
Password
Username
Alternate password
Enable Bar" | tr -d '\t' |
dmenu -i -p "Actions")

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

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() {
@@ -191,6 +199,49 @@ cmd_clip() {
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
launch) launch;;
action) action;;
@@ -201,5 +252,9 @@ case $1 in
godoc) godoc;;
goinfo) goinfo;;
manual) manual;;
username) username;;
password) password;;
other_password) other_password;;
edit_password) edit_password;;
*) printf "Invalid argument";;
esac

Načítá se…
Zrušit
Uložit