Commit graph

98 commits

Author SHA1 Message Date
Chris Down f22fce7f04 Use a single line cache file
In c7c894a0, a per-selection line-cache was introduced in order to
overcome some of the limitations of clipmenu at the time (for example,
missing duplicate detection). However, now we have all the features we
need to have a single line cache again, and having multiple line caches
has caused more trouble than it is worth.

For example, maintaining CM_MAX_CLIPS globally is extremely cumbersome,
so we don't do it, and CM_MAX_CLIPS is actually acted on per-selection.
We also have had bugs where we perform actions on cache files without
properly consulting other line caches, and while those can be fixed, the
simplest thing to do now is just to go back to having a single line
cache.
2020-03-23 13:00:14 +00:00
Chris Down 25c7503c6a Default CM_OWN_CLIPBOARD to 0
See #113, #102, and (probably) #119. This seems to cause more trouble
than it's really worth.
2020-03-11 14:58:42 +00:00
Chris Down e89f4843bb truncation: Avoid harmless reporting of multi-removals on a single file 2020-03-11 00:46:23 +00:00
Chris Down 7a9299cc18 clipmenud: Better document new CM_MAX_CLIPS batching 2020-03-07 12:34:46 +00:00
Chris Down a495bcc7a4 clipmenud: Batch truncations in groups of 100 for performance 2019-07-09 22:37:25 +01:00
Chris Down 85aaec1626 clipmenud: Avoid deleting still-referenced files in the case of dupes 2019-07-09 22:31:20 +01:00
Chris Down 7cb215c3f9 clipmenud: Add INFO logging for removals 2019-07-09 22:28:16 +01:00
Chris Down 4a39610896 clipmenud: Make session file error message more clear 2019-05-01 11:27:24 -04:00
Chris Down ad47f8e2db clipmenud: Create die and error functions 2019-05-01 11:26:01 -04:00
Chris Down 1cb46143f3 clipmenud: Add a sessionwide lock 2019-05-01 11:22:48 -04:00
Sohalt 7de9c9e809 Add support to ignore the clipboard in certain windows (#89)
The clipboard does not get recorded when the title of the currently active
window matches the regular expression in CM_IGNORE_WINDOW. This allows copying
passwords from a password manager without the passwords ending up in clipmenu.

The matching is not 100% exact however, as there is a race condition between the
time the clipboard is populated, clipmenu queries the clipboard, and the active
window gets queried. This race condition can be especially problematic when
using polling with large intervals instead of clipnotify.
2018-11-08 16:39:18 +00:00
Chris Down f748a2e5a6 Make timeout optional 2018-11-01 00:35:38 +00:00
Chris Down 7c3bd5060a Do $PATH lookup for bash 2018-10-31 08:12:09 +00:00
Chris Down d76b716d9f Sort environment variables in --help 2018-08-21 15:39:17 -04:00
Chris Down 4a3862666f Always send xsel logfile to /dev/null
We don't want this logging to disk, but /dev/stderr doesn't always work
(see #81). Let's just stop all logging to avoid more shenanigans.
2018-05-10 17:13:46 +01:00
Chris Down 44545be18e Canonicalise missing elements in readlink
Fixes #81.
2018-05-09 13:02:54 +01:00
Gravemind 95cf774b0d Fix wrong file deleted after partial selection (#76)
It was deleting the file before the partial selection because
`last_filename` was saved before filename was actually ready (so was
actually saving the one before the last).

Fixes #75.
2018-04-19 11:00:21 +01:00
Chris Down 486dbe31fa Recover without restarting if we deleted the entire clip directory 2018-03-11 20:21:00 -04:00
Chris Down fa9d01a752 Don't populate ${last_data[any]}
Fixes #67. This used to be useful in order to avoid doing multiple
writes back when we didn't deduplicate in clipmenu client, but now we do
and don't need this. Even more impressively, it actually breaks things!
See #67 for more information.
2018-03-08 22:32:43 -08:00
Chris Down a93cc27b65 Add nanosecond resolution to cache file output
Possibly related to #62.
2018-02-21 17:23:07 +00:00
Chris Down 44d7baa27a Have CM_MAX_CLIPS understand new version 5 format 2018-02-20 11:36:00 +00:00
Chris Down ee0a6f6d31 Add shellcheck disable for CM_SELECTIONS 2018-02-20 11:31:08 +00:00
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