picom-trans: Add inline `--help` output and update manpage

Fixes: #513
This commit is contained in:
Bernd Busse 2020-10-22 22:48:59 +02:00
parent 8f78b9b631
commit c9ccd8fb71
No known key found for this signature in database
GPG Key ID: 6DD2A3C48E63A5AB
2 changed files with 55 additions and 8 deletions

View File

@ -23,6 +23,26 @@
# $ picom-trans -c --delete
# Reset all windows
# $ picom-trans --reset
print_usage() {
echo "Usage: $0 [options] [+|-]opacity"
echo ""
echo "Options:"
echo " -h, --help Print this help message."
echo " -o, --opacity OPACITY Specify the new opacity value in range 1-100 for the window. If"
echo " prefixed with + or -, increment or decrement from the target"
echo " windows current opacity."
echo ""
echo "Actions:"
echo " -g, --get Print the target window's opacity."
echo " -d, --delete Delete opacity of the target window."
echo " -r, --reset Reset opacity for all windows."
echo ""
echo "Window Selection:"
echo " -s, --select Select target window with mouse cursor. (DEFAULT)"
echo " -c, --current Select the currently active window as target."
echo " -n, --name WINDOW_NAME Specify and try to match a window name."
echo " -w, --window WINDOW_ID Specify the window id of the target window."
}
case "$0" in
*compton-trans*) echo "Warning: compton has been renamed, please use picom-trans instead" >& 2;;
@ -34,6 +54,11 @@ if test -z "$(command -v xprop)" -o -z "$(command -v xwininfo)"; then
exit 1
fi
if test $# -eq 0; then
print_usage >& 2
exit 1
fi
# Variables
active=
wprefix=
@ -62,10 +87,10 @@ while test $# -gt 0; do
OPTIND=1
# Read options
while getopts 'scrdgn:w:o:-:' option "$@"; do
while getopts 'hscrdgn:w:o:-:' option "$@"; do
if test "$option" = '-'; then
case "$OPTARG" in
select | current | reset | delete | get)
help | select | current | reset | delete | get)
v=''
;;
name | window | opacity)
@ -84,6 +109,7 @@ while test $# -gt 0; do
OPTARG=$v
fi
case "$option" in
h) print_usage; exit 0 ;;
s) wprefix=''; window='' ;;
c)
active=$(xprop -root -notype _NET_ACTIVE_WINDOW \

View File

@ -21,20 +21,29 @@ DESCRIPTION
OPTIONS
-------
*-w* 'WINDOW_ID'::
*-w*, *--window*='WINDOW_ID'::
Specify the window id of the target window.
*-n* 'WINDOW_NAME'::
*-n*, *--name*='WINDOW_NAME'::
Specify and try to match a window name.
*-c*::
*-c*, *--current*::
Specify the currently active window as target. Only works if EWMH '_NET_ACTIVE_WINDOW' property exists on root window.
*-s*::
*-s*, *--select*::
Select target window with mouse cursor. This is the default if no window has been specified.
*-o* 'OPACITY'::
Specify the new opacity value for the window. This value can be anywhere from 1-100. If it is prefixed with a plus or minus (+/-), this will increment or decrement from the target window's current opacity instead.
*-o*, *--opacity*='OPACITY'::
Specify the new opacity value for the window. This value can be anywhere from 1-100. If it is prefixed with a plus or minus (+/-), this will increment or decrement from the target window's current opacity instead.
*-g*, *--get*::
Print the target window's opacity instead of setting it.
*-d*, *--delete*::
Delete opacity of the target window instead of setting it.
*-r*, *--reset*::
Reset opacity for all windows instead of setting it.
EXAMPLES
--------
@ -75,6 +84,18 @@ picom-trans -c +5
picom-trans -c -- -5
------------
* Delete current window's opacity:
+
------------
picom-trans -c --delete
------------
* Reset all windows:
+
------------
picom-trans --reset
------------
BUGS
----
Please submit bug reports to <https://github.com/yshui/picom>.