From 31f6f93f037cad9b4e0834dd35ccc953ab9d5439 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Wed, 20 Mar 2019 20:20:24 +0100 Subject: Fixed sudo + redirecting output chaos. --- brightness.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'brightness.sh') 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 -- cgit v1.2.1