# This is a sample configuration to show the possible
# usage of FvwmAPMDaemon
# It defines an FvwmButtons Panel to hold an icon
# and the battery percentage
# Once the config file es read, the panel
# can be started by the function
# "StartAPMFunc"

# Function to execute when 
# the percentage interval changes (see below)
DestroyFunc BatteryIFunc
AddToFunc BatteryIFunc
+ I SendToModule FvwmAPM ChangeButton apm Icon fvwmapmdaemon/battery_$[apm.battery_interval_percentage].png

# Function to execute on a change of
# the battery percentage
DestroyFunc BatteryFunc
AddToFunc BatteryFunc
+ I SendToModule FvwmAPM ChangeButton apm Title "$[apm.battery_percentage]%"

# Function to execute when status
# changes to AC
DestroyFunc ACFunc
AddToFunc ACFunc
+ I ClearMessage
+ I SendToModule FvwmAPM ChangeButton apm Icon fvwmapmdaemon/power.png
+ I SendToModule FvwmAPM ChangeButton apm Title Online

DestroyModuleConfig FvwmAPMDaemon: *

# Threshold indicating an "uncomfortable" battery status
*FvwmAPMDaemon: APMWarnThreshold 12

# Command to execute when the battery percentage reaches or falls below the warning threshold
*FvwmAPMDaemon: APMWarnCommand SendToModule FvwmButtons FvwmAPM "!"

# Threshold indicating a critical battery status
*FvwmAPMDaemon: APMCriticalThreshold 8

# Command to execute when the battery percentage reaches or falls below the critical threshold
*FvwmAPMDaemon: APMCriticalCommand SendToModule FvwmButtons FvwmAPM "!!!!"

# Command to execute when the AC Adapter is plugged in
*FvwmAPMDaemon: ACCommand ACFunc

# Command to execute on a change of the battery percentage
# including the unplugging of the ac adapter
# The environment variable $[apm.battery_percentage] is
# set before the command is executed
*FvwmAPMDaemon: BatteryCommand BatteryFunc

# Interval length to keep the interval percentage constant
# This can be used to change to a different icon indicating
# the battery percentage.
*FvwmAPMDaemon: BatteryIPercentageBase 25

# Command to execute on a change of the battery percentage interval
# The environment variable $[apm.battery_interval_percentage] is
# set by
# (BatteryIPercentageBase+1)*floor(apm.battery_percentage/BatteryIPercentageBase)
# So it will be rounded up
*FvwmAPMDaemon: BatteryICommand BatteryIFunc 

# Sample FvwmButtons module to show the icon and the
# battery Percentage
DestroyModuleConfig FvwmAPM: *
*FvwmAPM: Rows 1, Columns 1, Geometry 32x32
*FvwmAPM: (1x1+0+0, id apm, Title apm, Icon fvwmapmdaemon/power.png)

DestroyFunc StartAPMFunc
AddToFunc StartAPMFunc
+ I KillModule FvwmAPMDaemon
+ I KillModule FvwmButtons FvwmAPM
+ I Module FvwmButtons FvwmAPM
+ I Schedule 3000 Module FvwmAPMDaemon
