1
0
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:
Joe Groocock 2016-12-04 13:58:25 +00:00
parent c1480498c1
commit 9433c26d62
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
4 changed files with 28 additions and 2 deletions

21
.config/i3/blocks/backlight Executable file
View 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

View File

@ -75,8 +75,6 @@ switch($ENV{BLOCK_BUTTON} || 0) {
} }
} }
} }
case "4" { system("light -U -l 1") }
case "5" { system("light -A -l 1") }
} }

View File

@ -77,6 +77,11 @@ interval=10
label= label=
interval=10 interval=10
[backlight]
label=
interval=30
signal=12
[separator] [separator]
[rotation] [rotation]

View File

@ -160,6 +160,8 @@ bindsym XF86AudioPause exec --no-startup-id mpc pause
bindsym XF86AudioStop exec --no-startup-id mpc stop bindsym XF86AudioStop exec --no-startup-id mpc stop
bindsym XF86AudioNext exec --no-startup-id mpc next bindsym XF86AudioNext exec --no-startup-id mpc next
bindsym XF86AudioPrev exec --no-startup-id mpc previous bindsym XF86AudioPrev exec --no-startup-id mpc previous
bindsym XF86MonBrightnessUp exec xbacklight -inc 5 && pkill -RTMIN+12 i3blocks
bindsym XF86MonBrightnessDown exec xbacklight -dec 5 && pkill -RTMIN+12 i3blocks
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% && pkill -RTMIN+10 i3blocks bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% && pkill -RTMIN+10 i3blocks
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% && pkill -RTMIN+10 i3blocks bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% && pkill -RTMIN+10 i3blocks
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+10 i3blocks bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+10 i3blocks