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

    • Manito ManoplaOP
      link
      fedilink
      arrow-up
      4
      ·
      1 month 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?

      • mad_asshatter@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        1 month 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
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 month 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