initial commit
This commit is contained in:
commit
b39b82463b
13 changed files with 214 additions and 0 deletions
23
brght
Executable file
23
brght
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=simplifies the brightnessctl command
|
||||
set -E -o pipefail
|
||||
|
||||
# when invoked without parameter will print current brightness in percent
|
||||
# it accepts a parameter from 0 to 100 for brightness. Please ommit the % symbol.
|
||||
|
||||
if [[ "$1" == "--toggle" ]]; then
|
||||
if [[ "$(brightnessctl get)" == "0" ]]; then
|
||||
brightnessctl --restore || brightnessctl set '50%' # just in case --restore fails
|
||||
else
|
||||
brightnessctl --save && brightnessctl set 0
|
||||
fi
|
||||
exit 0 # if toggle is used don't continue
|
||||
fi
|
||||
|
||||
# default path
|
||||
percentage(){ brightnessctl -m | cut -d',' -f4; }
|
||||
printf "current: "; percentage
|
||||
if [[ -n "$1" ]]; then
|
||||
brightnessctl set "$1\%" > /dev/null
|
||||
printf "now: "; percentage
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue