mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
Add backlight control to i3
This commit is contained in:
21
.config/i3/blocks/backlight
Executable file
21
.config/i3/blocks/backlight
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set how much you want the brightness to change
|
||||
DELTA=2
|
||||
|
||||
# Get the current light level, rounded to an integer
|
||||
LIGHT=$(printf '%.*f' 0 $(xbacklight -get))
|
||||
NEW_LIGHT=$LIGHT
|
||||
|
||||
# If called from i3blocks, and scrolling, then change light level
|
||||
case $BLOCK_BUTTON in
|
||||
5) NEW_LIGHT=$(expr $LIGHT + $DELTA) ;;
|
||||
4) NEW_LIGHT=$(expr $LIGHT - $DELTA) ;;
|
||||
esac
|
||||
|
||||
xbacklight -set $NEW_LIGHT -time 0 -steps 1
|
||||
|
||||
# Output the new light level
|
||||
OUTPUT=$(printf '%.*f%%' 0 $(xbacklight -get))
|
||||
echo $OUTPUT
|
||||
echo $OUTPUT
|
@ -75,8 +75,6 @@ switch($ENV{BLOCK_BUTTON} || 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
case "4" { system("light -U -l 1") }
|
||||
case "5" { system("light -A -l 1") }
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,6 +77,11 @@ interval=10
|
||||
label=
|
||||
interval=10
|
||||
|
||||
[backlight]
|
||||
label=
|
||||
interval=30
|
||||
signal=12
|
||||
|
||||
[separator]
|
||||
|
||||
[rotation]
|
||||
|
Reference in New Issue
Block a user