aboutsummaryrefslogtreecommitdiff
path: root/brightness.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-03-20 16:18:58 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-03-20 16:24:42 +0100
commitb56400cb2572649a758714f0bd0d7b027b6a6fdd (patch)
tree0a1ee3de67d553b5ca50b91127011a55c78e154a /brightness.sh
parent6d4413677983d8880caa3db189b872a7343b4073 (diff)
downloadscripts-b56400cb2572649a758714f0bd0d7b027b6a6fdd.tar.gz
scripts-b56400cb2572649a758714f0bd0d7b027b6a6fdd.zip
Dunstified and removed initial file permission change.
Diffstat (limited to 'brightness.sh')
-rwxr-xr-xbrightness.sh25
1 files changed, 11 insertions, 14 deletions
diff --git a/brightness.sh b/brightness.sh
index 399f55a..c04b9cf 100755
--- a/brightness.sh
+++ b/brightness.sh
@@ -3,27 +3,24 @@
brightness_file=/sys/class/backlight/intel_backlight/brightness
maxbrightness_file=/sys/class/backlight/intel_backlight/max_brightness
-permissions=$(ls -l $brightness_file | awk '{print $1}')
-if [ $permissions != "-rw-rw-rw-" ]; then
- #urxvt -title floating -geometry 32x1 -e sudo ~/scripts/brightFirst.sh
- sudo ~/scripts/brightFirst.sh
-fi
+# Old setup with initial file permissions change
+# permissions="$(ls -l $brightness_file | awk '{print $1}')"
+# if [ $permissions != "-rw-rw-rw-" ]; then
+# sudo ~/scripts/brightFirst.sh
+# fi
-brightness=$(< $brightness_file)
-maxbrightness=$(< $maxbrightness_file)
+brightness=$(< "$brightness_file")
+maxbrightness=$(< "$maxbrightness_file")
let target=$1+$brightness
if [ $target -gt $maxbrightness ]
then
- #echo "Value too big. Target: $target; max: $maxbrightness"
- echo $maxbrightness | tee $brightness_file
+ sudo echo "$maxbrightness" >"$brightness_file"
elif [ 0 -gt $target ]
then
- #echo "Value too low. Target: $target"
- echo "0" | tee $brightness_file
+ sudo echo "0" >"$brightness_file"
else
- echo $target | tee $brightness_file
- #echo "New brightness: $target/$maxbrightness"
+ sudo echo "$target" >"$brightness_file"
fi
-notify-send -h string:x-canonical-private-synchronous:vol -t 500 "$(~/scripts/i3blocks/i3brightness.sh)"
+dunstify -r $(dunstifyIDs.sh "brightness") -t 500 "$(~/scripts/i3blocks/i3brightness.sh)"
pkill -SIGRTMIN+11 i3blocks