Use a script twice in a FvwmButton

Hello!

I want to same Swallow a script twice in one of my FvwmButton.

*place: (4x1, Swallow fvwm-showsize `FvwmScript $[FVWM_USERDIR]/seed/scripts/fvwm-showsize "earth:/Qdownload"`)
*place: (4x1, Swallow fvwm-showsize `FvwmScript $[FVWM_USERDIR]/seed/scripts/fvwm-showsize "earth:/Qmultimedia"`)

I think I need to make an alias for the second script but I’m not sure how I can do it.

Any hints?

Regards.

Did you actually try this? It works fine.

– Thomas Adam

Hello Thomas,

Yes it work, but I need to swallow it in a correct order.

Actually, I use the script 3 times (PS, this is not completed).

Style "place" !Title, !Handles, Sticky, CirculateSkip, StaysOnBottom, FixedPosition, !Iconifiable, WindowListSkip, BorderWidth 0
DestroyModuleConfig place: *
*place: Geometry 240x425+0+220
*place: Padding 0 0 
*place: Colorset 13
*place: Rows 17
*place: Columns 8
*place: BoxSize fixed
*place: Frame 0
*place: Font "Shadow=0:xft:M+ 2p:size=10:bold:antialias=True"

*place: (2x2, Icon place/home.png)
*place: (4x1, Title (Left) " /home")
*place: (2x2, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /home/shaika-dzari)
*place: (4x1, Swallow (SwallowNew) fvwm-showsize `FvwmScript $[FVWM_USERDIR]/seed/scripts/fvwm-showsize "/dev/sda2"`)
*place: (2x2, Icon place/network_local.png)
*place: (4x1, Title (Left) " nfs://Download")
*place: (2x2, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /mnt/earth-download/)
*place: (4x1, Swallow (SwallowNew) fvwm-showsize `FvwmScript $[FVWM_USERDIR]/seed/scripts/fvwm-showsize "earth:/Qdownload"`)
*place: (2x2, Icon place/network_local.png)
*place: (4x1, Title (Left) " nfs://Multimedia")
*place: (2x2, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /mnt/earth-multimedia/)
*place: (4x1, Swallow (SwallowNew) fvwm-showsize `FvwmScript $[FVWM_USERDIR]/seed/scripts/fvwm-showsize "earth:/Qmultimedia"`)
* ...

They have the same windows title and sometime the swallowing order is wrong.
Like this :
glowfoto.com/static_image/08 … 6/glowfoto

14G/20G should be the first value, the disk usage of /dev/sda2.

I hope what I say make sense. Sorry :frowning:

Thanks for your help.

Ah – you never said that to me before. :slight_smile:

You’re going to have to break down and give them unqiue titles then in the FvwmScript itself.

WindowTitle fvwm-showsizeA
WindowTitle fvwm-showsizeB

Besides which, the names at this point should be meaningless because you’re reparenting the window in FvwmButtons, so you’re never going to see the window title.

You can’t, of course, just use the global Style condition of “IndexedWindowName”, because that doesn’t guarantee your scripts are going to be loaded in the order you want them in your FvwmButtons.

– Thomas Adam

Hello!

Instead of duplicating my script, I tried another solution.

I made a big script who get all necessary values and use SendToModule to set each part of my FvwmButton.

The script:

WindowTitle {scriptShowSize.fvwm}
WindowSize  105 12
Font		"Shadow=0:xft:M+ 2p:size=8:bold:antialias=True"
Colorset 13

Init
    Begin
	# Call to the script
	Set $cmd 	= {exec sh $FVWM_USERDIR/seed/scripts/showsize.sh }

	# Partitions
	Set $sda1 	= $cmd {/dev/sda1}
	Set $sda2 	= $cmd {/dev/sda2}
	Set $sda5 	= $cmd {/dev/sda5}
	Set $sda7 	= $cmd {/dev/sda7}
	Set $nfsMulti 	= $cmd {earth:/Qmultimedia}
	Set $nfsDown 	= $cmd {earth:/Qdownload}
	
	# Get value
	Set $osda1 	= (GetOutput $sda1 1 -1)
	Set $osda2 	= (GetOutput $sda2 1 -1)
	Set $osda5 	= (GetOutput $sda5 1 -1)
	Set $osda7 	= (GetOutput $sda7 1 -1)
	Set $onfsMulti = (GetOutput $nfsMulti 1 -1)
	Set $onfsDown 	= (GetOutput $nfsDown 1 -1)
	
	# Set My button title
	Do {SendToModule "place" ChangeButton dd1 Title "} $osda2 {"}
	Do {SendToModule "place" ChangeButton dd2 Title "} $onfsMulti {"}
	Do {SendToModule "place" ChangeButton dd3 Title "} $onfsDown {"}
	Do {SendToModule "place" ChangeButton dd4 Title "} $osda5 {"}
	Do {SendToModule "place" ChangeButton dd5 Title "} $osda7 {"}
	Do {SendToModule "place" ChangeButton dd6 Title "} $osda1 {"}
    End

PeriodicTasks
    Begin 
	If (RemainderOfDiv (GetTime) 60)==0 Then
	Begin
	    # Get value
	    Set $osda1 	= (GetOutput $sda1 1 -1)
	    Set $osda2 	= (GetOutput $sda2 1 -1)
	    Set $osda5 	= (GetOutput $sda5 1 -1)
	    Set $osda7 	= (GetOutput $sda7 1 -1)
	    Set $onfsMulti = (GetOutput $nfsMulti 1 -1)
	    Set $onfsDown 	= (GetOutput $nfsDown 1 -1)
	    
	    # Set My button title
	    Do {SendToModule "place" ChangeButton dd1 Title "} $osda2 {"}
	    Do {SendToModule "place" ChangeButton dd2 Title "} $onfsMulti {"}
	    Do {SendToModule "place" ChangeButton dd3 Title "} $onfsDown {"}
	    Do {SendToModule "place" ChangeButton dd4 Title "} $osda5 {"}
	    Do {SendToModule "place" ChangeButton dd5 Title "} $osda7 {"}
	    Do {SendToModule "place" ChangeButton dd6 Title "} $osda1 {"}
	End
End

Widget 1
Property
 Position 0 0
 Size 105 24
 Type ItemDraw
 Flags NoReliefString Left
Main
  Case message of
    SingleClic :
  Begin
  End
End

And my button look like this:

#------------------------------------------------------------------------
# Place
#------------------------------------------------------------------------
Style "place" !Title, !Handles, Sticky, CirculateSkip, StaysOnBottom, FixedPosition, !Iconifiable, WindowListSkip
DestroyModuleConfig place: *
*place: Geometry 240x425+0+220
*place: Padding 0 0 
*place: Colorset 13
*place: Rows 31
*place: Columns 8
*place: BoxSize fixed
*place: Frame 0
#*place: Left
*place: Font "Shadow=0:xft:M+ 2c:size=9:bold:antialias=True"
*place: (2x4, Icon place/stock_folder.png)
*place: (4x2, Title " /root")
*place: (2x4, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /)
*place: (4x2, Id dd6, Title " ")
*place: (8x1, Title " ")
*place: (2x4, Icon place/home.png)
*place: (4x2, Title " /home")
*place: (2x4, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /home/shaika-dzari)
*place: (4x2, Id dd1, Title " ")
*place: (8x1, Title " ")
*place: (2x4, Icon place/network_local.png)
*place: (4x2, Title " nfs://Download")
*place: (2x4, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /mnt/earth-download/)
*place: (4x2, Id dd2, Title " ")
*place: (8x1, Title " ")
*place: (2x4, Icon place/network_local.png)
*place: (4x2, Title " nfs://Multimedia")
*place: (2x4, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /mnt/earth-multimedia/)
*place: (4x2, Id dd3, Title " ")
*place: (8x1, Title " ")
*place: (2x4, Icon place/folder-video.png)
*place: (4x2, Title " /Multi")
*place: (2x4, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /mnt/multi/)
*place: (4x2, Id dd4, Title " ")
*place: (8x1, Title " ")
*place: (2x4, Icon place/folder-downloads.png)
*place: (4x2, Title " /Torrent")
*place: (2x4, Icon place/go.png, Action(Mouse 1) Exec exec $[filemanager] /mnt/torrents/)
*place: (4x2, Id dd5, Title " ")
*place: (8x2, Swallow scriptShowSize.fvwm `FvwmScript $[FVWM_USERDIR]/seed/scripts/scriptShowSize.fvwm`)

Work great! :smiley:
The only thing I was unable to do is to align the text inside my button to left.
If I use *place: Left, my FvwmButton crash. No big deal.

Thanks again for your help Thomas :slight_smile:

Regards.

No – this has nothing to do with ensuring swallow order though. Why don’t people listen anymore?

It is for me. So get me a corefile, an example config which exhibits this problem, and/or a stacktrace from a corefile.

That remains to be seen.

– Thomas Adam

Sorry Thomas.
When you said “You’re going to have to break down and give them unqiue titles then in the FvwmScript itself” what I understood is == duplicating my script
for each time I want to swallow it. Be sure I listen to you. Your help is always precious.

I get the crash with the config below (My FvwmButton named place).
I can upload all my config if you want.

I tried to get a stack but I did not get any. I used this:

ulimit -c unlimited
startx
gdb fvwm ./core
bt

But, I can see a message from my button when I startx.

[pts/0][shaika-dzari]>tail -f ~/startx.log
place: Button too tall. Giving up
Button=234 num_rows=31 bheight=4 h=29
place: Button too tall. Giving up
Button=240 num_rows=31 bheight=2 h=30
place: Button confusion! Quitting

It look like an error in my config. :confused:

Yes – hence why there’s no corefile. Check your column/row definitions with the widths you’re giving your buttons. I suspect your maths is out.

– Thomas Adam