Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lurwas/985fbe43900fbf2b7dba7208bfed208f to your computer and use it in GitHub Desktop.
Save lurwas/985fbe43900fbf2b7dba7208bfed208f to your computer and use it in GitHub Desktop.
Adjust Oled brightness settings for Dell XPS 7590 (intel drivers)
#!/bin/bash
BRIGHT=`cat brightness.txt`
if [ "$1" = '+' ]; then
echo "+"
NEWBRIGHT=$(echo "$BRIGHT + 0.05" | bc)
if [ "$(echo "$NEWBRIGHT > 1.0" | bc)" -eq 1 ]; then
NEWBRIGHT='1.0'
fi
elif [ "$1" = '-' ]; then
echo "-"
NEWBRIGHT=$(echo "$BRIGHT - 0.05" | bc)
if [ "$(echo "$NEWBRIGHT < 0.0" | bc)" -eq 1 ]; then
NEWBRIGHT='0.0'
fi
fi
echo "${NEWBRIGHT}"
`xrandr --output eDP-1 --brightness $NEWBRIGHT`
echo "$NEWBRIGHT" > brightness.txt
From i3wm config file:
"
...
# Sreen brightness controls
bindsym XF86MonBrightnessUp exec "~/bin/i3-brightness.sh +"
bindsym XF86MonBrightnessDown exec "~/bin/i3-brightness.sh -"
...
"
In your home /bin folder (i3-brightness.sh):
#!/bin/bash
BRIGHT=`cat brightness.txt`
if [ "$1" = '+' ]; then
echo "+"
NEWBRIGHT=$(echo "$BRIGHT + 0.05" | bc)
if [ "$(echo "$NEWBRIGHT > 1.0" | bc)" -eq 1 ]; then
NEWBRIGHT='1.0'
fi
elif [ "$1" = '-' ]; then
echo "-"
NEWBRIGHT=$(echo "$BRIGHT - 0.05" | bc)
if [ "$(echo "$NEWBRIGHT < 0.0" | bc)" -eq 1 ]; then
NEWBRIGHT='0.0'
fi
fi
echo "${NEWBRIGHT}"
`xrandr --output eDP-1 --brightness $NEWBRIGHT`
echo "$NEWBRIGHT" > brightness.txt
Before running the first time:
cd ~/bin/
echo .45 >> brightness.txt
Restart i3wm
You should not be able to adjust screen brightness with your funciton keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment