Such changes should also be applicable for the treebar
--
Instead of piggybacking off the background command, maybe add a new command & identifer:
/icon -dscqw...xN [iconfile [n]]
Sets the icon for the specified window type with the result of any where such an icon would be displayed the specified one is displayed instead(Switchbar, Treebar, Top-Left corner of window, etc)
-d: Sets the icon as the default for all windows
-s: Sets the icon for status windows
-c: Sets the icon for channel windows
-q: Sets the icon for query windows
-w: Sets the icon for custom windows
-...: and so on for each window type that has a unique icon
-x[n]: Resets the window type's icon; if n is 1, resets all icons and any specified 'default' icon to mIRC's native icons
$icon(dscqw|windowname)[.index]
Returns the iconfile used for the window type or specified window
.index: when specified, returns the index within the iconfile used