| Hash | Commit message | Author | Date | Files | + | - |
1 | commit dfa0e6245dfa9ace9c6933ea72a5f618e5fa9a01 |
2 | Author: Connor Etherington <[email protected]> |
3 | Date: Sat Jan 21 15:27:35 2023 +0200 |
4 | |
5 | Auto-Commit Update 21.01.2023 - 15:27:35 |
6 | --- |
7 | usr/bin/qcopy | 27 ++++++++++++++------------- |
8 | 1 file changed, 14 insertions(+), 13 deletions(-) |
9 | |
10 | diff --git a/usr/bin/qcopy b/usr/bin/qcopy |
11 | index a383ae7..675e6fc 100755 |
12 | --- a/usr/bin/qcopy |
13 | +++ b/usr/bin/qcopy |
14 | @@ -14,7 +14,7 @@ NEWENTRY="\\n You have not yet set any qcopy variables. Would you like to create |
15 | |
16 | ENTRIESFILE="${XDG_DATA_HOME:-$HOME/.local/share}/qcopy/entries" |
17 | |
18 | -FZFPREVIEW="cat $ENTRIESFILE|grep {} | grep -q 'YESPREVIEW' && |
19 | +FZFPREVIEW="cat $ENTRIESFILE|grep {} | grep -q 'YESPREVIEW' && |
20 | cat $ENTRIESFILE | grep ^{}= | cut -d\= -f3- | bat --style=numbers,grid --color=always && return 0 || |
21 | cat $ENTRIESFILE | grep {} | grep -q 'NOPREVIEW' && echo -e '\n\e[1;31m |
22 | ▗▄▄ ▗▄▄ ▗▄▄ ▗ ▖ ▗▖ ▄▄▄▖▗▄▄▖ |
23 | @@ -34,12 +34,12 @@ FIRSTLOOP(){ [ -f $ENTRIESFILE ] && [ $(cat $ENTRIESFILE | wc -w) -ge 1 ] || FIR |
24 | |
25 | FIRST(){ dialog --title " ~ First Run ~ " --yesno "$NEWENTRY" 8 82 && NEW && return 0 || clear && exit 1 ; } |
26 | |
27 | - |
28 | + |
29 | function NEW { |
30 | |
31 | - ! [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/qcopy" ] && |
32 | + ! [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/qcopy" ] && |
33 | mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/qcopy" |
34 | - |
35 | + |
36 | dialog \ |
37 | --stdout --title " ~ NEW ENTRY ~ " \ |
38 | --form "\n Please fill in the required information :\n " 13 81 3 \ |
39 | @@ -54,12 +54,12 @@ function NEW { |
40 | --no-label "No Preview" \ |
41 | --title " ~ QCopy ~ " \ |
42 | --yesno "\\n Would you like to preview this entries value upon future selection?\\n " 7 90 |
43 | - |
44 | + |
45 | PREVIEW=${?} && [ ${PREVIEW} -eq "0" ] && PREVIEW="YESPREVIEW" || PREVIEW="NOPREVIEW" |
46 | - |
47 | + |
48 | [[ -n $ENTRYNAME ]] && [[ -n $ENTRYVALUE ]] && echo "${ENTRYNAME}=${PREVIEW}=${ENTRYVALUE}" >> $ENTRIESFILE && MAIN && exit 0 || exit 1 |
49 | |
50 | -} |
51 | +} |
52 | |
53 | function DEL { |
54 | |
55 | @@ -90,10 +90,10 @@ function MAIN { |
56 | --preview-window=70% ) || exit 1 |
57 | |
58 | [[ ${VALUE} == '* NEW ENTRY' ]] && NEW && return 0 |
59 | - |
60 | - cat $ENTRIESFILE| grep "^${VALUE}="| |
61 | + |
62 | + cat $ENTRIESFILE| grep "^${VALUE}="| |
63 | sed -r "s/^${VALUE}=//;s/YESPREVIEW=//;s/NOPREVIEW=//" | |
64 | - sed 's/^\s*//g' | xargs echo -n | xsel -b && |
65 | + sed 's/^\s*//g' | xargs echo -n | xsel -b && |
66 | notify-send "✅ Copied to Clipboard" || true |
67 | |
68 | } |
69 | @@ -107,7 +107,8 @@ trap "rm -f $TMP" EXIT QUIT |
70 | FIRSTLOOP && case ${1} in |
71 | '-a'|'-n'|'--add'|'--new') NEW && exit 0 ;; |
72 | '-d'|'-r'|'--del'|'--delete'|'--remove') DEL && exit 0 ;; |
73 | - *) MAIN && exit 0 ;; |
74 | - |
75 | + '-u'|'-p'|'-w'|'--paste'|'--write'|'--use') MAIN && trap "xdotool type --clearmodifiers `xsel -bo`" EXIT ; exit 0 ;; |
76 | + '-h'|'?'|'--help') echo -e "\n\e[1;32m Usage: \e[0m\n\n qcopy [OPTION]\n\n\e[1;32m Options: \e[0m\n\n -a, -n, --add, --new\t\t\tAdd a new entry\n -d, -r, --del, --delete, --remove\tDelete an entry\n -u, -p, -w, --paste, --write, --use\tImmediately paste the selected entry\n -h, ?, --help\t\t\t\tDisplay this help and exit\n" ;; |
77 | + *) MAIN && exit 0 ;; |
78 | esac |
79 | - |
80 | + |