lubuntu - Openbox execute keybind - Ask Ubuntu
to adjust backlight i'm using command:
sudo bash -c "echo $backlight_value > /sys/class/backlight/apple_backlight/brightness;"
now want setup keybinding command above via shell script openbox adjust backlight in pc. setup keybinding searched config file used openbox:
$ ps ax | grep openbox 1194 ? sl 0:02 openbox --config-file /home/ubuntu/.config/openbox/lubuntu-rc.xml --sm-save-file /home/ubuntu/.cache/openbox/sessions/1478226066-1194-624962777.obs --sm-no-load 1958 pts/0 s+ 0:00 grep --color=auto openbox
next edited config file lubuntu-rc.xml , works (i tested it):
<!-- keybindings --> <keybind key="0xc0"> <action name="execute"> <execute>lxterminal</execute> </action> </keybind>
now want execute custom shell script below. in shell script there 2 commands (line 2 , 5) needs addional permissions. how can run them root?
#!/bin/bash curr=`cat /sys/class/backlight/apple_backlight/brightness` if [ $curr -gt 0 ]; curr=$((curr - 1)); echo $curr > /sys/class/backlight/apple_backlight/brightness; fi
i changed privileges error still there (permission denied):
ls -l /sys/class/backlight/apple_backlight/ total 0 -rwxrwxr-x 1 ubuntu ubuntu 4096 nov 4 00:41 brightness
i tested script without binding , works:
bash /home/ubuntu/documents/customscripts/brightnessdown.sh
i had setup execution bit both scripts:
-rw**x**r-**x**r-- 1 ubuntu ubuntu 189 nov 4 15:34 brightnessdown.sh -rw**x**r-**x**r-- 1 ubuntu ubuntu 191 nov 4 15:36 brightnessup.sh
so entered:
sudo chmod 754 ~/documents/customscripts/brightness*.sh
now can run both scripts via keyboard shortcuts.
Comments
Post a Comment