aparlak
(A P)
October 7, 2023, 2:22pm
1
Let’s say I will set 100% brightness for when the laptop is on AC power, 30% for when it’s on battery. How can I do this? I’m on F38 gnome/wayland, the laptop is a Lenovo Yoga, every feature of the laptop works perfectly, including brightness key combination and gnome’s slider.
Basically what I want is, when I plug the laptop to power, the screen to go bright, when I unplug it, the screen to dim automatically.
2 Likes
vwbusguy
(Scott Williams)
October 8, 2023, 2:57am
2
This is a great idea! I’m not immediately sure how to implement this with the new power profiles, but it seems possible.
aparlak
(A P)
October 8, 2023, 2:26pm
3
Thanks. Seems like I managed to attract the attention of the right person.
Maybe making gnome remember two brightness level settings based on power status is a better way to implement. Just an idea.
vwbusguy
(Scott Williams)
October 8, 2023, 8:02pm
4
I wrote a script not long ago to set power levels based on battery events. You could probably extend it to change the brightness as well:
auto-profile-update.sh
#!/bin/bash
dbus-monitor --system "type='signal',path='/org/freedesktop/UPower/devices/battery_BAT0',member='PropertiesChanged'" | while read LINE; do
echo ${LINE} | grep battery_BAT0 | grep -q PropertiesChanged
if [ $? -eq 0 ]; then
BATT_STAT=$(dbus-send --print-reply=literal --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/devices/battery_BAT0 org.freedesktop.DBus.Properties.Get string:org.freedesktop.UPower.Device string:State | awk '{ print $3; }')
if [ $BATT_STAT -eq 1 ] || [ $BATT_STAT -eq 4 ]; then
LEVEL=$(powerprofilesctl list | grep -q performance && echo "performance" || echo "balanced")
elif [ $BATT_STAT -eq 5 ]; then
LEVEL="balanced"
This file has been truncated. show original