Skip to content

Instantly share code, notes, and snippets.

@rubenhortas
Created March 9, 2024 17:56
Show Gist options
  • Save rubenhortas/fe6ca34d242ab5229b833865671f4930 to your computer and use it in GitHub Desktop.
Save rubenhortas/fe6ca34d242ab5229b833865671f4930 to your computer and use it in GitHub Desktop.
Adjust the screen brightness modifying directly the gnome settings daemon power
#!/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