-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
4 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ -z $1 ]] || [[ $1 == --help ]] || [[ $1 == -h ]]; then | ||
cat << 'EOF' | ||
clipctl provides controls for the clipmenud daemon. | ||
You can temporarily disable clip collection without stopping clipmenud entirely | ||
by running "clipctl disable". You can then reenable with "clipctl enable". | ||
EOF | ||
exit 0 | ||
fi | ||
|
||
_CLIPMENUD_PID=$(pgrep -u "$(id -u)" -nf '.*/?clipmenud$') | ||
|
||
if [[ -z "$_CLIPMENUD_PID" ]]; then | ||
echo "clipmenud is not running" | ||
exit 2 | ||
fi | ||
|
||
case $1 in | ||
enable) kill -USR2 "$_CLIPMENUD_PID" ;; | ||
disable) kill -USR1 "$_CLIPMENUD_PID" ;; | ||
*) | ||
printf 'Unknown command: %s\n' "$1" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters