This is not a bug of xfce4-panel per se, but with the new defaults the panel loads the power manager plugin, and the power manager itself has the tray icon enabled by default which makes it duplicate in the panel.
This is not ideal, I agree. However I'm not sure how to resolve the problem. The new defaults mean: if the power manager panel plugin is installed, it will show up. E.g. in Ubuntu xfpm and the panel plugin are in separate packages. The trayicon is shown by default to make sure the user sees the battery status for sure after starting xfpm. I would expect distributors to resolve this by deciding whether to use the trayicon or the panel plugin by default. E.g. in Xubuntu we opted in for the panel plugin a long time ago. The only other option I can think of is letting the panel plugin disable the trayicon. But that may also be unexpected for users.
I agree that the tray icon should be enabled because people use Xfce power manager outside Xfce. The panel plugin is part of Xfce-power-manager, so in spite of Xubuntu splitting it, other OS's and distros might not. So the most logical thing would be leaving only the tray icon as default, or else the distributions would all have to tweak the Xfce defaults to work around that. As for the panel plugin disabling the tray icon, I think xfce4-clipman-plugin does that (if the panel plugin isn't used, it uses the tray icon). I think in any case the panel plugins are better because they load much faster, and the tray icons are there because the Xfce apps are used outside Xfce or with other panels. - In summary, if it's feasible, in this scenario the best approach would be to disable the tray icon when using the Xfce panel plugin.
Created attachment 8776 Disable trayicon when plugin is present I've created a patch for this, the panel plugin simply disables the trayicon on startup. While it gets the job done, users who also have the panel plugin and enable the trayicon in the settings (this is actually possible, as the disabling is only done during plugin startup) may be confused because it will be gone again on restarting the session. Not sure how to resolve that. (Ideally the systray option would be insensitive when the plugin is present, but that's not so easily do-able, I think.)
I like the "disable tray icon by default when panel plugin is started" approach.
I a bit late in the the conversation, I like the approach of disabling the systray icon if the panel plugin is already present. The panel plugin is the default choice in openSUSE Xfce and will remain so unless upstream decides to drop the plugin in favour of the tray.
For Debian I guess it's the same thing as other distros: if the panel plugin is active, then inhibiting the systray makes sense. On Debian Xfce installs the plugin is installed by default (it's actually installed by default when the power manager is installed).
Simon Steinbeiss referenced this bugreport in commit 6e9c6ef3f1a291810b79aec6449219022c206a9d Disable trayicon when panel plugin is present (Bug #15682) https://git.xfce.org/xfce/xfce4-power-manager/commit?id=6e9c6ef3f1a291810b79aec6449219022c206a9d
Thanks for your feedback! Pushed.
*** Bug 14279 has been marked as a duplicate of this bug. ***