HikariKnight 1c2148bde6
fix(bazzite-powersave): make arg to set PPD to balance work (#1252)
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.
2024-06-21 10:44:32 -07:00

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