this post was submitted on 20 May 2024
39 points (97.6% liked)

Linux

48698 readers
1145 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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

top 7 comments
sorted by: hot top controversial new old
[–] dogsnest@lemmy.world 9 points 7 months ago* (last edited 7 months ago) (3 children)
[–] manito_manopla@lemmy.ml 4 points 7 months ago

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@lemmy.ml 3 points 7 months ago* (last edited 7 months ago) (1 children)

What are the differences between tlp and acpitool?

[–] dogsnest@lemmy.world 7 points 7 months ago

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@slrpnk.net 2 points 7 months ago* (last edited 7 months ago)

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.

cat > /usr/local/bin/check_ac.sh <<EOF
#!/bin/bash

while true; do
    if [[ "$(cat /sys/class/power_supply/AC/online)" -eq 0 ]]; then
        notify-send -t 20 -a "Power" "AC Disconnected"
    fi
		sleep 20
done
EOF
chmod +x /usr/local/bin/check_ac.sh
cat > /etc/systemd/user/ac-warning.service <<EOF
[Unit]
Description=Monitor AC State and Notify

[Service]
ExecStart=/usr/local/bin/check_ac.sh
Restart=always

[Install]
WantedBy=graphical.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now ac-warning.service
[–] gnuhaut@lemmy.ml 2 points 7 months ago

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:

#!/bin/sh
set -eu

bat=/sys/class/power_supply/BAT0

if [ ! -d "$bat" ]; then
    exit 1;
fi

status=$(cat "$bat/status")
energy_now=$(cat "$bat/energy_now")
energy_full=$(cat "$bat/energy_full")

battery_percent=$(( ${energy_now}00 / ${energy_full} ))

if [ "$status" != "Charging" -a "$battery_percent" -le 15 ]; then
    dunstify -t 8000 -u critical "Battery at ${battery_percent}%"
    play -q -n -c1 synth 2 sine 600
fi

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

exec sh -c 'while true; do sleep 180; battery-check || break; done'
[–] Jamecowell@lemmy.dbzer0.com 1 points 7 months ago* (last edited 7 months ago)

use power-profiles-daemon