How to suspend only when Laptop is with Battery on systemd

view story

https://bbs.archlinux.org – Hi again , I was capable to make sleep hooks for systemd to lock screen when suspend/hibernate and for wicd to reconect wifi in same way, but i cant figure out is how to make systemd only suspend when is on battery. Because if I edit /etc/systemd/logind.conf to handle the Lid events always suspend wheterever is on battery or AC, before I was using acpi to handle this, to make clear here is my handler.sh#!/bin/sh # Default acpi script that takes an entry for all actions #minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq` #maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpu (HowTos)