Skip to content

Commit

Permalink
Add media key utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
A committed May 30, 2020
1 parent e139354 commit 971b43b
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 5 deletions.
16 changes: 16 additions & 0 deletions packages/utils-media-keys/README.md
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions packages/utils-media-keys/backlight
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions packages/utils-media-keys/notify-backlight
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
msgId="991049"

VALUE=`xbacklight -getf`

dunstify -u low -r "$msgId" "Backlight: `printf "%.4f\n" $VALUE`%"
File renamed without changes.
2 changes: 2 additions & 0 deletions packages/utils-media-keys/udev/rules/backlight.rules
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 0 additions & 5 deletions packages/utils-notify-volume/README.md

This file was deleted.

0 comments on commit 971b43b

Please sign in to comment.