Commit graph

235 commits

Author SHA1 Message Date
Chris Down 2677932c56 clipmenud: Check cache file existence before vacuuming
Fixes #123.
2020-04-03 12:29:00 +01:00
Chris Down e7e8425c3b clipmenud: Replace empty values for CM_DIR/CM_MAX_CLIPS/CM_SELECTIONS
Empty strings for these are not useful. Related to #123.
2020-04-03 12:28:21 +01:00
Chris Down 618327d545
Merge pull request #91 from ferki/pipe_to_clipdel
clipdel: Support getting pattern from standard input
2020-04-01 10:36:18 +01:00
Ferenc Erki fdf156ef2f clipdel: Support getting pattern from standard input 2020-04-01 08:51:52 +02:00
Chris Down 03c5e9441a tests: Set EXIT trap to show temp contents 2020-03-30 19:20:39 +01:00
Chris Down 11c48727d3 clipmenu: Preserve ordering of arguments for rofi -dmenu 2020-03-30 19:20:39 +01:00
Chris Down e3e3289c9a readme: List supported launchers 2020-03-30 19:13:26 +01:00
Chris Down 5110fed19c clipmenu: Add support for CM_LAUNCHER=fzf
Closes #122.
2020-03-30 17:18:29 +01:00
Ferenc Erki 6612ade8b0 clipdel: Remove legacy comments 2020-03-29 20:18:40 +02:00
Chris Down 9c16837227 clipctl: Make pgrep regex less taxing
For some reason, .* is really taxing for pgrep, but if you remove it
it's way faster...

    % \time -v pgrep -nf '.*clipmenud$'
    325286
	    Command being timed: "pgrep -nf .*clipmenud$"
	    User time (seconds): 0.83
	    System time (seconds): 0.00
	    Percent of CPU this job got: 100%
	    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.83
	    Average shared text size (kbytes): 0
	    Average unshared data size (kbytes): 0
	    Average stack size (kbytes): 0
	    Average total size (kbytes): 0
	    Maximum resident set size (kbytes): 7632
	    Average resident set size (kbytes): 0
	    Major (requiring I/O) page faults: 0
	    Minor (reclaiming a frame) page faults: 1418
	    Voluntary context switches: 1
	    Involuntary context switches: 3
	    Swaps: 0
	    File system inputs: 0
	    File system outputs: 0
	    Socket messages sent: 0
	    Socket messages received: 0
	    Signals delivered: 0
	    Page size (bytes): 4096
	    Exit status: 0
    % \time -v pgrep -nf 'clipmenud$'
    325286
	    Command being timed: "pgrep -nf clipmenud$"
	    User time (seconds): 0.04
	    System time (seconds): 0.00
	    Percent of CPU this job got: 100%
	    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.04
	    Average shared text size (kbytes): 0
	    Average unshared data size (kbytes): 0
	    Average stack size (kbytes): 0
	    Average total size (kbytes): 0
	    Maximum resident set size (kbytes): 7320
	    Average resident set size (kbytes): 0
	    Major (requiring I/O) page faults: 0
	    Minor (reclaiming a frame) page faults: 1257
	    Voluntary context switches: 1
	    Involuntary context switches: 7
	    Swaps: 0
	    File system inputs: 0
	    File system outputs: 0
	    Socket messages sent: 0
	    Socket messages received: 0
	    Signals delivered: 0
	    Page size (bytes): 4096
	    Exit status: 0
2020-03-28 14:12:49 +00:00
Chris Down fc7f47f81f clipmenud: Store the last data on reenabling 2020-03-26 00:35:31 +00:00
Chris Down 058515d8ef makefile: Install clipctl 2020-03-25 19:22:22 +00:00
Chris Down c4a9071b3e readme: Tersify and use British English
We also don't explain too much about systemd -- you're expected to find
out or know about that agnostically of this project.

Also some features that we don't really want to advertise super widely
are not worth mentioning here.
2020-03-25 19:13:22 +00:00
Chris Down 84fd3614ab clipmenud: Allow disable with USR1 and enable with USR2
This allows avoiding having to delete after the fact for things like
issues #57 and #98.

Why have this over just stopping clipmenud? Well:

1. Stopping clipmenud should usually be an init system action, but we
   are init-system agnostic. If we just exit, we don't have a way of
   reliably starting again.
2. Even if we *do* do it using the init system, we don't want some
   things (like a lingering xsel which owns the selection for
   CM_OWN_CLIPBOARD) being killed as well.
3. This is a nicer interface for things like password managers to stop
   clipmenu rather than stopping clipmenu entirely.
2020-03-25 19:13:22 +00:00
Chris Down 5379860679
Merge pull request #108 from jb55/print-selection
clipmenu: print selection to stdout
2020-03-25 01:02:40 +00:00
William Casarin 630e7a016c clipmenu: print selection to stdout
This allows you to use clipmenu in desktop scripts. For example you
could pipe the output of your narrowed selection to another command.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-03-24 18:00:20 -07:00
Chris Down 1368ec7a2a
Merge pull request #121 from markstos/doc-clipmenud-options
document options for clipmenu
2020-03-24 20:33:15 +00:00
Mark Stosberg 64e3c97c0c document options for clipmenu
For privacy considerations, it's important to know about the max
clip option.

Users could also use a hint about how to cleanly override environment
variables with systemd.
2020-03-24 16:26:03 -04:00
Chris Down d0ef9dfccf
Merge pull request #120 from markstos/make-install
Improve manual install experience
2020-03-24 20:04:07 +00:00
Mark Stosberg a3916b8e11 Improve manual install experience
- Add Makefile to install files
   - It even checks for required binaries
 - Document manual install steps
 - Document how to start and enable via systemd
2020-03-24 15:30:40 -04:00
Chris Down bcbe7b1445 Merge branch 'release/6.0.1' 2020-03-24 17:39:33 +00:00
Chris Down d24b57c9db clipmenud: Fix potential misaligned truncation in duplicate detection
If we detect a duplicate for this selection, but another selection has
already been written, we will truncate the wrong length in the line.
2020-03-24 17:36:30 +00:00
Chris Down 5b596aaf46 clipmenu: Tidy chosen_line 2020-03-24 13:52:01 +00:00
Chris Down c0155ab7b6 clipmenu: Remove cache printout, with vacuuming this can't be hit 2020-03-24 13:50:11 +00:00
Chris Down f26813c184 clipmenu: Use last-arg syntax that keeps shellcheck happy 2020-03-24 13:49:44 +00:00
Chris Down 7a00f8cf17 clipmenu: Tersify rofi check 2020-03-24 13:49:38 +00:00
Chris Down 940bd8e963 Merge branch 'release/6.0.0' 2020-03-24 01:17:34 +00:00
Chris Down afb2f7ce2f clipmenud: Remove weird extra line in --help 2020-03-24 01:11:02 +00:00
Chris Down 2ffa909d79 clipmenud: Vacuum every 10 clips
This is much less expensive now, we can do it more often.
2020-03-24 00:52:47 +00:00
Chris Down 4528da5e68 readme: Remove out of date information
CM_SLEEP is gone, and we don't have non-clipnotify behaviour any more.
2020-03-23 18:16:22 +00:00
Chris Down a95b727d3b clipmenud: Remove not very useful vacuuming debug message 2020-03-23 17:57:22 +00:00
Chris Down 7aed22e1a7 clipmenud: $cache_file must exist by vacuum time 2020-03-23 17:55:06 +00:00
Chris Down be7dcfb4db clipmenu: Since we don't reuse line content, don't store it 2020-03-23 17:52:57 +00:00
Chris Down f9ab57522d clipmenud: Remove timeout_cmd, we already rely on coreutils for truncate 2020-03-23 17:50:43 +00:00
Chris Down da1ccb7c70 get_first_line: Simplify END logic 2020-03-23 17:45:48 +00:00
Chris Down a9fb4c9823 Remove CM_ONESHOT debug message, it has never been useful 2020-03-23 17:41:50 +00:00
Chris Down a090177497 get_first_line: We never set line_length_limit, just make it static 2020-03-23 17:40:13 +00:00
Chris Down b4d001149c clipmenud: Remove some debug messages which have never been useful 2020-03-23 17:23:36 +00:00
Chris Down f8658b0d00 clipmenud: Colocate related variables and comments 2020-03-23 17:20:30 +00:00
Chris Down 4770e52cf3 clipmenud: Update comment for CM_OWN_CLIPBOARD, we don't use element_in 2020-03-23 17:15:52 +00:00
Chris Down 2aae4989af clipmenud: Colocate similar functions 2020-03-23 17:14:01 +00:00
Chris Down 80b697edd2 clipmenud: Don't mkdir cache_dir again
If someone deletes the dir, they must restart clipmenud.
2020-03-23 17:11:04 +00:00
Chris Down 228fcbdd0d clipmenud: Tidy up some old, too-verbose comments 2020-03-23 17:10:43 +00:00
Chris Down 9e672cf0a5 Make clipnotify mandatory
The old sleep method is basically untested and unmaintained. Make it
official.
2020-03-23 17:05:59 +00:00
Chris Down 8de3d7a9c5 Check clipboard selection for ownership explicitly
We no longer need to do the element_in checks, just do it for this
selection when it runs.
2020-03-23 17:02:59 +00:00
Chris Down 099aeb3e22 Print out number of vacuumed files 2020-03-23 16:25:00 +00:00
Chris Down ea3ccea514 clipmenud: Mention selection used for possible partials 2020-03-23 16:01:11 +00:00
Chris Down 879854975e Run CM_MAX_CLIPS handling/vacuuming out of selection loop 2020-03-23 15:59:42 +00:00
Chris Down bbf495c147 Add async vacuum support
This makes sure that, for all cases, we don't end up ever dereferencing
a still referenced clip.
2020-03-23 13:00:14 +00:00
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