qcopy


Logs | Files | LICENSE | GitLab


1
commit 345ede9cf340787a8d3731ebebe4bc071e8eebcb
2
Author: Connor Etherington <[email protected]>
3
Date:   Sun Jun 26 19:52:39 2022 +0200
4
5
    Auto-Commit Update - 20220626
6
---
7
 PKGBUILD      |  3 ++-
8
 usr/bin/qcopy | 16 ++++++++++------
9
 2 files changed, 12 insertions(+), 7 deletions(-)
10
11
diff --git a/PKGBUILD b/PKGBUILD
12
index 5b84b45..5e97aff 100644
13
--- a/PKGBUILD
14
+++ b/PKGBUILD
15
@@ -1,7 +1,7 @@
16
 # Maintainer: Connor Etherington <[email protected]>
17
 # ---
18
 pkgname=qcopy
19
-pkgver=1.4
20
+pkgver=1.5
21
 pkgrel=1
22
 pkgdesc="Easily save important snippets such as passwords for quick access copying at any point"
23
 arch=(any)
24
@@ -27,4 +27,5 @@ package() {
25
     install -Dm755 usr/bin/${pkgname} "${pkgdir}/usr/bin/${pkgname}"
26
     install -Dm644 usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
27
     install -Dm644 usr/share/man/man1/${pkgname}.1.gz "${pkgdir}/usr/share/man/man1/${pkgname}.1.gz"
28
+    install -Dm644 usr/share/qcopy/fonts/future.tlf "${pkgdir}/usr/share/qcopy/fonts/future.tlf"
29
 }
30
diff --git a/usr/bin/qcopy b/usr/bin/qcopy
31
index 9f853d6..772505c 100755
32
--- a/usr/bin/qcopy
33
+++ b/usr/bin/qcopy
34
@@ -14,21 +14,21 @@ NEWENTRY="\\n You have not yet set any qcopy variables. Would you like to create
35
 
36
 ENTRIESFILE="${XDG_DATA_HOME:-$HOME/.local/share}/qcopy/entries"
37
 
38
-FZFPREVIEW="cat $ENTRIESFILE|grep {} | grep 'YESPREVIEW' >/dev/null 2>&1 && 
39
-  cat $ENTRIESFILE | grep ^{}= | cut -d\= -f3- | bat --style=numbers,grid --color=always || 
40
-  echo -e '\n\e[1;31m
41
+FZFPREVIEW="cat $ENTRIESFILE|grep {} | grep -q 'YESPREVIEW' && 
42
+  cat $ENTRIESFILE | grep ^{}= | cut -d\= -f3- | bat --style=numbers,grid --color=always && return 0 ||
43
+  cat $ENTRIESFILE | grep {} | grep -q 'NOPREVIEW' &&  echo -e '\n\e[1;31m
44
     ▗▄▄ ▗▄▄ ▗▄▄ ▗  ▖ ▗▖ ▄▄▄▖▗▄▄▖
45
     ▐ ▝▌▐ ▝▌ ▐  ▝▖▗▘ ▐▌  ▐  ▐
46
     ▐▄▟▘▐▄▄▘ ▐   ▌▐  ▌▐  ▐  ▐▄▄▖
47
     ▐   ▐ ▝▖ ▐   ▚▞  ▙▟  ▐  ▐
48
     ▐   ▐  ▘▗▟▄  ▐▌ ▐  ▌ ▐  ▐▄▄▖
49
 
50
-\e[0m '"
51
+\e[0m ' && return 0 || echo {} | grep -q '^\* NEW ENTRY' && echo -e '\n\e[1;32mNew Entry\e[0m\n'"
52
 
53
 
54
 # Functions:
55
 
56
-PLACEHOLDER(){ awk -F= '{print $1}' ${1:-$ENTRIESFILE}|sed 's/\s*//;/^$/d'|sort -u ; }
57
+PLACEHOLDER(){ awk -F= '{print $1}' ${1:-$ENTRIESFILE}|sed 's/\s*//;/^$/d'|sort -u ; echo '* NEW ENTRY' ; }
58
 
59
 FIRSTLOOP(){ [ -f $ENTRIESFILE ] && [ $(cat $ENTRIESFILE | wc -w) -ge 1 ] || FIRST ; }
60
 
61
@@ -89,7 +89,11 @@ function MAIN {
62
     --preview "${FZFPREVIEW}" \
63
     --preview-window=70% ) || exit 1
64
 
65
-   cat $ENTRIESFILE| grep "${VALUE}"| awk -F\= '{print $3}'| sed 's/\s*//g' | xsel -ib
66
+   [[ ${VALUE} == '* NEW ENTRY' ]] && NEW && return 0
67
+  
68
+   cat $ENTRIESFILE| grep "${VALUE}"| awk -F\= '{print $3}' | 
69
+     sed 's/\s*//g' | xargs echo -n | xsel -b && 
70
+     notify-send "✅ Copied to Clipboard" || true
71
 
72
 }
73