Created
March 9, 2024 17:56
-
-
Save rubenhortas/fe6ca34d242ab5229b833865671f4930 to your computer and use it in GitHub Desktop.
Adjust the screen brightness modifying directly the gnome settings daemon power
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Adjust the screen brightness modifying directly the gnome settings daemon power. | |
# To use this script you just have to save it in a path with execution permissions and assign the commands "brightnessControl up" and "brightnessControl down" to the keys using shortcuts. | |
# There's a better way to do this: install xdotool and assign the commands “xdotool key XF86MonBrightnessUp” and “xdotool key XF86MonBrightnessDown” to the brightness keys. | |
# With this solution the brightness indicator will come out on screen when we change the brightness. | |
# Arguments | |
way="$1" # Up or Down | |
if [ $1 == "up" ] | |
then | |
$(dbus-send --session --print-reply --dest=org.gnome.SettingsDaemon /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.StepUp >> /dev/null) | |
else | |
if [ $1 == "down" ] | |
then | |
$(dbus-send --session --print-reply --dest=org.gnome.SettingsDaemon /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.StepDown >> /dev/null) | |
else | |
echo "Wrong option. Only 'up' and 'down' accepted." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment