diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-03-21 13:52:37 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-03-21 13:52:37 +0800 |
commit | 15ebee599391040d7bfcdfafaa8eb63dcfef86ca (patch) | |
tree | e068c2ab183e603aca4e829c4b03d7eb988b2368 | |
parent | 9b19f4fee9cffbf6816417f0dbbfe984d043cb01 (diff) |
Move excutable files into X11
-rwxr-xr-x | X11/image/takeshot (renamed from bin/desktop/takeshot) | 0 | ||||
-rwxr-xr-x | bin/desktop/password-store.sh | 51 |
2 files changed, 0 insertions, 51 deletions
diff --git a/bin/desktop/takeshot b/X11/image/takeshot index 9f34f26..9f34f26 100755 --- a/bin/desktop/takeshot +++ b/X11/image/takeshot | |||
diff --git a/bin/desktop/password-store.sh b/bin/desktop/password-store.sh deleted file mode 100755 index 1de3148..0000000 --- a/bin/desktop/password-store.sh +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | #! /bin/bash | ||
2 | |||
3 | # Use rofi to quickly access password by command 'pass' | ||
4 | # xsel needed !! | ||
5 | |||
6 | ROFI_ARGS=( "-font" "Hack 22" ) | ||
7 | |||
8 | find ~/.password-store -name '*gpg' -printf %P\\n | \ | ||
9 | sed 's/.gpg$//' | \ | ||
10 | rofi -dmenu "${ROFI_ARGS[@]}" | { | ||
11 | # Get arguments for command 'pass' | ||
12 | read ARG1 ARG2 | ||
13 | |||
14 | if [[ -z $ARG1 ]]; then | ||
15 | exit 1 | ||
16 | elif [[ $ARG1 == edit ]]; then | ||
17 | # Edit an existing password | ||
18 | alacritty --hold -e pass edit $ARG2 && \ | ||
19 | rofi -e Password Edited: $ARG2 | ||
20 | else | ||
21 | # If pass fails, then it means password doesn't exists | ||
22 | set pipefail | ||
23 | |||
24 | pass $ARG1 | { | ||
25 | # If command fails, just fail directly | ||
26 | read PASSWORD; [[ -z $PASSWORD ]] && exit 1 | ||
27 | |||
28 | # Simply copy password into system clipboard | ||
29 | echo $PASSWORD | xsel -ib | ||
30 | |||
31 | # Show success message, and display extra contents | ||
32 | rofi "${ROFI_ARGS[@]}" \ | ||
33 | -e "Copied: $ARG1 $(echo; echo; cat | sed '1{/^$/d}')" | ||
34 | } || { | ||
35 | # Make sure user want to create a new password | ||
36 | return_code=$(alacritty -e sh -c ' | ||
37 | dialog --yesno "Password does not exist, Generate a new one?" 8 30; | ||
38 | echo "$?" | ||
39 | ') | ||
40 | [[ $return_code == 1 ]] && exit 1 | ||
41 | |||
42 | # Generate a new password by ARG1 | ||
43 | alacritty -e pass generate $ARG1 --clip && \ | ||
44 | |||
45 | # Show success message | ||
46 | rofi "${ROFI_ARGS[@]}" -e "Password Created and Copied: $ARG1" | ||
47 | } | ||
48 | |||
49 | # TODO: if return code is 2, it means gpg password is not cached | ||
50 | fi | ||
51 | } | ||