Fvwm ChangeSize crashes

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












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)'






share|improve this question





















  • You are not calling cpu.sh with an argument, so DELAY=-1, and sleep -1 is no sleep at all, so 2 successive cats of /proc/stat might give the same results twice, so the total will be 0 and you will have an awk division by 0 with no output on stdout.
    – meuh
    Jul 12 at 8:16










  • @meuh I changed "$DELAY" to 1 or "1" with the same result - after some time the bar disappeared.
    – nail
    Jul 12 at 10:26










  • @meuh I think I found the reason of crushing. It is crushed if we have zero size: ChangeSize 3 0 2 is crashed.
    – nail
    Jul 12 at 14:09










  • Yes, you are right. I was just trying your script and when it crashed cpu.sh had returned 0 and there was an X Error in the stderr of fvwm: Error: 2 (BadValue (integer parameter out of range for operation)) Major opcode of failed request: 12 (ConfigureWindow) and a core dump.
    – meuh
    Jul 12 at 14:55










  • @meuh Thank you for confirming. I saw this error in .xsession-errors. But I was confused by "integer parameter". I saw discussion in fvwm forum that ChangeSize needs for integer parameter and thought that this error due to this integer parameter. There is also official information "FvwmScript crashes if widgets are accessed that have not been defined." Maybe it means that for zero size the widget is not defined?
    – nail
    Jul 13 at 1:00














up vote
1
down vote

favorite












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)'






share|improve this question





















  • You are not calling cpu.sh with an argument, so DELAY=-1, and sleep -1 is no sleep at all, so 2 successive cats of /proc/stat might give the same results twice, so the total will be 0 and you will have an awk division by 0 with no output on stdout.
    – meuh
    Jul 12 at 8:16










  • @meuh I changed "$DELAY" to 1 or "1" with the same result - after some time the bar disappeared.
    – nail
    Jul 12 at 10:26










  • @meuh I think I found the reason of crushing. It is crushed if we have zero size: ChangeSize 3 0 2 is crashed.
    – nail
    Jul 12 at 14:09










  • Yes, you are right. I was just trying your script and when it crashed cpu.sh had returned 0 and there was an X Error in the stderr of fvwm: Error: 2 (BadValue (integer parameter out of range for operation)) Major opcode of failed request: 12 (ConfigureWindow) and a core dump.
    – meuh
    Jul 12 at 14:55










  • @meuh Thank you for confirming. I saw this error in .xsession-errors. But I was confused by "integer parameter". I saw discussion in fvwm forum that ChangeSize needs for integer parameter and thought that this error due to this integer parameter. There is also official information "FvwmScript crashes if widgets are accessed that have not been defined." Maybe it means that for zero size the widget is not defined?
    – nail
    Jul 13 at 1:00












up vote
1
down vote

favorite









up vote
1
down vote

favorite











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)'






share|improve this question













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)'








share|improve this question












share|improve this question




share|improve this question








edited Jul 12 at 0:18
























asked Jul 12 at 0:01









nail

62




62











  • You are not calling cpu.sh with an argument, so DELAY=-1, and sleep -1 is no sleep at all, so 2 successive cats of /proc/stat might give the same results twice, so the total will be 0 and you will have an awk division by 0 with no output on stdout.
    – meuh
    Jul 12 at 8:16










  • @meuh I changed "$DELAY" to 1 or "1" with the same result - after some time the bar disappeared.
    – nail
    Jul 12 at 10:26










  • @meuh I think I found the reason of crushing. It is crushed if we have zero size: ChangeSize 3 0 2 is crashed.
    – nail
    Jul 12 at 14:09










  • Yes, you are right. I was just trying your script and when it crashed cpu.sh had returned 0 and there was an X Error in the stderr of fvwm: Error: 2 (BadValue (integer parameter out of range for operation)) Major opcode of failed request: 12 (ConfigureWindow) and a core dump.
    – meuh
    Jul 12 at 14:55










  • @meuh Thank you for confirming. I saw this error in .xsession-errors. But I was confused by "integer parameter". I saw discussion in fvwm forum that ChangeSize needs for integer parameter and thought that this error due to this integer parameter. There is also official information "FvwmScript crashes if widgets are accessed that have not been defined." Maybe it means that for zero size the widget is not defined?
    – nail
    Jul 13 at 1:00
















  • You are not calling cpu.sh with an argument, so DELAY=-1, and sleep -1 is no sleep at all, so 2 successive cats of /proc/stat might give the same results twice, so the total will be 0 and you will have an awk division by 0 with no output on stdout.
    – meuh
    Jul 12 at 8:16










  • @meuh I changed "$DELAY" to 1 or "1" with the same result - after some time the bar disappeared.
    – nail
    Jul 12 at 10:26










  • @meuh I think I found the reason of crushing. It is crushed if we have zero size: ChangeSize 3 0 2 is crashed.
    – nail
    Jul 12 at 14:09










  • Yes, you are right. I was just trying your script and when it crashed cpu.sh had returned 0 and there was an X Error in the stderr of fvwm: Error: 2 (BadValue (integer parameter out of range for operation)) Major opcode of failed request: 12 (ConfigureWindow) and a core dump.
    – meuh
    Jul 12 at 14:55










  • @meuh Thank you for confirming. I saw this error in .xsession-errors. But I was confused by "integer parameter". I saw discussion in fvwm forum that ChangeSize needs for integer parameter and thought that this error due to this integer parameter. There is also official information "FvwmScript crashes if widgets are accessed that have not been defined." Maybe it means that for zero size the widget is not defined?
    – nail
    Jul 13 at 1:00















You are not calling cpu.sh with an argument, so DELAY=-1, and sleep -1 is no sleep at all, so 2 successive cats of /proc/stat might give the same results twice, so the total will be 0 and you will have an awk division by 0 with no output on stdout.
– meuh
Jul 12 at 8:16




You are not calling cpu.sh with an argument, so DELAY=-1, and sleep -1 is no sleep at all, so 2 successive cats of /proc/stat might give the same results twice, so the total will be 0 and you will have an awk division by 0 with no output on stdout.
– meuh
Jul 12 at 8:16












@meuh I changed "$DELAY" to 1 or "1" with the same result - after some time the bar disappeared.
– nail
Jul 12 at 10:26




@meuh I changed "$DELAY" to 1 or "1" with the same result - after some time the bar disappeared.
– nail
Jul 12 at 10:26












@meuh I think I found the reason of crushing. It is crushed if we have zero size: ChangeSize 3 0 2 is crashed.
– nail
Jul 12 at 14:09




@meuh I think I found the reason of crushing. It is crushed if we have zero size: ChangeSize 3 0 2 is crashed.
– nail
Jul 12 at 14:09












Yes, you are right. I was just trying your script and when it crashed cpu.sh had returned 0 and there was an X Error in the stderr of fvwm: Error: 2 (BadValue (integer parameter out of range for operation)) Major opcode of failed request: 12 (ConfigureWindow) and a core dump.
– meuh
Jul 12 at 14:55




Yes, you are right. I was just trying your script and when it crashed cpu.sh had returned 0 and there was an X Error in the stderr of fvwm: Error: 2 (BadValue (integer parameter out of range for operation)) Major opcode of failed request: 12 (ConfigureWindow) and a core dump.
– meuh
Jul 12 at 14:55












@meuh Thank you for confirming. I saw this error in .xsession-errors. But I was confused by "integer parameter". I saw discussion in fvwm forum that ChangeSize needs for integer parameter and thought that this error due to this integer parameter. There is also official information "FvwmScript crashes if widgets are accessed that have not been defined." Maybe it means that for zero size the widget is not defined?
– nail
Jul 13 at 1:00




@meuh Thank you for confirming. I saw this error in .xsession-errors. But I was confused by "integer parameter". I saw discussion in fvwm forum that ChangeSize needs for integer parameter and thought that this error due to this integer parameter. There is also official information "FvwmScript crashes if widgets are accessed that have not been defined." Maybe it means that for zero size the widget is not defined?
– nail
Jul 13 at 1:00










1 Answer
1






active

oldest

votes

















up vote
0
down vote













As discussed in the comments, it seems FvwmScript crashes due to an X error BadValue when the value returned by the shell script is 0. This is probably because it is trying to configure the window to a size of 0.



An alternative solution is to use the HDipstick widget, which is a horizontal bar in a box of fixed length. Here is a short but complete example:



WindowTitle Status
WindowSize 120 30
WindowPosition 900 1
Init
Begin
ChangeBackColor 3 #000
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 2) == 0 Then
Begin
Set $length = (GetOutput bash $HOME/.fvwm/scripts/StaTux/cpu.sh 1 -1)
ChangeValue 3 $length
End
End

Widget 3
Property
Type HDipstick
Value 0
MinValue 0
MaxValue 200
ForeColor #f00
Size 110 20
Position 5 5
Main
Case message of
End


The MinValue and MaxValue set the expected limits on the number you are getting back from your script. I chose 200 arbitrarily. The PeriodicTasks call of your script gets this number and uses ChangeValue to set the Value property to it. It will be scaled by dividing by 200 and multiplying by the width of the horizontal bar, given here in Size as 110 pixels.



When playing with this I noticed a bug in my version of FvwmScript which would draw a full bar for certain low values. For example, setting a MaxValue of 700 meant values 7 to 26 gave a full bar.
enter image description here






share|improve this answer





















  • Yes, it works. I did not know that ChangeValue changes parameter Value. I did not find in man of HDipstick how possible to change geometry of bar. If I set Size 118 1 the bar does not change. For any height it has the same form.
    – nail
    Jul 14 at 19:03










  • It says the minimum size is 30 by 11.
    – meuh
    Jul 14 at 19:07










  • !Valid XHTML
    – nail
    Jul 15 at 21:02











  • Whats a pity. I prefer thin bars !Valid XHTML. Another observation with this script - it must be loaded last. I use dropbox and it is loaded longest and delete bar if they are and I need to restart fvwm do get bars. For this reason I use delay + I Schedule 30000 Module FvwmScript [FVWM_USERDIR]/scripts/StaTux/Status
    – nail
    Jul 15 at 21:12







  • 1




    Appears another problem. I use Mathematica ant it occupies 4 cpu for 100% long time and appears division on zero. I solved all problems with zero and division on zero by changing total=usr+sys+idle+iow; print int((total-idle)*118/total) to total=1+usr+sys+idle+iow; print int(1+(total-idle)*117/total). Now it works correct without zero length and division on zero.
    – nail
    Jul 22 at 23:33










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454799%2ffvwm-changesize-crashes%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













As discussed in the comments, it seems FvwmScript crashes due to an X error BadValue when the value returned by the shell script is 0. This is probably because it is trying to configure the window to a size of 0.



An alternative solution is to use the HDipstick widget, which is a horizontal bar in a box of fixed length. Here is a short but complete example:



WindowTitle Status
WindowSize 120 30
WindowPosition 900 1
Init
Begin
ChangeBackColor 3 #000
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 2) == 0 Then
Begin
Set $length = (GetOutput bash $HOME/.fvwm/scripts/StaTux/cpu.sh 1 -1)
ChangeValue 3 $length
End
End

Widget 3
Property
Type HDipstick
Value 0
MinValue 0
MaxValue 200
ForeColor #f00
Size 110 20
Position 5 5
Main
Case message of
End


The MinValue and MaxValue set the expected limits on the number you are getting back from your script. I chose 200 arbitrarily. The PeriodicTasks call of your script gets this number and uses ChangeValue to set the Value property to it. It will be scaled by dividing by 200 and multiplying by the width of the horizontal bar, given here in Size as 110 pixels.



When playing with this I noticed a bug in my version of FvwmScript which would draw a full bar for certain low values. For example, setting a MaxValue of 700 meant values 7 to 26 gave a full bar.
enter image description here






share|improve this answer





















  • Yes, it works. I did not know that ChangeValue changes parameter Value. I did not find in man of HDipstick how possible to change geometry of bar. If I set Size 118 1 the bar does not change. For any height it has the same form.
    – nail
    Jul 14 at 19:03










  • It says the minimum size is 30 by 11.
    – meuh
    Jul 14 at 19:07










  • !Valid XHTML
    – nail
    Jul 15 at 21:02











  • Whats a pity. I prefer thin bars !Valid XHTML. Another observation with this script - it must be loaded last. I use dropbox and it is loaded longest and delete bar if they are and I need to restart fvwm do get bars. For this reason I use delay + I Schedule 30000 Module FvwmScript [FVWM_USERDIR]/scripts/StaTux/Status
    – nail
    Jul 15 at 21:12







  • 1




    Appears another problem. I use Mathematica ant it occupies 4 cpu for 100% long time and appears division on zero. I solved all problems with zero and division on zero by changing total=usr+sys+idle+iow; print int((total-idle)*118/total) to total=1+usr+sys+idle+iow; print int(1+(total-idle)*117/total). Now it works correct without zero length and division on zero.
    – nail
    Jul 22 at 23:33














up vote
0
down vote













As discussed in the comments, it seems FvwmScript crashes due to an X error BadValue when the value returned by the shell script is 0. This is probably because it is trying to configure the window to a size of 0.



An alternative solution is to use the HDipstick widget, which is a horizontal bar in a box of fixed length. Here is a short but complete example:



WindowTitle Status
WindowSize 120 30
WindowPosition 900 1
Init
Begin
ChangeBackColor 3 #000
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 2) == 0 Then
Begin
Set $length = (GetOutput bash $HOME/.fvwm/scripts/StaTux/cpu.sh 1 -1)
ChangeValue 3 $length
End
End

Widget 3
Property
Type HDipstick
Value 0
MinValue 0
MaxValue 200
ForeColor #f00
Size 110 20
Position 5 5
Main
Case message of
End


The MinValue and MaxValue set the expected limits on the number you are getting back from your script. I chose 200 arbitrarily. The PeriodicTasks call of your script gets this number and uses ChangeValue to set the Value property to it. It will be scaled by dividing by 200 and multiplying by the width of the horizontal bar, given here in Size as 110 pixels.



When playing with this I noticed a bug in my version of FvwmScript which would draw a full bar for certain low values. For example, setting a MaxValue of 700 meant values 7 to 26 gave a full bar.
enter image description here






share|improve this answer





















  • Yes, it works. I did not know that ChangeValue changes parameter Value. I did not find in man of HDipstick how possible to change geometry of bar. If I set Size 118 1 the bar does not change. For any height it has the same form.
    – nail
    Jul 14 at 19:03










  • It says the minimum size is 30 by 11.
    – meuh
    Jul 14 at 19:07










  • !Valid XHTML
    – nail
    Jul 15 at 21:02











  • Whats a pity. I prefer thin bars !Valid XHTML. Another observation with this script - it must be loaded last. I use dropbox and it is loaded longest and delete bar if they are and I need to restart fvwm do get bars. For this reason I use delay + I Schedule 30000 Module FvwmScript [FVWM_USERDIR]/scripts/StaTux/Status
    – nail
    Jul 15 at 21:12







  • 1




    Appears another problem. I use Mathematica ant it occupies 4 cpu for 100% long time and appears division on zero. I solved all problems with zero and division on zero by changing total=usr+sys+idle+iow; print int((total-idle)*118/total) to total=1+usr+sys+idle+iow; print int(1+(total-idle)*117/total). Now it works correct without zero length and division on zero.
    – nail
    Jul 22 at 23:33












up vote
0
down vote










up vote
0
down vote









As discussed in the comments, it seems FvwmScript crashes due to an X error BadValue when the value returned by the shell script is 0. This is probably because it is trying to configure the window to a size of 0.



An alternative solution is to use the HDipstick widget, which is a horizontal bar in a box of fixed length. Here is a short but complete example:



WindowTitle Status
WindowSize 120 30
WindowPosition 900 1
Init
Begin
ChangeBackColor 3 #000
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 2) == 0 Then
Begin
Set $length = (GetOutput bash $HOME/.fvwm/scripts/StaTux/cpu.sh 1 -1)
ChangeValue 3 $length
End
End

Widget 3
Property
Type HDipstick
Value 0
MinValue 0
MaxValue 200
ForeColor #f00
Size 110 20
Position 5 5
Main
Case message of
End


The MinValue and MaxValue set the expected limits on the number you are getting back from your script. I chose 200 arbitrarily. The PeriodicTasks call of your script gets this number and uses ChangeValue to set the Value property to it. It will be scaled by dividing by 200 and multiplying by the width of the horizontal bar, given here in Size as 110 pixels.



When playing with this I noticed a bug in my version of FvwmScript which would draw a full bar for certain low values. For example, setting a MaxValue of 700 meant values 7 to 26 gave a full bar.
enter image description here






share|improve this answer













As discussed in the comments, it seems FvwmScript crashes due to an X error BadValue when the value returned by the shell script is 0. This is probably because it is trying to configure the window to a size of 0.



An alternative solution is to use the HDipstick widget, which is a horizontal bar in a box of fixed length. Here is a short but complete example:



WindowTitle Status
WindowSize 120 30
WindowPosition 900 1
Init
Begin
ChangeBackColor 3 #000
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 2) == 0 Then
Begin
Set $length = (GetOutput bash $HOME/.fvwm/scripts/StaTux/cpu.sh 1 -1)
ChangeValue 3 $length
End
End

Widget 3
Property
Type HDipstick
Value 0
MinValue 0
MaxValue 200
ForeColor #f00
Size 110 20
Position 5 5
Main
Case message of
End


The MinValue and MaxValue set the expected limits on the number you are getting back from your script. I chose 200 arbitrarily. The PeriodicTasks call of your script gets this number and uses ChangeValue to set the Value property to it. It will be scaled by dividing by 200 and multiplying by the width of the horizontal bar, given here in Size as 110 pixels.



When playing with this I noticed a bug in my version of FvwmScript which would draw a full bar for certain low values. For example, setting a MaxValue of 700 meant values 7 to 26 gave a full bar.
enter image description here







share|improve this answer













share|improve this answer



share|improve this answer











answered Jul 14 at 18:04









meuh

29k11648




29k11648











  • Yes, it works. I did not know that ChangeValue changes parameter Value. I did not find in man of HDipstick how possible to change geometry of bar. If I set Size 118 1 the bar does not change. For any height it has the same form.
    – nail
    Jul 14 at 19:03










  • It says the minimum size is 30 by 11.
    – meuh
    Jul 14 at 19:07










  • !Valid XHTML
    – nail
    Jul 15 at 21:02











  • Whats a pity. I prefer thin bars !Valid XHTML. Another observation with this script - it must be loaded last. I use dropbox and it is loaded longest and delete bar if they are and I need to restart fvwm do get bars. For this reason I use delay + I Schedule 30000 Module FvwmScript [FVWM_USERDIR]/scripts/StaTux/Status
    – nail
    Jul 15 at 21:12







  • 1




    Appears another problem. I use Mathematica ant it occupies 4 cpu for 100% long time and appears division on zero. I solved all problems with zero and division on zero by changing total=usr+sys+idle+iow; print int((total-idle)*118/total) to total=1+usr+sys+idle+iow; print int(1+(total-idle)*117/total). Now it works correct without zero length and division on zero.
    – nail
    Jul 22 at 23:33
















  • Yes, it works. I did not know that ChangeValue changes parameter Value. I did not find in man of HDipstick how possible to change geometry of bar. If I set Size 118 1 the bar does not change. For any height it has the same form.
    – nail
    Jul 14 at 19:03










  • It says the minimum size is 30 by 11.
    – meuh
    Jul 14 at 19:07










  • !Valid XHTML
    – nail
    Jul 15 at 21:02











  • Whats a pity. I prefer thin bars !Valid XHTML. Another observation with this script - it must be loaded last. I use dropbox and it is loaded longest and delete bar if they are and I need to restart fvwm do get bars. For this reason I use delay + I Schedule 30000 Module FvwmScript [FVWM_USERDIR]/scripts/StaTux/Status
    – nail
    Jul 15 at 21:12







  • 1




    Appears another problem. I use Mathematica ant it occupies 4 cpu for 100% long time and appears division on zero. I solved all problems with zero and division on zero by changing total=usr+sys+idle+iow; print int((total-idle)*118/total) to total=1+usr+sys+idle+iow; print int(1+(total-idle)*117/total). Now it works correct without zero length and division on zero.
    – nail
    Jul 22 at 23:33















Yes, it works. I did not know that ChangeValue changes parameter Value. I did not find in man of HDipstick how possible to change geometry of bar. If I set Size 118 1 the bar does not change. For any height it has the same form.
– nail
Jul 14 at 19:03




Yes, it works. I did not know that ChangeValue changes parameter Value. I did not find in man of HDipstick how possible to change geometry of bar. If I set Size 118 1 the bar does not change. For any height it has the same form.
– nail
Jul 14 at 19:03












It says the minimum size is 30 by 11.
– meuh
Jul 14 at 19:07




It says the minimum size is 30 by 11.
– meuh
Jul 14 at 19:07












!Valid XHTML
– nail
Jul 15 at 21:02





!Valid XHTML
– nail
Jul 15 at 21:02













Whats a pity. I prefer thin bars !Valid XHTML. Another observation with this script - it must be loaded last. I use dropbox and it is loaded longest and delete bar if they are and I need to restart fvwm do get bars. For this reason I use delay + I Schedule 30000 Module FvwmScript [FVWM_USERDIR]/scripts/StaTux/Status
– nail
Jul 15 at 21:12





Whats a pity. I prefer thin bars !Valid XHTML. Another observation with this script - it must be loaded last. I use dropbox and it is loaded longest and delete bar if they are and I need to restart fvwm do get bars. For this reason I use delay + I Schedule 30000 Module FvwmScript [FVWM_USERDIR]/scripts/StaTux/Status
– nail
Jul 15 at 21:12





1




1




Appears another problem. I use Mathematica ant it occupies 4 cpu for 100% long time and appears division on zero. I solved all problems with zero and division on zero by changing total=usr+sys+idle+iow; print int((total-idle)*118/total) to total=1+usr+sys+idle+iow; print int(1+(total-idle)*117/total). Now it works correct without zero length and division on zero.
– nail
Jul 22 at 23:33




Appears another problem. I use Mathematica ant it occupies 4 cpu for 100% long time and appears division on zero. I solved all problems with zero and division on zero by changing total=usr+sys+idle+iow; print int((total-idle)*118/total) to total=1+usr+sys+idle+iow; print int(1+(total-idle)*117/total). Now it works correct without zero length and division on zero.
– nail
Jul 22 at 23:33












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454799%2ffvwm-changesize-crashes%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay