summaryrefslogtreecommitdiffstats
path: root/bin/bright
diff options
context:
space:
mode:
authorP. 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)
commit54673d5a56a6da7b124e35d96a474e24192952ca (patch)
tree275787ff7871742fddc77e4ce8ec9c19f09ca418 /bin/bright
parent8df79b320c4855ec563578c4f895c2eb0317489b (diff)
downloadfluxbox-54673d5a56a6da7b124e35d96a474e24192952ca.zip
fluxbox-54673d5a56a6da7b124e35d96a474e24192952ca.tar.gz
fluxbox-54673d5a56a6da7b124e35d96a474e24192952ca.tar.bz2
bin/bright: Add a toggle feature
Diffstat (limited to 'bin/bright')
-rwxr-xr-xbin/bright17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/bright b/bin/bright
index 04c83f5..bda2643 100755
--- a/bin/bright
+++ b/bin/bright
@@ -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