Adding Icon Dynamically to Dock

Hello all,

I am running DevMon to automatically mount usb drives. I would like to dynamically add an icon on my dock if a drive is inserted and removed when a drive is removed or unmounted. I was thinking about maybe clicking the icon to unmount the drive as I am not a big fan of just pulling out the drive although using Sync for ext drives or flush for vfat drives is an option.

Can this be done using SendToModule? I have been looking for some examples online but I haven’t found any.

+ I module FvwmButtons FvwmDock

Style FvwmDock NoTitle, StaysOnTop, Sticky, WindowListSkip,
CirculateSkipIcon, CirculateSkip, HandleWidth 0, BorderWidth 0,
NeverFocus, Layer 1

DestroyModuleConfig FvwmDock: *
*FvwmDock: BoxSize fixed
*FvwmDock: Colorset 1
*FvwmDock: Rows 8

*FvwmDock: Columns 101
*FvwmDock: Geometry 1920x50+0+0
*FvwmDock: Padding 0 0
*FvwmDock: Frame 0

show main menu


start terminator

*FvwmDock: (3x8+3+0, ActionOnPress,
Icon $[fvwm_app_icons]/terminator.svg:24x24,
ActiveIcon $[fvwm_app_icons]/terminator.svg:48x48,
Action(Mouse 1) exec exec $[fvwm_term], [/code]

Thank you,

I don’t think you can add/remove icons from FvwmButtons without reconfiguring the buttons and relaunching them.

An alternative is to make a single button for each drive. And then place them on your desktop somewhere. Something along the lines of the following link may help.

Then use FvwmCommand to launch a button with a custom function like the one above each time a drive is installed, you can also use FvwmCommand to kill the buttons as well. Though this may not be as nice as adding an icon to your current Dock.

Another empty buttons reserved on your dock for the drives. Then use SendToModule to change the icon and active the buttons when a drive is installed or removed.

I’m unsure but maybe there is a program that does this already and lives in a system tray. In that case you could just swallow a system tray and let some third party app handle controlling of these auto mount drives.

These are just some suggestions.