Alternatives to xfce power manager

I’ve been using i3 for a while now, but the xfce power manager doesn’t work outside the desktop environment, is there any alternative you can recommend? It doesn’t matter if it is a terminal based or graphical interface program, I just need something that can suspend the computer after a certain time or lock it when the laptop is closed

Jamecowell,

use power-profiles-daemon

gnuhaut,

I use tlp.

I also have a battery info using i3status in the status bar, and a script I named battery-check, which warns me via a dunst popup and a beep when the battery gets low:


<span style="color:#323232;">#!/bin/sh
</span><span style="color:#323232;">set -eu
</span><span style="color:#323232;">
</span><span style="color:#323232;">bat=/sys/class/power_supply/BAT0
</span><span style="color:#323232;">
</span><span style="color:#323232;">if [ ! -d "$bat" ]; then
</span><span style="color:#323232;">    exit 1;
</span><span style="color:#323232;">fi
</span><span style="color:#323232;">
</span><span style="color:#323232;">status=$(cat "$bat/status")
</span><span style="color:#323232;">energy_now=$(cat "$bat/energy_now")
</span><span style="color:#323232;">energy_full=$(cat "$bat/energy_full")
</span><span style="color:#323232;">
</span><span style="color:#323232;">battery_percent=$(( ${energy_now}00 / ${energy_full} ))
</span><span style="color:#323232;">
</span><span style="color:#323232;">if [ "$status" != "Charging" -a "$battery_percent" -le 15 ]; then
</span><span style="color:#323232;">    dunstify -t 8000 -u critical "Battery at ${battery_percent}%"
</span><span style="color:#323232;">    play -q -n -c1 synth 2 sine 600
</span><span style="color:#323232;">fi
</span>

I run this from my ~/.config/sway/config like so:


<span style="color:#323232;">exec sh -c 'while true; do sleep 180; battery-check || break; done'
</span>
dogsnest,
@dogsnest@lemmy.world avatar

TLP

also

acpitool

manito_manopla,
@manito_manopla@lemmy.ml avatar

Sometimes I forget to connect the charger to the laptop, and it discharges without realizing it. When I used xfce power manager, it warned me when the charger was disconnected, can tlp or acpitool send those types of notifications?

manito_manopla,
@manito_manopla@lemmy.ml avatar

What are the differences between tlp and acpitool?

dogsnest,
@dogsnest@lemmy.world avatar

In a nutshell TLP’s default settings are optimized for battery life upon installation, allowing you to further tweak/adjust to your needs. Whereas acpitool analyzes, but doesn’t optimize without your input.

As for notifications, I don’t believe either package provides them, especially since they’re both cli tools (TLP has a gui, TLPUI)

As for notifications, a bash script similar to this would work:

ac_adapter=$(acpi -a | cut -d’ ’ -f3 | cut -d- -f1) if [ “$ac_adapter” = “on” ]; then notify-send “AC Adapter” “The AC Adapter is on.” else notify-send “AC Adapter” “The AC Adapter is off.” fi

boredsquirrel,

Also adding auto-cpufreq, ryzenadj, tuned.

But this depends on your CPU used.

TLP is good, tuned may be better?

TLP has a common USB lost issue, that is mitigated by disabling USB-autosuspend in the config. TLP config is found here

And if you need a tool for warning about AC disconnect, you can use a systemd service.


<span style="color:#323232;">cat > /usr/local/bin/check_ac.sh <<EOF
</span><span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;">
</span><span style="color:#323232;">while true; do
</span><span style="color:#323232;">    if [[ "$(cat /sys/class/power_supply/AC/online)" -eq 0 ]]; then
</span><span style="color:#323232;">        notify-send -t 20 -a "Power" "AC Disconnected"
</span><span style="color:#323232;">    fi
</span><span style="color:#323232;">		sleep 20
</span><span style="color:#323232;">done
</span><span style="color:#323232;">EOF
</span>

<span style="color:#323232;">chmod +x /usr/local/bin/check_ac.sh
</span>

<span style="color:#323232;">cat > /etc/systemd/user/ac-warning.service <<EOF
</span><span style="color:#323232;">[Unit]
</span><span style="color:#323232;">Description=Monitor AC State and Notify
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Service]
</span><span style="color:#323232;">ExecStart=/usr/local/bin/check_ac.sh
</span><span style="color:#323232;">Restart=always
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Install]
</span><span style="color:#323232;">WantedBy=graphical.target
</span><span style="color:#323232;">EOF
</span>

<span style="color:#323232;">systemctl --user daemon-reload
</span><span style="color:#323232;">systemctl --user enable --now ac-warning.service
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • fightinggames
  • All magazines