Selaa lähdekoodia

Add alternate logins

master
= 3 vuotta sitten
vanhempi
commit
7d8bece7b9
4 muutettua tiedostoa jossa 40 lisäystä ja 24 poistoa
  1. +6
    -2
      README.md
  2. +1
    -0
      dwm-start
  3. +2
    -1
      mru
  4. +31
    -21
      prompt

+ 6
- 2
README.md Näytä tiedosto

@@ -45,6 +45,10 @@ most functionality is accessible from launch and action only
- You may want to bind Mod4+a to `launch action` and Mod4+g to `prompt launch`
- Some prompts like `search package` will infer with their default operation
when the string entered is an invalid selection
- the password functions assume that logins for the same services are all
stored in the same file, with each account's information seperated by an
empty line. Each line containing a username begins with 'username:', each
line containing a password is the first line of it's section.

## mru
Used for storing file paths and their modification times in ~/.cache/mru/.
@@ -92,7 +96,6 @@ exists.

#### TODO
- Finish vpn and networking stuff after ini script is finished, then make sure
- Add ddg search prompt
- setup pass
- variables to the script to make assumed paths easier to change
- emoji select to clipboard
@@ -101,9 +104,10 @@ exists.
- Make password prompts green
- Figure out range selecting for parsing passwords
- Figure out using dmenu instead of gnome key prompt (pinentry)
- Consider entr in dwm-start for watching files
what?- Consider entr in dwm-start for watching files
- change xdg text/plain opener to use vim and st if not in terminal
- unicode character insertion
- finish editing text-opener
change prompt icon to nerd icon
- select window with wmctrl
- prompt for copying files to laptop

+ 1
- 0
dwm-start Näytä tiedosto

@@ -3,6 +3,7 @@ setxkbmap -option caps:swapescape
picom -b
~/.fehbg
xbindkeys -f $HOME/Backups/configs/xbindkeysrc
mru update &

# relaunch DWM if the binary changes, otherwise bail
csum=$(sha1sum $(which dwm.winkey))


+ 2
- 1
mru Näytä tiedosto

@@ -84,7 +84,8 @@ insert() {
fi
fi

if [ ! -z $file_path ]; then
if [ ! -z "$file_path" ]; then
echo "second sed starts"
sed -i "0,\|.*\t.*\t$file_path|d" $XDG_CACHE_HOME/mru/$cache_name
fi



+ 31
- 21
prompt Näytä tiedosto

@@ -136,7 +136,7 @@ package() {

editor() {
#handle spacing in filenames bug
file=$(mru list | dmenu -i -l 10 -p 'edit what?')
file=$(mru list | dmenu -i -l 10 -p 'edit file')
if [ -z "$file" ]; then exit; fi
first=$(printf "$file" | head -n1 -)
d=$(dirname "$first")
@@ -146,7 +146,7 @@ editor() {
}

opener() {
mru list | dmenu -i -l 20 -p 'open' | while read f; do mru insert "$f" & xdg-open $f; done
mru list | dmenu -i -l 20 -p 'open' | while read f; do xdg-open "$f"; done
}

screenshot() {
@@ -272,10 +272,17 @@ cmd_clip() {
printf "%s" "$value" | xclip -selection clipboard
}

username() {
account=$(find ~/.password-store/[!\.]* -type f |
sel_account() {
account=$(
find ~/.password-store/[!\.]* -type f |
sed -e "s:$HOME/.password-store/::" -e "s:\.gpg::" |
dmenu -p 'account')
dmenu -p 'account'
)
if [ -z "$account" ]; then exit; fi
}

username() {
account=$(sel_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)
@@ -284,6 +291,8 @@ username() {
}

password() {
rm prompt-login-*
touch /tmp/prompt-login-$$
account=$(find ~/.password-store/[!\.]* -type f |
sed -e "s:$HOME/.password-store/::" -e "s:\.gpg::" |
dmenu -p 'which service')
@@ -293,31 +302,27 @@ password() {
}

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
account=$(sel_account)
name=$(pass show "$account" | sed -n -e "s/^username: //p" |
dmenu -p 'which user password')
if [ -z "$name" ]; then exit; fi
pass show $account | sed "/^$/,/^username: $name/ { /^$/n }" | head -n1 | tr -d '\n' | xclip -selection clipboard
notify-send -u low -t 2000 "password copied" "$account: $name"

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

show_password() {
ls
account=$(sel_account)
info=$(pass show "$account")
st -e sh -lc "printf '$info' | less"
}

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
}
account=$(sel_account)
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
}

chooser() {
f=$(mru list | dmenu -i -l 20 -p 'choose file')
@@ -327,8 +332,12 @@ chooser() {
$c "$f"
}

vpn() {
ls
}

case $1 in
launch) launch;;
launch ) launch;;
action) action;;
cmd) cmd;;
cmd_clip) cmd_clip;;
@@ -336,5 +345,6 @@ case $1 in
search) do_search;;
open) opener;;
choose) chooser;;
vpn) vpn;;
*) printf "Invalid argument";;
esac

Loading…
Peruuta
Tallenna