add screen brightness script for Gnome
This commit is contained in:
parent
c14b3c5ff1
commit
d720c7cdae
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "usage: $0 up|down"
|
||||||
|
}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local method=""
|
||||||
|
if [ "$1" == "up" ]; then
|
||||||
|
method="org.gnome.SettingsDaemon.Power.Screen.StepUp"
|
||||||
|
elif [ "$1" == "down" ]; then
|
||||||
|
method="org.gnome.SettingsDaemon.Power.Screen.StepDown"
|
||||||
|
else
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
dbus_result=$(gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method "$method" | tr -d "(,)")
|
||||||
|
level=$(echo "$dbus_result" | awk '{ printf "%f", $1 / 100 }')
|
||||||
|
connector=$(echo "$dbus_result" | awk '{ print $2 }')
|
||||||
|
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.ShowOSD "{'icon': <'display-brightness-symbolic'>, 'level': <$level>, 'connector': <$connector>}"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
Loading…
Reference in New Issue