aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbrightness.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/brightness.sh b/brightness.sh
index c04b9cf..a1c6648 100755
--- a/brightness.sh
+++ b/brightness.sh
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!/bin/sh
-brightness_file=/sys/class/backlight/intel_backlight/brightness
-maxbrightness_file=/sys/class/backlight/intel_backlight/max_brightness
+brightness_file="/sys/class/backlight/intel_backlight/brightness"
+maxbrightness_file="/sys/class/backlight/intel_backlight/max_brightness"
# Old setup with initial file permissions change
# permissions="$(ls -l $brightness_file | awk '{print $1}')"
@@ -12,6 +12,7 @@ maxbrightness_file=/sys/class/backlight/intel_backlight/max_brightness
brightness=$(< "$brightness_file")
maxbrightness=$(< "$maxbrightness_file")
let target=$1+$brightness
+sudo chmod 666 /sys/class/backlight/intel_backlight/brightness
if [ $target -gt $maxbrightness ]
then
sudo echo "$maxbrightness" >"$brightness_file"
@@ -21,6 +22,7 @@ then
else
sudo echo "$target" >"$brightness_file"
fi
+sudo chmod 644 /sys/class/backlight/intel_backlight/brightness
dunstify -r $(dunstifyIDs.sh "brightness") -t 500 "$(~/scripts/i3blocks/i3brightness.sh)"
pkill -SIGRTMIN+11 i3blocks