aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-09-20 07:51:23 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-09-20 07:51:23 +0200
commitda1fafa505615d759e97d526326a152762a40573 (patch)
tree1f9092797d85a062fde6846c3af0c155b89abf63 /.local
parent52123415276f6eab7f9134a2db9e67d1d1d6ccc5 (diff)
Update media key utils
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/bl22
-rwxr-xr-x.local/bin/vol2
2 files changed, 20 insertions, 4 deletions
diff --git a/.local/bin/bl b/.local/bin/bl
index da1980e..7090f01 100755
--- a/.local/bin/bl
+++ b/.local/bin/bl
@@ -29,13 +29,19 @@ main()
case "$1" in
inc)
- xbacklight -inc ${2:-5}
+ brightnessctl set +${2:-5}%
notify="Brightness increased to $(brightness_level)%"
;;
dec)
- xbacklight -dec ${2:-5}
+ brightnessctl set -${2:-5}%
notify="Brightness lowered to $(brightness_level)%"
;;
+ set)
+ [ -z "$2" ] && usage && exit 1
+
+ brightnessctl set $2%
+ notify="Brightness set to $(brightness_level)%"
+ ;;
esac
notify-send -n 57492 -s -t 2 -i "$(brightness_icon)" "Backlight" "$notify"
@@ -43,7 +49,7 @@ main()
brightness_level()
{
- xbacklight -get
+ awk "BEGIN { printf(\"%d\", ($(brightnessctl get) / $(brightnessctl max)) * 100) }"
}
brightness_icon()
@@ -61,8 +67,16 @@ usage()
cat <<EOF
Usage:
${0##*/} -h
+ ${0##*/} inc [level]
+ ${0##*/} dec [level]
+ ${0##*/} set <level>
+
+Alter the backlight intensity.
-Nondescript
+Subcommands:
+ inc Increase the volume by level, defaults to 5.
+ dec Decrease the volume by level, defaults to 5.
+ set Set the volume to level.
Options:
-h Show this help text and exit.
diff --git a/.local/bin/vol b/.local/bin/vol
index 8993689..84c913e 100755
--- a/.local/bin/vol
+++ b/.local/bin/vol
@@ -40,6 +40,8 @@ main()
notify="Decreased '$DEFAULT_SINK_NAME' ($DEFAULT_SINK_INDEX) to $(volume_level)%"
;;
set)
+ [ -z "$2" ] && usage && exit 1
+
pactl set-sink-volume @DEFAULT_SINK@ $2% > /dev/null
notify="Set '$DEFAULT_SINK_NAME' ($DEFAULT_SINK_INDEX) to $(volume_level)%"
;;