Adding Icon Dynamically to Dock

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.

http://fvwmforums.org/wiki/Tips/IconsOnDesktop/

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.