I use simple script to make dynamic status bar of cpu usage (see below).
After starting fvwm it works but after 3-4 minutes the bar disappears! The cpu.sh is simple (see below). Without ChangeSize there is no crashing (but there is no dynamic bar, static only). The cpu.sh gives integer number because ChangeSize needs for integer number. What maybe reason of this crashing? I spent already two days and do not understand reason.
WindowTitle {Status}
WindowSize 120 30
##### Global Style
Font "xft:DejaVu Sans:size=8:bold"
Init
Begin
Set $probarColor = {#cccccc}
##### Widgets
ChangeBackColor 1 $probarColor
ChangeBackColor 3 $probarColor
End
PeriodicTasks
Begin
##### CPU Status
If (RemainderOfDiv (GetTime) 2) == 0 Then
Begin
Set $length = (GetOutput {echo $(bash $HOME/.fvwm/scripts/StaTux/cpu.sh)} 1 -1)
ChangeSize 3 $length 3
End
End
Widget 1
Property
Type ItemDraw
Size 120 4
Position 0 0
Flags NoFocus NoReliefString
Main
Case message of
End
Widget 2
Property
Type ItemDraw
Size 118 2
Position 1 1
Flags NoFocus NoReliefString
Main
Case message of
End
Widget 3
Property
Type ItemDraw
Size 118 2
Position 1 1
Flags NoFocus NoReliefString
Main
Case message of
End
cpu.sh
#!/bin/sh
DELAY=${1:-1}
{ cat /proc/stat; sleep "$DELAY"; cat /proc/stat; } | awk '/^cpu / {usr=$2-usr; sys=$4-sys; idle=$5-idle; iow=$6-iow} END {total=usr+sys+idle+iow; print int((total-idle)*118/total)}'
Asked by nail
(11 rep)
Jul 12, 2018, 12:01 AM
Last activity: Jul 14, 2018, 06:04 PM
Last activity: Jul 14, 2018, 06:04 PM