DragonFly On-Line Manual Pages
battray(1) DragonFly General Commands Manual battray(1)
NAME
Battray -- Display an battery status notification tray icon
SYNOPSIS
battray [-hv] [-p platform] [-d datadir] [-f configfile] [-i
pol_interval]
DESCRIPTION
battray is a tray icon aka status icon to notify you of your battery
status and do some action depending on it.
-h, --help
Display help message and exit.
-v, --version
Display version and exit.
-p, --platform
Use this platform file, normally this is autodetected.
Will be imported, so make sure it's in sys.path
-d, --datadir
Datadir to get icons and platform file from.
-f, --file
Configuration file to use. A configuration file is mandatory.
-i, --interval
Poll the system every n seconds.
CONFIGURATION
The configuration file is imported in Python, any valid Python code
goes. You don't need to specify your own configuration, a basic
conservative configuration is included.
Location
The configuration file will be searched in the following locations. The
first match wins:
o Specified from commandline
o ~/.battray/battrayrc.py
o ~/.battrayrc.py
o /usr/local/etc/battrayrc.py
o /usr/local/etc/battray/battrayrc.py
o /etc/battrayrc.py
o /etc/battray/battrayrc.py
o /usr/local/share/battray/battrayrc.py
o /usr/local/share/examples/battray/battrayrc.py
o /usr/share/battray/battrayrc.py
o battrayrc.py
o sys.path + /battray/battrayrc_default.py
Generic options
datadir (string)
Datadir to get icons and platform file from. Usually not
required.
pollInterval (int)
Poll the system every n seconds.
Available functions
charging()
Return True if notebook is charging the battery
ac()
Return True if notebook is connected to AC power
percent()
Return percentage of battery time remaining
lifetime()
Return remaining battery time in minutes
switchedto()
Return 'battery' if we switched to battery since last poll.
'ac' if we switched to ac since last poll.
run(cmd)
Run cmd (string) in shell. Note: no escaping will be done on
the command.
play(sound)
Play a sound. The path if relative to the datadir.
playonce(sound, id)
Play a sound once until reset_playonce() is called for this id.
'id' can be any string.
playonce(id)
Reset the playonce flag for the sound id
Available variables
icon = 'file.png'
Set icon to this file. Can be relative to datadir
color = 'red|yellow|green'
Fill battery icon with this color. Available are 'yellow',
'red',
and 'green'.
blink = True|False
Set to True to blink the icon (Do not use is presence of
weeping angels!)
PLATFORM FILE
Battray gets its data from using a command-line utility provided by the
Operating System. Almost every OS a slightly different utility and/or
to fetch the battery status, this is why we need a platform file to
imple- ment each platform.
These files are imported (and reload()-ed when needed) by the main
script. Any valid Python syntax goes.
List of mandatory variables, these must be present:
ac (bool)
Connected to AC? None if unknown.
percent (int)
Battery power remaining in percent. 255 if unknown.
lifetime (int)
Battery time remaining in minutes. 255 if unknown.
charging (bool)
Are we charging the battery? None if unknown.
Optional variables, these will just be ignored if not set:
tooltip (string)
Additional info in the tooltip.
BUGS
o Multiple batteries are not supported.
SEE ALSO
python(1), apm(8), acpidump(8), apm(4), acpi(4)
AUTHORS
o Martin Tournoij <martin@arp242.net>
o Linux support by Andy Mikhaylenko <andy@neithere.net>
o Keith W. Blackwell a.k.a. zimbot from freesound.org
Feel free to use, modify, and redistribute battray as you see fit.
There are no restrictions.
Martin Tournoij <martin@arp242.net>
Battray 1.5 battray(1)