diff --git a/packages/utils-media-keys/README.md b/packages/utils-media-keys/README.md new file mode 100644 index 0000000..bb4a064 --- /dev/null +++ b/packages/utils-media-keys/README.md @@ -0,0 +1,16 @@ +# Media Keys Handlers + +## Scripts + +- `backlight` custom backlight control script for acpilight/xbacklight backend + +## Notifications + +Notification wrappers are bounded to dunst notification daemon. + +- `notify-backlight` - shows current backlight value +- `notify-volume` - shows volume state, depends on pulseaudio + +## UDEV Rules + +- `backlight.rules` - puts /sys/class/backlight under `video` group diff --git a/packages/utils-media-keys/backlight b/packages/utils-media-keys/backlight new file mode 100755 index 0000000..a63f0d0 --- /dev/null +++ b/packages/utils-media-keys/backlight @@ -0,0 +1,28 @@ +#!/bin/bash + +cur=`xbacklight -get | grep -o "^[0-9]*"`; + +case $1 in + --inc) + if [ "$cur" -gt "20" ]; then + xbacklight -inc 10 + else + if [ "$cur" -gt "2" ]; then + xbacklight -inc 1 + else + xbacklight -inc 0.1 + fi + fi + ;; + --dec) + if [ "$cur" -gt "20" ]; then + xbacklight -dec 10 + else + if [ "$cur" -gt "2" ]; then + xbacklight -dec 1 + else + xbacklight -dec 0.1 + fi + fi + ;; +esac diff --git a/packages/utils-notify-volume/install b/packages/utils-media-keys/install similarity index 78% rename from packages/utils-notify-volume/install rename to packages/utils-media-keys/install index a6ad52c..e951b62 100755 --- a/packages/utils-notify-volume/install +++ b/packages/utils-media-keys/install @@ -13,4 +13,6 @@ for FILE in $FILES; do ln -nsf "$FILE" "$BIN_DIR" done; +sudo cp "$WORKING_DIR/udev/rules/backlight.rules" "/etc/udev/rules.d/" + exit 0 diff --git a/packages/utils-media-keys/notify-backlight b/packages/utils-media-keys/notify-backlight new file mode 100755 index 0000000..db85a6d --- /dev/null +++ b/packages/utils-media-keys/notify-backlight @@ -0,0 +1,6 @@ +#!/bin/bash +msgId="991049" + +VALUE=`xbacklight -getf` + +dunstify -u low -r "$msgId" "Backlight: `printf "%.4f\n" $VALUE`%" diff --git a/packages/utils-notify-volume/notify-volume b/packages/utils-media-keys/notify-volume similarity index 100% rename from packages/utils-notify-volume/notify-volume rename to packages/utils-media-keys/notify-volume diff --git a/packages/utils-media-keys/udev/rules/backlight.rules b/packages/utils-media-keys/udev/rules/backlight.rules new file mode 100644 index 0000000..09457bb --- /dev/null +++ b/packages/utils-media-keys/udev/rules/backlight.rules @@ -0,0 +1,2 @@ +ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness" +ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness" diff --git a/packages/utils-notify-volume/README.md b/packages/utils-notify-volume/README.md deleted file mode 100644 index 995fbd0..0000000 --- a/packages/utils-notify-volume/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Volume Change Notifications - -Shows either current volume or is it muted. -Depends on dunstify and pulseaudio. -