diff options
author | P. J. McDermott <pj@pehjota.net> | 2018-05-19 02:13:42 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2018-05-19 02:13:42 (EDT) |
commit | 54673d5a56a6da7b124e35d96a474e24192952ca (patch) | |
tree | 275787ff7871742fddc77e4ce8ec9c19f09ca418 /bin | |
parent | 8df79b320c4855ec563578c4f895c2eb0317489b (diff) | |
download | fluxbox-54673d5a56a6da7b124e35d96a474e24192952ca.zip fluxbox-54673d5a56a6da7b124e35d96a474e24192952ca.tar.gz fluxbox-54673d5a56a6da7b124e35d96a474e24192952ca.tar.bz2 |
bin/bright: Add a toggle feature
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bright | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -39,6 +39,21 @@ inc_b() set_b ${b} } +tog_b() +{ + local b= + + b=$(get_b) + case ${b} in + [0-9] | [1-4][0-9]) + set_b 100;; + [5-9][0-9] | 100) + set_b 0;; + esac + + return 0 +} + usage() { printf 'Usage: %s {<direction>|<value>}\n' "${0}" @@ -46,6 +61,7 @@ usage() printf 'Where <direction> is any word beginning with (in any case):\n' printf ' * "U" for up\n' printf ' * "D" for down\n' + printf ' * "T" for toggle (between 0 and 100)\n' printf 'And <value> is any integer between 0 and 100 inclusive\n' return 0 @@ -66,6 +82,7 @@ main() case "${dir}" in [Uu]*) inc_b 20;; [Dd]*) inc_b -20;; + [Tt]*) tog_b;; *[!0-9]* | '') usage 1>&2 return 1 |