battery monitor

What is a good battery monitor for FVWM that isn’t a resource hog?

Search the forums for ‘FvwmMonitor’. I believe that will do
what you want.

– Thomas Adam

I wrote a pretty basic FvwmScript/Python/acpi combo for that some time ago, it’s not very pretty though as I didn’t have much time to spend on it, but it shouldn’t be hard to extend.

The Python code:

[code]#!/usr/bin/env python
import os
import sys

def getPercentage():
fin = os.popen("/usr/bin/acpi")
acpi = fin.readline()
acpi = acpi.split(’,’)[1].lstrip()
print acpi

def getTimeRemaining():
fin = os.popen("/usr/bin/acpi")
acpi = fin.readline()
acpi = acpi.split(’,’)[2].split(" “)[1].rstrip(” ").rstrip(’\n’)
print acpi

def isDischarging():
fin = os.popen("/usr/bin/acpi")
acpi = fin.readline()
acpi = acpi.split(’,’)[0].lstrip(" “).split(” ")[2]
if acpi == “discharging”:
print “1”
else:
print “0”

if name == “main”:
if(len(sys.argv) == 1):
sys.exit(1)
elif(sys.argv[1] == ‘d’):
isDischarging()
elif(sys.argv[1] == ‘p’):
getPercentage()
elif(sys.argv[1] == ‘t’):
getTimeRemaining()[/code]

The FvwmScript:

[code]WindowTitle {FvwmApplet-BatteryStatus}
WindowSize 158 24
Font “Shadow=1 1 SE:xft:Bitstream Vera Sans Mono:style=Roman:pixelsize=12”

Init
Begin
Set $MainColorset=(GetScriptArgument 1)
If $MainColorset <> {} Then
Begin
ChangeColorset 0 $MainColorset
ChangeColorset 1 $MainColorset
End
Set $tmp = {P: } (GetOutput {$FVWM_USERDIR/scripts/Battery.py p} 1 -1) { - R: } (GetOutput {$FVWM_USERDIR/scripts/Battery.py t} 1 -1)
ChangeTitle 1 $tmp
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 30)==0 Then
Begin
If (GetOutput {$FVWM_USERDIR/scripts/Battery.py d} 1 -1)==0 Then
Set $status=C
Else
Begin
Set $status=D
End
Set $tmp = {P: }(GetOutput {$FVWM_USERDIR/scripts/Battery.py p} 1 -1) { - } $status {: } (GetOutput {$FVWM_USERDIR/scripts/Battery.py t} 1 -1)
ChangeTitle 1 $tmp
#Set $tmp = (GetOutput {$FVWM_USERDIR/scripts/Battery.py t} 1 -1) { }
#ChangeTitle 2 $tmp
End
End

Widget 1
Property
Position 0 0
Size 158 24
Type ItemDraw
Title {}
Main
Case message of
SingleClic:
Begin

End

End[/code]

You can use also some wmaker/next applet. There are tons, you can check them here: dockapps.org/

I think that there where also some blackbox applets around there, but never tried them personally.

Alternatively you can use also gkrellm.