On Mon, Dec 27, 2004 at 10:31:52AM +0300, George Nephrite Potapov wrote:
> On Fri, Dec 24, 2004 at 09:59:38AM -0800, Kyle Graehl wrote:
>
> > I am setting up an old laptop computer with FVWM for my mother and it
> > works great. In the current unstable there is a ClockFormat option.
> >
> > *FvwmTaskBar: ClockFormat <strftime format>
> >
> > I am not sure if FVWM functions can return values, but I think it
> > would be great to allow something like this:
> >
> > *FvwmTaskBar: ExtendedClockText <some function that gets called at
> > each UpdateInterval>
> >
> > This way I could get my battery level percentage down there by the
> > clock. I'm sure others could find more creative uses for this. I tried
> > to hack this in myself but I don't really understand C and I honestly
> > couldn't see how the current system works. (Goodies.c?)
>
> A better idea would be to make FvwmTaskBar able to swallow arbitrary windows
> like FvwmButtons does. Writing a string into clock looks too "ad hoc" to me.
>
I'm just using FvwmButtons and FvwmScript to display my battery
level. Not really what your asking, but here is the code what I'm
using if you need it.
( the output is something like 'AC 99% 43.0°')
This is a ruby script to get the battery level and the degrees:
------------------------------------------------------------------
#!/usr/bin/env ruby
online = false
degree = '??'
procent = '??'
status = `acpi -atc`
status.each_line do |line|
line.chomp!
online = (line =~ /.*on-line.*/) if line =~ /.*AC Adapter.*/
if line =~ /.*Thermal.*/
degree = line.gsub!(/.*,/, '')
degree.gsub!(/degrees.*/, '')
degree.strip!
end
if line =~ /.*Battery.*/
procent = line.gsub(/.*ing,/, '')
procent.gsub!(/, .*/, '')
procent.strip!
end
end
if online; print 'AC' else print 'DC' end
print " #{procent}"
puts " #{degree}°"
------------------------------------------------------------------
And here is the FvwmAcpi script:
------------------------------------------------------------------
WindowTitle {FvwmAcpi}
WindowSize 88 23
Init
Begin
Set $MainColorset=(GetScriptArgument 1)
If $MainColorset <> {} Then
Begin
ChangeColorset 0 $MainColorset
ChangeColorset 1 $MainColorset
End
Set $tmp = (GetOutput {exec ./.fvwm/scripts/acpi.rb} 1 -1)
ChangeTitle 1 $tmp
End
PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 30)==0 Then
Begin
Set $tmp = (GetOutput {exec ./.fvwm/scripts/acpi.rb} 1 -1)
ChangeTitle 1 $tmp
End
End
Widget 1
Property
Position 0 0
Size 88 23
Type ItemDraw
Flags NoReliefString
Title {}
Main
Case message of
SingleClic :
Begin
End
End
------------------------------------------------------------------
--
Roeland
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Mon Dec 27 2004 - 03:25:28 GMT