Chris Down
4e969bd67d
Truncate cache file on duplicate
2018-02-20 11:21:37 +00:00
Chris Down
1896ceaccc
Act on possible partials in both directions
2018-02-20 10:39:30 +00:00
Chris Down
0b885650fe
Revert "Remove partial clip dedupe support"
...
This reverts commit caa009b222
.
2018-02-20 10:38:48 +00:00
Chris Down
8896df9011
Use -o/-i, not -k
...
-k is not selection based
2018-02-20 10:30:54 +00:00
Chris Down
c7c894a023
Use separate line cache for each selection
2018-02-20 10:29:35 +00:00
Chris Down
7b4267868e
Revert "Remove last_data checks"
...
This reverts commit 55407ba3f6
.
2018-02-20 10:09:50 +00:00
Chris Down
52b144d970
Revert "Take clipboard ownership prior to clipnotify"
...
This reverts commit eb7d2b9481
.
2018-02-20 10:09:24 +00:00
Chris Down
9c436084f2
Revert "Use xsel -o/-i instead of -k"
...
This reverts commit 47eb3d182c
.
2018-02-20 10:08:20 +00:00
Chris Down
9a52f7ddba
Revert "Make sure we don't break #34 in new pre-ownership"
...
This reverts commit fe69861101
.
2018-02-20 10:08:13 +00:00
Chris Down
6825c302dc
Revert "Remove CM_ONESHOT-specific logic in flock failure checks"
...
This reverts commit 728d242d3c
.
2018-02-20 10:07:58 +00:00
Chris Down
a85f8998b4
Revert "Make main work block async"
...
There is currently a bug where this causes a copy storm at startup. More
worryingly, more and more newlines are appended to the end, so something
is going wrong in copy logic anyway, async or not.
This reverts commit 11304d3a60
.
2018-02-20 09:29:49 +00:00
Chris Down
caab3f6a62
Add $CM_SELECTIONS to limit which selections we copy
...
Closes #60 .
2018-02-19 18:21:44 +00:00
Chris Down
728d242d3c
Remove CM_ONESHOT-specific logic in flock failure checks
...
Now that we're in a subshell and acting asynchronously, this doesn't do
anything different.
2018-02-19 15:41:11 +00:00
Chris Down
fe69861101
Make sure we don't break #34 in new pre-ownership
2018-02-19 15:11:51 +00:00
Chris Down
47eb3d182c
Use xsel -o/-i instead of -k
...
-k is not selection based, so it also takes PRIMARY.
2018-02-19 15:07:26 +00:00
Chris Down
11304d3a60
Make main work block async
...
Closes #59 .
2018-02-19 15:04:52 +00:00
Chris Down
eb7d2b9481
Take clipboard ownership prior to clipnotify
...
This avoids infinite loop if we make the work block async
2018-02-19 15:01:21 +00:00
Chris Down
55407ba3f6
Remove last_data checks
...
Nowadays everything should be using clipnotify, which avoids constantly
copying the same data.
2018-02-19 14:51:00 +00:00
Chris Down
b5e8543b3e
Use xsel -k
, instead of -o
-> -i
2018-02-19 14:43:44 +00:00
Chris Down
3704ce3427
Fall back to polling if clipnotify fails
2018-02-08 01:05:15 +00:00
Chris Down
b33d74cae5
Add messages when clipnotify is not detected
2018-02-08 00:55:29 +00:00
Chris Down
2b04a1eafe
Add optional support for clipnotify to avoid polling
2018-02-05 23:49:41 +00:00
Chris Down
f576a116fd
Don't attempt to write to sockets represented as files
...
Fixes #54 .
2017-10-29 10:40:38 +00:00
Chris Down
35a3cb2e8a
Use /proc/self/fd/2 instead of /dev/stderr where possible
...
/dev/stderr is not standardised, whereas /proc/self/fd is provided by
the kernel. Add a fallback for non-Linux.
2017-10-29 02:08:25 +00:00
Chris Down
f34bd68797
Bump major_version to 4
2017-10-25 01:57:35 +01:00
Chris Down
48b1ebf9fb
If CM_MAX_CLIPS is 0, don't truncate
2017-10-24 22:53:54 +02:00
Chris Down
6855d24e3a
Prefer $XDG_RUNTIME_DIR for storage
...
Closes #51 .
2017-10-24 19:14:23 +02:00
Chris Down
4a0bd8f1f4
Only keep $CM_MAX_CLIPS newest clips
...
Closes #50 .
2017-10-24 17:34:23 +02:00
Chris Down
e6c312b639
Avoid double writing if both selections are the same
2017-10-24 17:34:00 +02:00
Chris Down
8bb4ff3999
Gate new clipboard entry output on CM_DEBUG
...
Closes #49 .
2017-10-24 17:03:02 +02:00
Chris Down
2cd2287612
Add more documentation on -h/--help for clipmenu{,d}
2017-05-31 20:03:06 +01:00
Chris Down
60611584ec
Remove unused last_filename
2017-05-30 09:06:04 +01:00
Chris Down
f0d09c7692
Use $TMPDIR as base for cache directory
...
Closes #38 .
2017-05-30 09:03:35 +01:00
Chris Down
caa009b222
Remove partial clip dedupe support
...
The application that was particularly bad at this (Chrome) now no longer
does this, and this is basically a hack that has lasted too long.
Also closes #41 and closes #42 since the questionable "feature" is going
away.
2017-05-30 08:58:19 +01:00
Chris Down
e7a15a5d50
Do not sleep initially in oneshot mode
2017-05-10 10:05:16 +01:00
Chris Down
e65b51b33c
Use CM_* env vars
2017-03-19 07:53:26 +00:00
Chris Down
eecc031718
Use stderr for xsel logging when detached
2017-03-19 07:38:34 +00:00
Chris Down
19569a81bc
Log new clipboard entries without $DEBUG
2017-03-19 07:34:29 +00:00
Chris Down
28d8db8860
clipmenud: Time out all calls to xsel after 1 second
...
I'm not entirely sure how this happens, but sometimes xsel gets rather
stuck:
% systemctl --user status clipmenud
● clipmenud.service - Clipmenu daemon
Loaded: loaded (/usr/lib/systemd/user/clipmenud.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2017-03-15 11:14:14 GMT; 1 day 13h ago
Main PID: 31630 (clipmenud)
CGroup: /user.slice/user-1000.slice/user@1000.service/clipmenud.service
├─ 9052 /bin/bash /usr/bin/clipmenud
├─ 9053 xsel --logfile /dev/null -o --primary
└─31630 /bin/bash /usr/bin/clipmenud
Mar 15 11:14:14 gongzuo systemd[474]: Started Clipmenu daemon.
% strace -p 9053
strace: Process 9053 attached
restart_syscall(<... resuming interrupted restart_syscall ...>^Cstrace: Process 9053 detached
<detached ...>
% ps aux | grep 9053
cdown 9053 0.0 0.0 15956 896 ? S Mar15 0:00 xsel --logfile /dev/null -o --primary
2017-03-17 01:18:43 +00:00
Chris Down
d8dbb1d5af
Use wrapper for xsel to avoid having to pass --logfile again and again
2017-03-17 01:18:43 +00:00
drake-on-mandrake
6facea933b
Add --logfile /dev/null
to the xsel command
2017-03-09 14:48:16 +00:00
Chris Down
db05c51942
Add oneshot mode support
...
Fixes #27 .
2017-02-17 20:45:06 -05:00
Chris Down
b839f80779
Add locking support
...
This is a prerequisite for adding oneshot mode, see #27 .
2017-02-17 20:42:29 -05:00
Chris Down
9a5174123e
Remove old version file, we now use versioned dirs
2017-02-17 12:06:10 -05:00
Chris Down
2acece7dce
Put $major_version in cache_dir to avoid upgrade incompatibility
2017-02-17 12:01:42 -05:00
Chris Down
683f57484f
Remove xclip support
...
Pretty much everyone runs with xsel, so xclip support is becoming more
and more questionable. Just have people use xsel.
2017-02-17 11:50:52 -05:00
Chris Down
f7b0ea1c18
Add version to $cache_dir
2017-01-11 11:35:09 +00:00
Chris Down
8c1054ca73
Put vars above functions
2017-01-11 11:33:14 +00:00
Chris Down
7c713d5673
Merge branch 'perf' into develop
2017-01-06 17:34:13 +00:00
Chris Down
1daaeda6f3
Remove print_debug_info, this was never very useful
2017-01-06 16:47:29 +00:00
Chris Down
8885306970
perf: Don't use date, use CRC instead
...
We don't need to sort by date now that we record in $cache_file, which
does it naturally for us.
2017-01-06 14:53:59 +00:00
Chris Down
e8ba60e432
Have clipmenud cache first lines
2017-01-06 12:05:36 +00:00
kesha-on-disc
892fe73110
Add --logfile /dev/null
to xsel commands
2016-11-30 09:11:10 +01:00
Chris Down
2ab5b5b502
Only take ownership of clipboard if we would not skip this clip
...
Fixes #34 , an issue with pcmanfm GUI file copy/paste.
2016-11-09 11:38:41 +00:00
Chris Down
9efd96b405
blank check: Use [:space:], not [:blank:]
...
This is semantically more correct. Previously, in the most common case,
pastes with only `\n` would result in `bad array subscript`.
Fixes #31 .
2016-11-07 08:46:40 +00:00
Chris Down
c5f101d996
Use -o when running xsel
...
xsel` without `-o` even though it has the same *end* result, has
different internal logic. Specifically, it seems to do things with the
PRIMARY selection that cause weird behaviour (like causing applications
like urxvt to deselect their selection, see #33 ).
2016-11-05 12:06:15 -06:00
Chris Down
6e6c4ed430
Fix blank check
...
lol where da unit tests at
2016-11-02 16:55:39 -06:00
Chris Down
e8ebe8b27d
Add tons of debug logging
...
I'm hoping this will help debug #33 , #32 , and #26 .
2016-11-02 08:49:45 -06:00
GSI2016
05431fe645
replaced md5 logic by using current time with nanoseconds (refs #20 )
...
This strongly improves performance for clipmenud.
2016-06-22 16:59:51 +01:00
Chris Down
1fcc55a48d
Silence shellcheck warning about mkdir -pm
2016-06-22 16:50:10 +01:00
Chris Down
45ac24d625
Remove partial clips
2015-10-07 19:06:47 +01:00
Chris Down
4dfbfed9e2
Tidy up clipboard ownership code to be 80 characters wide
2015-09-14 13:41:31 +01:00
Streetwalrus Einstein
a613aa6b2e
Don't take ownership of PRIMARY, comment about this behavior
2015-09-14 15:01:22 +03:00
Streetwalrus Einstein
065e91a5fc
Take over the clipboard to persist it after the owner quits
2015-09-11 23:29:14 +03:00
Chris Down
72e15005e9
Reduce default poll time down to 0.5 seconds
...
This is configurable via an environment variable rather than a command line
option, as I'm not expecting many people really need to change this thing.
I profiled the change from 1 -> 0.5 seconds on an old P4, and saw pretty much
no difference in CPU usage, whether there were new clipboard entries or not.
Closes #12 .
2015-09-06 01:46:21 +01:00
Chris Down
d4390324f5
Document why we add/remove an "x" when grabbing the clipboard data
2015-07-27 20:19:41 -07:00
Chris Down
d246b63f27
Set perms to 0700 when creating cache dir
2015-07-27 20:16:13 -07:00
Chris Down
0418bf2e6d
Sort selections by recency
...
Fixes #5 .
2015-07-27 20:08:10 -07:00
Chris Down
5b2754868b
Make clipmenu cache directory user-specific
...
Fixes #2 .
2015-07-27 20:01:41 -07:00
Chris Down
35521af0ec
Make sure that the clipboard data is not just whitespace before copying
...
This avoids getting a bad array subscript, and polluting the menu.
Thanks to @kaihendry for noticing this issue and suggesting a fix. This commit
is a modified version of his suggestion, using [:blank:] instead of [:space:].
Closes #7 .
2015-07-27 20:00:21 -07:00
Chris Down
2cbfb4ef88
Add xclip support
...
Fixes #1 . As first suggested in a fork by @milouse.
2015-02-08 17:40:36 +00:00
Chris Down
c40456caa0
Do not write to file if last selection data is the same
2014-02-05 18:52:03 +08:00
Chris Down
fecfede140
Do not add newline when copying clipboard data to file
2014-02-05 18:06:47 +08:00
Chris Down
fd8b6bfe37
Check that there really is some data before storing it
2014-02-05 18:02:39 +08:00
Chris Down
dd9a041846
Copy from both clipboard and primary selections
2014-02-05 17:45:37 +08:00
Chris Down
4a85fd767c
Add clipmenu daemon
2014-02-05 16:57:11 +08:00