Browse code
Adding functions to list,show,clear clipboards
- uls lists the current clipboard
- ushow shows the current clipboard
- uclear clears the current clipboard
Showing 2 changed files
... | ... |
@@ -7,13 +7,24 @@ utilities to manage a set of named clipboards. |
7 | 7 |
|
8 | 8 |
```(lang=sh) |
9 | 9 |
sbcl --load ~/quicklisp/setup.lisp --eval '(ql:quickload :buildapp)' --eval '(buildapp:build-buildapp)' |
10 |
- |
|
11 |
- ./buildapp --output ~/bin/multicall/uclip --asdf-tree ~/quicklisp/quicklisp --asdf-path `pwd` --load-system uclip --dispatched-entry ucopy/uclip::copy --dispatched-entry /uclip::paste --dispatched-entry upaste/uclip::paste --dispatched-entry uswitch/uclip::switch-clipboards --dispatched-entry uclipop/uclip::pop-clipboard |
|
12 |
- |
|
10 |
+ |
|
11 |
+ ./buildapp --output ~/bin/multicall/uclip --asdf-tree ~/quicklisp/quicklisp --asdf-path `pwd` --load-system uclip \ |
|
12 |
+ --dispatched-entry /uclip::paste \ |
|
13 |
+ --dispatched-entry ucopy/uclip::copy \ |
|
14 |
+ --dispatched-entry upaste/uclip::paste \ |
|
15 |
+ --dispatched-entry uswitch/uclip::switch-clipboards \ |
|
16 |
+ --dispatched-entry upop/uclip::pop-clipboard \ |
|
17 |
+ --dispatched-entry uls/uclip::list-clipboards \ |
|
18 |
+ --dispatched-entry ushow/uclip::show-clipboard-contents \ |
|
19 |
+ --dispatched-entry uclear/uclip::clear-clipboard |
|
20 |
+ |
|
13 | 21 |
xargs -n1 ln -fs multicall/uclip <<EOF |
14 | 22 |
ucopy |
15 | 23 |
upaste |
16 | 24 |
uswitch |
17 |
- uclipop |
|
25 |
+ upop |
|
26 |
+ uls |
|
27 |
+ ushow |
|
28 |
+ uclear |
|
18 | 29 |
EOF |
19 | 30 |
``` |
... | ... |
@@ -21,7 +21,6 @@ |
21 | 21 |
(value 'clipboard *current-clipboard*))) |
22 | 22 |
|
23 | 23 |
(defun paste (argv) |
24 |
- (declare (ignore argv)) |
|
25 | 24 |
(init) |
26 | 25 |
(let ((*current-clipboard* |
27 | 26 |
(if (cdr argv) (cadr argv) *current-clipboard*))) |
... | ... |
@@ -38,3 +37,24 @@ |
38 | 37 |
(init) |
39 | 38 |
(when (value 'clipboard *current-clipboard*) |
40 | 39 |
(format t "~a" (pop (value 'clipboard *current-clipboard*))))) |
40 |
+ |
|
41 |
+(defun show-clipboard-contents (argv) |
|
42 |
+ (init) |
|
43 |
+ (let* ((*current-clipboard* (aif (cdr argv) (car it) *current-clipboard*)) |
|
44 |
+ (current-clipboard (value 'clipboard *current-clipboard*)) |
|
45 |
+ (cc-length (length current-clipboard)) |
|
46 |
+ (show-length (min cc-length |
|
47 |
+ (or (awhen (cddr argv) (parse-integer (car it) :junk-allowed t)) |
|
48 |
+ 5))) |
|
49 |
+ (current-clipboard (subseq current-clipboard 0 show-length))) |
|
50 |
+ (when (> cc-length 0) |
|
51 |
+ (format t "~&~{~a~&~^---~%~}" current-clipboard)))) |
|
52 |
+ |
|
53 |
+(defun list-clipboards (argv) |
|
54 |
+ (init) |
|
55 |
+ (format t "~&~{~a~%~}" (hash-table-keys (value 'clipboard)))) |
|
56 |
+ |
|
57 |
+(defun clear-clipboard (argv) |
|
58 |
+ (declare (ignore argv)) |
|
59 |
+ (init) |
|
60 |
+ (setf (value 'clipboard *current-clipboard*) nil)) |