Fix taskbar/Activities generic icon on Linux (Console, Map, Mission Editor) / fixes #1667 - #1710
Fix taskbar/Activities generic icon on Linux (Console, Map, Mission Editor) / fixes #1667#1710asikarastallion wants to merge 3 commits into
Conversation
MissionEditorFrame never called SetIcon(), unlike the Console and Map windows which both use icon.SimpleIcon(...).get_ico(). This left the Mission Editor with no window icon at all. Add a "WP" icon variant (numbered waypoint route) to SimpleIcon and set it on MissionEditorFrame right after wx.Frame.__init__(), mirroring the existing try/except pattern used by wxconsole_ui.py. Related to ArduPilot#1667
GNOME's taskbar/Alt-Tab icon for a window comes from an installed .desktop file matching the window's WM_CLASS, not from the runtime SetIcon() call alone (see wxWidgets/wxWidgets#24034). MAVProxy shipped shortcuts/mavproxy.desktop but nothing installed it, and it had no StartupWMClass, so it never matched. - Add StartupWMClass=mavproxy.py to shortcuts/mavproxy.desktop (confirmed via `xprop WM_CLASS` against a running Console/Map window) - Add MAVProxy/tools/install_desktop_icons.py to copy the .desktop files and icons into ~/.local/share/{applications,icons/...} (pip install cannot do this reliably, especially into a venv) - Update shortcuts/ReadMe.md with corrected instructions Verified on Ubuntu 24.04 / GNOME (X11): before the fix, Console and Map showed a generic gear icon in Alt-Tab; after installing and restarting GNOME Shell (Alt+F2 -> r), both show the correct MAVProxy icon. Fixes ArduPilot#1667
E127 continuation line over-indented for visual indent
1d2f237 to
6dc1e35
Compare
|
Automated review note — AI-generated (Claude), validated against the live diff. Please sanity-check before acting. Reviewed at head Good news first, because it's the part most likely to be silently wrong and it isn't: The blocker: the command your ReadMe tells users to run doesn't exist in a pip install. And even if it were importable, The fix is small: move Two things that affect what this actually achieves. The Mission Editor icon won't appear in the GNOME taskbar regardless: console, map and mission editor all run as Worth knowing: no CI ran on this PR at all. Minor: the installer hardcodes |
Summary
Fixes the generic "gear" taskbar/Activities icon reported in #1667. There were two independent root causes:
Mission Editor never set a window icon at all.
MissionEditorFrame(MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py) never calledSetIcon(), unlikeConsoleFrameand the Map window, which both callicon.SimpleIcon(...).get_ico(). Added a"WP"icon variant (numbered waypoint route) toMAVProxy/modules/lib/icon.pyand set it onMissionEditorFrame, mirroring the existing Console/Map pattern.GNOME/GTK3 doesn't use the runtime icon for the taskbar/Activities view at all. This is a documented GTK3/GNOME behavior, not a MAVProxy bug: the taskbar icon for a running window comes from an installed
.desktopfile whoseStartupWMClassmatches the window'sWM_CLASS, not fromwx.Frame.SetIcon()at runtime — see wxWidgets/wxWidgets#24034. MAVProxy shippedshortcuts/mavproxy.desktop, but nothing installed it (not evenpip install), and it had noStartupWMClass, so GNOME never matched it to the running window and fell back to a generic icon.Changes
MAVProxy/modules/lib/icon.py: add a"WP"icon (dashed route with numbered waypoint markers) toSimpleIcon.MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py: callself.SetIcon(icon.SimpleIcon("WP").get_ico())right afterwx.Frame.__init__(), wrapped in the sametry/exceptpatternwxconsole_ui.pyalready uses.shortcuts/mavproxy.desktop: addStartupWMClass=mavproxy.py, matching the actualWM_CLASSMAVProxy's windows report (confirmed viaxprop WM_CLASSagainst live Console/Map windows).MAVProxy/tools/install_desktop_icons.py: new opt-in helper (python3 -m MAVProxy.tools.install_desktop_icons) that copies the.desktopfiles to~/.local/share/applicationsand the icons to~/.local/share/icons/hicolor/256x256/apps(the standard freedesktop icon theme location — the old~/.iconpath documented in the README is not searched by GTK), then best-effort refreshes the desktop/icon caches. Not run automatically bypip install, since pip can't reliably write to XDG user directories (especially into a venv, as in the original report).shortcuts/ReadMe.md: corrected install instructions, points at the new script, and notes that GNOME Shell may need a restart (Alt+F2→ron X11, log out/in on Wayland) to pick up a newly-installed.desktopfile for icon caches.Root cause verification
xprop WM_CLASSagainst running Console and Map windows: both reportWM_CLASS(STRING) = "mavproxy.py", "Mavproxy"— confirming the value now set asStartupWMClass.xprop ... _NET_WM_ICONon a Mission Editor window created via the patchedMissionEditorFrameshows a correctly-set 128×128 icon (previously absent entirely).Note on Mission Editor GUI verification
While testing, I found that under MAVProxy's normal
module load misseditor/wp editorflow, the Mission Editor's window sometimes never appears at all — the child process (spawned viamultiprocessing.Process, i.e.fork()) hangs indefinitely with zero output, even before its first line executes. This reproduces with or without this PR's changes (confirmed against the unmodified upstream code too), and matches the classic "fork() after a multi-threaded process has initialized GTK/holds a stdio lock" deadlock hazard — Console and Map run in the main process and are unaffected, but Mission Editor is deliberately forked into a child process (a workaround for an old macOS-specific wx issue, per the existing code comment). This is not something this PR touches or fixes; I did not modifymission_editor.py. I verified theSetIcon()fix itself works correctly by instantiatingMissionEditorFramedirectly in an unforked process (matching exactly howchild_taskconstructs it), which reliably shows the window with the icon set. I'll file a separate issue for the forking hang since it's a pre-existing, unrelated bug.AI assistance disclosure: This contribution was developed with the assistance of Claude (Anthropic) — both the conversational assistant and Claude Code. Claude helped investigate the root cause, draft the code changes, and prepare this PR description; I reviewed the diff, understand the change, and personally verified the testing results described above on my own machine.
Fixes #1667