Alois Mahdal 9 anni fa
parent
commit
28501a0bd6
1 ha cambiato i file con 18 aggiunte e 0 eliminazioni
  1. 18
    0
      libexec/saturnin-clip

+ 18
- 0
libexec/saturnin-clip Vedi File

5
 ffoo import config
5
 ffoo import config
6
 ffoo import pretty
6
 ffoo import pretty
7
 
7
 
8
+#
9
+# Where to store clips
10
+#
8
 STORAGE_DIR="$SATURNIN_CACHE_HOME/clips"
11
 STORAGE_DIR="$SATURNIN_CACHE_HOME/clips"
9
 
12
 
10
 usage() {
13
 usage() {
33
 }
36
 }
34
 
37
 
35
 save_clip() {
38
 save_clip() {
39
+    #
40
+    # Save single clip
41
+    #
36
     local clipname=$1
42
     local clipname=$1
37
     mkdir -p "$STORAGE_DIR" || die "could not create directory for saving"
43
     mkdir -p "$STORAGE_DIR" || die "could not create directory for saving"
38
     local path="$STORAGE_DIR/$(date +%Y%m%d-%H%M%S.clip)"
44
     local path="$STORAGE_DIR/$(date +%Y%m%d-%H%M%S.clip)"
40
 }
46
 }
41
 
47
 
42
 lsclips() {
48
 lsclips() {
49
+    #
50
+    # List clips with MIME types and hints
51
+    #
43
     local clipname=$1
52
     local clipname=$1
44
     local ft hint name
53
     local ft hint name
45
     test -d "$STORAGE_DIR" || return 0
54
     test -d "$STORAGE_DIR" || return 0
60
 }
69
 }
61
 
70
 
62
 load_clip() {
71
 load_clip() {
72
+    #
73
+    # Load single clip of choice
74
+    #
63
     local clipname=$1
75
     local clipname=$1
64
     local name=$(saturnin clip ls | saturnin dmenu | cut -d\   -f 1)
76
     local name=$(saturnin clip ls | saturnin dmenu | cut -d\   -f 1)
65
     cat $STORAGE_DIR/$name | xclip -i -selection $clipname
77
     cat $STORAGE_DIR/$name | xclip -i -selection $clipname
66
 }
78
 }
67
 
79
 
68
 rm_clip() {
80
 rm_clip() {
81
+    #
82
+    # Remove single clip of choice
83
+    #
69
     local clipname=$1
84
     local clipname=$1
70
     local name=$(saturnin clip ls | saturnin dmenu | cut -d\   -f 1)
85
     local name=$(saturnin clip ls | saturnin dmenu | cut -d\   -f 1)
71
     rm -f $STORAGE_DIR/$name
86
     rm -f $STORAGE_DIR/$name
72
 }
87
 }
73
 
88
 
74
 rm_all() {
89
 rm_all() {
90
+    #
91
+    # Dump all clips
92
+    #
75
     test -n "$STORAGE_DIR" || die "storage directory is unset, aborting"
93
     test -n "$STORAGE_DIR" || die "storage directory is unset, aborting"
76
     test -d "$STORAGE_DIR" || return 0
94
     test -d "$STORAGE_DIR" || return 0
77
     find "$STORAGE_DIR" -name "*.clip" | xargs rm -f
95
     find "$STORAGE_DIR" -name "*.clip" | xargs rm -f