Auto-resize stalonetray and fvwmiconman

I have a bottom panel (taskbar). It has stalonetray (for the system tray) and fvwmiconman (to show the open windows.)

Every stalonetray example I have seen requires no_shrink to be enabled

However due to specific reasons for my config in the future (taskbar border styling, etc.) I can’t let it not shrink. It has to auto resize.

I am using FVWM2.

This is my FVWM2 config:

Style "*" ClickToFocus, ClickToFocusRaises, NoIcon
#Exec fvwm-root --dither --retain-pixmap /home/tf/.icewm/wallpapers/enmeshed.png
Emulate Win


EdgeScroll 0 0
DestroyModuleConfig FvwmTaskBar: *

Style "FvwmTaskBar" NoTitle, !Handles, !Borders, Sticky, WindowListSkip, \
  CirculateSkip, FixedPosition, FixedSize, !Iconifiable, StaysOnTop, NeverFocus

*FvwmTaskBar: Geometry $[vp.width]x24+0-0
*FvwmTaskBar: Colorset 15
*FvwmTaskBar: Frame 0
*FvwmTaskBar: Font "xft:Tahoma:size=8:bold:antialias=True"
*FvwmTaskBar: Rows 1
*FvwmTaskBar: Columns $[vp.width]
*FvwmTaskbar: Frame 0


#DestroyFunc IconManClick
#AddToFunc   IconManClick
#+ I ThisWindow (Raised, !Shaded, !Iconic, CurrentPage) Iconify
#+ I TestRc (Match) Break
#+ I ThisWindow (!Raised) Raise
#+ I ThisWindow (Shaded) WindowShade
#+ I ThisWindow (Iconic) Iconify
#+ I ThisWindow (AcceptsFocus) FlipFocus
DestroyFunc IconManClick
AddToFunc IconManClick
#+ I ThisWindow (!Shaded, Iconic) Iconify
+ I ThisWindow (Raised, Visible, Focused, !Shaded, !Iconic, CurrentPage) Iconify
+ I TestRc (Match) Break
+ I ThisWindow (!Raised) Raise
+ I ThisWindow (Shaded) WindowShade
+ I ThisWindow (Iconic) Iconify
+ I ThisWindow (AcceptsFocus) FlipFocus





Read menus

InfoStoreAdd TaskBarWidth $[vp.width]

echo $[infostore.TaskBarWidth]

*TaskBarIcons: IconName TaskBarIcons
*TaskBarIcons: UseWinList true
*TaskBarIcons: Resolution global
*TaskBarIcons: Tips needed
*TaskBarIcons: Font "xft:Tahoma:size=8:antialias=True"

# Manager Size
*TaskBarIcons: ButtonGeometry 50x24
*TaskBarIcons: MaxButtonWidth 200
*TaskBarIcons: ManagerGeometry 1x1

# Button Styles
*TaskBarIcons: DrawIcons always
*TaskBarIcons: ReliefThickness 2
*TaskBarIcons: Format "%t"
*TaskBarIcons: IconButton down
*TaskBarIcons: IconAndSelectButton down
*TaskBarIcons: SelectButton up
*TaskBarIcons: Background #003c3c
*TaskBarIcons: Foreground #ffffff
*TaskBarIcons: PlainColorset 15
*TaskBarIcons: FocusColorset 16
*TaskBarIcons: FocusAndSelectColorset 16
*TaskBarIcons: SelectColorset 16
*TaskBarIcons: IconAndSelectColorset 16

# Button Actions
*TaskBarIcons: Action Mouse 0 N sendcommand Nop
*TaskBarIcons: Action Mouse 1 A sendcommand IconManClick
*TaskBarIcons: Action Mouse 2 A sendcommand Nop
*TaskBarIcons: Action Mouse 3 A sendcommand "Menu MenuIconOps Mouse 0 o100"


# Set EwmhBaseStruts left right top bottom
EwmhBaseStruts 0 0 0 24

# Colorsets
Colorset 15 fg #ffffff, bg #003c3c, hi #005c5c, sh #001c1c
Colorset 16 fg #2d2d2d, bg #ffffff, hi #005c5c, sh #001c1c

# Menu Button
*FvwmTaskBar: (55x1, Frame 2, Title "Fvwm", ActiveColorset 16, Action(Mouse 1) \
               Menu MenuFvwmRoot Root 0 o100-24p, Frame 2)

PipeRead 'echo "InfoStoreAdd TaskBarWidth $(echo '"$[infostore.TaskBarWidth]"' - 55 | bc -l)" '
echo $[infostore.TaskBarWidth]

InfoStoreAdd StartTaskBar 0

DestroyFunc QuickLauncher
AddToFunc QuickLauncher
+ I *FvwmTaskBar: (25x1, Frame 0, Icon "$0", ActiveColorset 16, \
                   Action(Mouse 1) "Exec exec $1")

echo $[infostore.TaskBarWidth]

#+ I InfoStoreAdd StartTaskBar2 {PipeRead "echo "$[infostore.StartTaskBar} + 25""}
#InfoStoreRemove StartTaskBar2


#+ I InfoStoreAdd StartTaskBar2 t
#infostore.StartTaskbar


QuickLauncher "icons/mini/xterm.png" xterm
PipeRead 'echo "InfoStoreAdd TaskBarWidth $(echo '"$[infostore.TaskBarWidth]"' - 25 | bc -l)" '
QuickLauncher "icons/mini/gimp.png" gimp
PipeRead 'echo "InfoStoreAdd TaskBarWidth $(echo '"$[infostore.TaskBarWidth]"' - 25 | bc -l)" '
PipeRead 'echo "InfoStoreAdd TaskBarWidth $(echo '"$[infostore.TaskBarWidth]"' - 160 | bc -l)" '


# Quick Launch Buttons
#*FvwmTaskBar: (25x1, Frame 0, Icon "icons/mini/xterm.png", ActiveColorset 16, \
#               Action(Mouse 1) "Exec exec xterm")
#*FvwmTaskBar: (25x1, Frame 0, Icon "icons/mini/firefox.png", ActiveColorset 16, \
#               Action(Mouse 1) "Exec exec gimp")
#*FvwmTaskBar: (25x1, Frame 0, Icon "icons/mini/xteddy.png", ActiveColorset 16, \
#               Action(Mouse 1) "Exec exec xteddy")

# Swallow FvwmIconMan TaskBarIcons


*FvwmTaskBar: ($[infostore.TaskBarWidth]x1, Frame 0, Left, Swallow TaskBarIcons 'Module FvwmIconMan \
               TaskBarIcons')

# Time Button with id TaskTime
#*FvwmTaskBar: (120x1, Right, Frame 0, Swallow(NoClose, UseOld) stalonetray \
#               'Exec exec stalonetray', Frame 0)
#*FvwmTaskBar: (40x1-40-0, Frame 0, id "TaskTime", ActiveColorset 16, Swallow stalonetray 'Exec stalonetray &')
Style stalonetray FixedPosition
*FvwmTaskBar: (120x1, Swallow(NoClose, UseOld) stalonetray \
               'Exec exec stalonetray', Frame 0)
*FvwmTaskBar: (40x1-0-0, Frame 0, id "TaskTime", ActiveColorset 16, Swallow FvwmClock 'Exec xclock -bg "#003c3c" -fg "#ffffff" -padding 5 -name FvwmClock -face "Tahoma:size=8" -digital -strftime '%R' &')

#*FvwmTaskBar: (1x1-1-1, Frame 0, id "Tray", ActiveColorset 16, Swallow stalonetray 'Exec stalonetray --slot-size=20 --icon-size=16 --decorations=all --window-type=normal --geometry=1x1 --window-strut=none --parent-bg &')

#*FvwmTaskBar: (1x1, Frame 0)

Module FvwmButtons FvwmTaskBar

#   1 - Inactive Windows 
#   2 - Active Window
#   3 - Inactive Windows Borders
#   4 - Active Windows Borders
Colorset 1 fg rgb:00/00/00, bg rgb:80/80/80
Colorset 2 fg rgb:00/00/00, bg rgb:90/90/90
Colorset 3 fg rgb:00/00/00, bg rgb:80/80/80
Colorset 4 fg rgb:00/00/00, bg rgb:90/90/90

# Window Button Locations [1 Title 642]
Mouse 1 2 A Close
Mouse 1 4 A Maximize
Mouse 1 6 A Iconify
Mouse 1 1 A Menu MenuWindowOps



AddToDecor QNXDecor
+ TitleStyle Active MultiPixmap \
        Main     qnx/title-main-active.png, \
        LeftEnd  qnx/title-leftend-active.png, \
        RightEnd qnx/title-rightend-active.png
+ TitleStyle Inactive MultiPixmap \
        Main     qnx/title-main-inactive.png, \
        LeftEnd  qnx/title-leftend-inactive.png, \
        RightEnd qnx/title-rightend-inactive.png
+ ButtonStyle All -- UseTitleStyle
+ BorderStyle Simple -- HiddenHandles !NoInset Raised
+ TitleStyle LeftJustified -- Flat
+ ButtonStyle All -- Flat
+ AddButtonStyle 1 \
        ActiveUp   (Pixmap qnx/options-activeup.png   -- flat) \
        ActiveDown (Pixmap qnx/options-activedown.png -- flat) \
        Inactive   (Pixmap qnx/options-inactive.png   -- flat)
+ AddButtonStyle 2 \
        ActiveUp   (Pixmap qnx/close-activeup.png   -- flat) \
        ActiveDown (Pixmap qnx/close-activedown.png -- flat) \
        Inactive   (Pixmap qnx/close-inactive.png   -- flat)
+ AddButtonStyle 4 \
        ActiveUp   (Pixmap qnx/maximize-activeup.png   -- flat) \
        ActiveDown (Pixmap qnx/maximize-activedown.png -- flat) \
        Inactive   (Pixmap qnx/maximize-inactive.png   -- flat)
+ AddButtonStyle 6 \
        ActiveUp   (Pixmap qnx/iconify-activeup.png   -- flat) \
        ActiveDown (Pixmap qnx/iconify-activedown.png -- flat) \
        Inactive   (Pixmap qnx/iconify-inactive.png   -- flat)
+ AddButtonStyle 4 \
        ToggledActiveUp   (Pixmap qnx/maximize-activedown.png -- flat) \
        ToggledActiveDown (Pixmap qnx/maximize-activeup.png   -- flat) \
        ToggledInactive   (Pixmap qnx/maximize-inactive.png   -- flat)
+ ButtonStyle All - Clear
+ TitleStyle Height 20



Style * Colorset 1, HilightColorset 2, \
        BorderColorset 3, HilightBorderColorset 4, \
        BorderWidth 4, HandleWidth 4, \
        FvwmBorder, FirmBorder, \
        MWMButtons, UseDecor QNXDecor



 ColorSet 10 RootTransparent Buffer, fg white, bg black 

# FvwmButtons icon launcher:
DestroyFunc Launcher
AddToFunc Launcher
+ I DestroyModuleConfig "$0Launch": *
+ I *$0Launch: Geometry 64x68
+ I *$0Launch: Columns 1
+ I *$0Launch: Rows    4
+ I *$0Launch: Frame   0
+ I *$0Launch: (1x3+0+0, ColorSet 10, Icon "$2", Action (Mouse 1) `Exec exec "$3"`)
+ I *$0Launch: Pixmap none
+ I *$0Launch: (1x1+0+3, Font "xft:Tahoma:size=8:antialias=True" , ColorSet 10 \
                Title "$1", Action (Mouse 1) `Exec exec "$3"`)
+ I Style "$0Launch" HandleWidth 0, NoTitle, NeverFocus, WindowListSkip, CirculateSkip, !Iconifiable, StaysOnBottom
+ I Module FvwmButtons $4 $0Launch
+ I UpdateStyles

#DestroyFunc Launcher
#AddToFunc Launcher
#+ I DestroyModuleConfig $0Launch: *
#+ I *$0Launch: Geometry 64x68
#+ I *$0Launch: Columns 1
#+ I *$0Launch: Rows    4
#+ I *$0Launch: Frame   0
#+ I *$0Launch: (1x3+0+0, Icon $1, Action (Mouse 1) `Exec exec $2`)
#+ I *$0Launch: Pixmap none
#+ I *$0Launch: (1x1+0+3, Font 9x15, Fore White, Back DarkBlue, \
#                Title $0, Action (Mouse 1) `Exec exec $2`)
#+ I Style $0Launch HandleWidth 0, NoTitle
#+ I Module FvwmButtons $3 $0Launch
#+ I UpdateStyles
    
# Examples:
Launcher "comp" "My Computer" "/home/tf/.fvwm2/computer.xpm" "xfe" "-g +0+0"
#Launcher "Computer" "/home/tf/.fvwm2/computer." "xfe" "-g +0+0"
#Launcher "trash" "Recycle Bin"   trash.xpm    "xfe "$HOME/.local/share/Trash/files""   "-g +0+100"

Thank you.

Looking at your config I came across this:

As you can see, you have a static size set for this button in question. This means that either way, with or without no_shrink, that button, per se will always use 120, as you set it. This is the default behavior. In theory you could set BoxSize to Smart to deal with this in the cases where stalonetray gets bigger than 120.

According to stalonetray man pages, when stalonetray is going to be swallow by another windows, as is your case, is suggested that no_shrink must be set to true. This is most likely due the way FvwmButtons works and possible issues with geometry and gravity. I can’t say for certain. If the fellows of stalonetray added this feature and state in the man pages that the option should be use when stalonetray is going to be swallowed must be for a good reason. You could ask them why.

An alternative solution could be to set stalonetray to a sensible size and leave it static. I would recommend using the scrollbar option offered by stalonetray in case you run out of space. Is not, perhaps, an ideal solution, but it would be a simple one.

[quote=“0penrc”]
However due to specific reasons for my config in the future (taskbar border styling, etc.) I can’t let it not shrink. It has to auto resize.[/quote]

This isn’t how swallowing works in FvwmButtons. Clients are free to resize themselves, but that doesn’t mean anything. In your specific example of stalonetray, its window gravity is dictating its behaviour, hence why you need no_shrink. So your “specific reasons” don’t apply here.

Use fvwm3.

– Thomas