mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-30 21:32:48 +00:00
1c2148bde6
the default is to enable power-saver mode when run and that always worked and was the point of the script, which is why this never got caught before now.
27 lines
1.2 KiB
Bash
Executable File
27 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
# This script sends the Power Profile Daemon dbus call to set tuneD to power-saver mode
|
|
# This is useful only for battery powered devices where you want to start in power-saver mode by default
|
|
POWERSAVE=1
|
|
if [ -n "$1" ]; then
|
|
if [ "$1" == "0" ]; then
|
|
POWERSAVE=0
|
|
fi
|
|
fi
|
|
|
|
# Check what DE we are on
|
|
if command -v /usr/bin/mutter > /dev/null; then
|
|
# If we are on Gnome send the dbus signal with gdbus
|
|
if [ "$POWERSAVE" == "0" ]; then
|
|
gdbus call --system --dest net.hadess.PowerProfiles --object-path /net/hadess/PowerProfiles --method org.freedesktop.DBus.Properties.Set 'net.hadess.PowerProfiles' 'ActiveProfile' "<'balanced'>"
|
|
else
|
|
gdbus call --system --dest net.hadess.PowerProfiles --object-path /net/hadess/PowerProfiles --method org.freedesktop.DBus.Properties.Set 'net.hadess.PowerProfiles' 'ActiveProfile' "<'power-saver'>"
|
|
fi
|
|
else
|
|
# Assume we are on KDE and send the dbus signal with qdbus
|
|
if [ "$POWERSAVE" == "0" ]; then
|
|
qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/PowerProfile setProfile balanced
|
|
else
|
|
qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/PowerProfile setProfile power-saver
|
|
fi
|
|
fi
|