Skip to content

Commit

Permalink
Implemented backlight up and down for dmenu_bl
Browse files Browse the repository at this point in the history
  • Loading branch information
Aario Shahbany committed Mar 6, 2017
1 parent 66dff0a commit 16f26f2
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion dmenu_bl
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
#!/bin/bash
function get_backlight() {
xbacklight | cut -d '.' -f 1
}

function set_backlight() {
xbacklight -set $1
}

function change_backlight() {
xbacklight -time 0 $@
}

bl_menu() {
current_bl=`xbacklight | cut -d '.' -f 1`
current_bl=`get_backlight`
let "current_bl=$current_bl / 5"
{ echo "*"; for i in {1..19}; do echo "-"; done; echo "*"; } | dmenu -r -n -k -l 0 -p "BRIGHTNESS:" -d $current_bl $menu_params
}

if [ $# -eq 1 ]; then
if [ $1 == '--backlightdown' ]; then
change_backlight -dec 10
exit 0
fi

if [ $1 == '--backlightup' ]; then
change_backlight -inc 10
exit 0
fi
fi

export -f get_backlight
export -f bl_menu
export menu_params="$@"

Expand Down

0 comments on commit 16f26f2

Please sign in to comment.