Commit graph

269 commits

Author SHA1 Message Date
speedie 0337a03c30 Fix makefile 2023-07-06 00:47:33 +02:00
speedie bc41cecd85 some improvements 2023-07-05 18:17:00 +02:00
Jacob ad6dbee3f7 make sure the directory exists 2023-06-20 15:14:43 +00:00
speedie 817fb0f66e add pkgbuild 2023-04-08 01:13:55 +02:00
speedie 87c4102aac add spmenu compat 2023-04-08 00:57:55 +02:00
Chris Down 9735907061 Remove travis infrastructure
This is long dead, we need to eventually migrate to GH Actions.
2023-04-04 08:11:36 +01:00
Rob Pilling 87e1641b50 Handle syncing clipboard to primary 2022-08-12 19:19:29 +01:00
Chris Down 920c23b3cb Only back off if _CM_TRAP is not set
Otherwise wait could return from the signal.
2022-04-14 17:29:45 +01:00
Navneet Aman 607a2f1127
Back off if clipnotify fails
This probably means the X server is gone, so avoid spinning uselessly.
2022-04-14 16:17:22 +01:00
Chris Down b30c01dbe3 clipmenud: Touch cache file at startup
May fix #182.
2022-03-15 18:50:47 +00:00
Chris Down 04b71fb7a9 rofi: Pass -p in dmenu mode
-p wastes space in real dmenu, but rofi shows "dmenu:" by default
anyway, so it seems worth passing.

Closes #177.
2021-12-19 01:39:30 +00:00
Matthew White bc35b6f44a clipmenud: Fix killing background jobs when there are multiple
`jobs -p' should be read into an array, as it might contain more than
one job.

[cdown: squash, massage changelog, remove space between local/readarray]
2021-11-21 12:24:25 +00:00
Matthew White 775adccfb4 clipmenud: print message when disabling but already disabled
Print a specific message when receiving a disable signal but already
disabled, as it's done for when enabling but already enabled.
2021-11-21 00:33:18 +00:00
Matthew White 5c53e5f1cd clipmenud: prevent another clipnotify job when trapping a signal
Since trapping a signal breaks `wait $_CM_CLIPNOTIFY_PID` w/o killing
the clipnotify job, call kill_background_jobs before restarting the
loop.  This prevents `clipctl enable` from spawning another job.
2021-11-21 00:33:18 +00:00
Matthew White 74c479fa2f clipdel: allow ".*" to print the cache directory to be deleted
Before doing an irreversible action via the option -d, allow the
pattern ".*" to print which cache directory will be deleted.
2021-11-20 23:58:10 +00:00
Axel Dahlberg a3f0897aee Create status file after cache directory 2021-02-11 20:52:27 +00:00
Chris Down 333ebc513d clipctl: Fix tests
We now use clipctl in tests and must account for using the local
version.
2021-01-29 01:22:21 +00:00
Axel Dahlberg 17823bacea
Added commands to clipctl to check the status, toggle, get version and directory (#152) 2021-01-21 15:15:00 +00:00
Sami Kankaristo 25219b787c Use default value instead of testing for empty value 2020-12-19 16:26:01 +00:00
Sami Kankaristo e278d9d3d4 Only set $launcher_exit if not running rofi-script
Only set `$launcher_exit` if not running rofi-script, and only exit using `$launcher_exit` if it has been set. Otherwise, the last line (now with quoting around the variable) becomes `exit ""`, which causes an error.
2020-12-19 16:26:01 +00:00
Sami Kankaristo 8c864ac5df Preserve exit code from launcher
This change is related to https://github.com/cdown/clipmenu/issues/57#issuecomment-740123283.

If `clipmenu` "preserves" the exit code from the launcher (exits with the same code as the launcher), the exit code's from Rofi's custom keybindings can be used with `clipmenu`.

For example, I'm using the following script bound to `Super+v`:
```
#!/bin/bash

trap "exit" INT

# Run clipmenu
CM_LAUNCHER=rofi clipmenu -p "Paste" -mesg "Use Shift+Delete to delete an item" \
    -kb-delete-entry "" -kb-custom-1 "Shift+Delete" \
    -kb-accept-alt "" -kb-custom-2 "Shift+Return"

exit_code=$?

case $exit_code in
    0) xdotool key "shift+Insert" ;;
    10) clipdel -d ^"$(xsel -b)"$; "$0" ;;
    *) exit $exit_code ;;
esac
```

With the above script, I have 3 different options when running `clipmenu`:
- if I press `Return`, the selected item is pasted to where my cursor currently is (a bit hackily with `xdotool`)
- if I press `Shift+Return`, the selected item is sent to the clipboard ("default" `clipmenu` behavior)
- if I press `Shift+Delete`, the selected item is deleted from `clipmenu`, and the script runs itself again (essentially keeps `clipmenu` open)

In order for this to work, the only change needed in `clipmenu` is to preserve the exit codes from the custom keybindings.
2020-12-19 16:26:01 +00:00
Ferenc Erki a882cf9732 Sync primary to clipboard immediately 2020-11-03 12:05:27 +00:00
Chris Down 9d0da2f7d4 clipmenu: Don't mask -h
Fixes #142.
2020-10-19 01:54:31 +01:00
Chris Down 764984c982 clipmenu: Explicitly handle no $cache_file case 2020-10-17 00:58:20 +01:00
Chris Down 8538e01e5c readme: Add information about $DISPLAY 2020-10-17 00:48:18 +01:00
Chris Down 7c34ace1fb Merge branch 'release/6.2.0' into master 2020-10-14 14:13:09 +01:00
Chris Down 9c7f1b9bf3 clipmenud: Don't assume that we're the process group leader
We usually are, but this is more robust in light of #139.
2020-10-14 14:07:36 +01:00
Chris Down 53215efd83 init: Add TimeoutStopSec 2020-10-14 14:07:36 +01:00
Chris Down f3f7af50a0
Merge pull request #135 from Mic92/makefile
Makefile: install into PREFIX
2020-08-03 11:40:15 +01:00
Jörg Thalheim 443b58583e
Makefile: install into PREFIX 2020-07-31 06:40:34 +01:00
Chris Down 64661dffbf clipdel: Recreate cache_dir
After 80b697edd2, this is required.

Fixes #133.
2020-07-11 12:57:09 +01:00
Chris Down 358f796d4c init: Don't set $DISPLAY
Nowadays the desktop pushes the appropriate DISPLAY and WAYLAND_DISPLAY
values into the per-user systemd environment, so this isn't needed.

Also see #131.
2020-06-09 15:20:57 +01:00
Chris Down ee11a09fb0 Add $DISPLAY check
Fixes #131.
2020-06-09 14:20:17 +01:00
Chris Down 0011a2c3b9 Merge branch 'release/6.1.0' 2020-06-03 22:09:03 +01:00
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