clipctl (647B)
1 #!/usr/bin/env bash 2 3 if [[ -z $1 ]] || [[ $1 == --help ]] || [[ $1 == -h ]]; then 4 cat << 'EOF' 5 clipctl provides controls for the clipmenud daemon. 6 7 You can temporarily disable clip collection without stopping clipmenud entirely 8 by running "clipctl disable". You can then reenable with "clipctl enable". 9 EOF 10 exit 0 11 fi 12 13 _CLIPMENUD_PID=$(pgrep -u "$(id -u)" -nf 'clipmenud$') 14 15 if [[ -z "$_CLIPMENUD_PID" ]]; then 16 echo "clipmenud is not running" 17 exit 2 18 fi 19 20 case $1 in 21 enable) kill -USR2 "$_CLIPMENUD_PID" ;; 22 disable) kill -USR1 "$_CLIPMENUD_PID" ;; 23 *) 24 printf 'Unknown command: %s\n' "$1" 25 exit 1 26 ;; 27 esac