Skip to content

Fix taskbar/Activities generic icon on Linux (Console, Map, Mission Editor) / fixes #1667 - #1710

Open
asikarastallion wants to merge 3 commits into
ArduPilot:masterfrom
asikarastallion:fix/taskbar-icons-1667
Open

Fix taskbar/Activities generic icon on Linux (Console, Map, Mission Editor) / fixes #1667#1710
asikarastallion wants to merge 3 commits into
ArduPilot:masterfrom
asikarastallion:fix/taskbar-icons-1667

Conversation

@asikarastallion

@asikarastallion asikarastallion commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Fixes the generic "gear" taskbar/Activities icon reported in #1667. There were two independent root causes:

  1. Mission Editor never set a window icon at all. MissionEditorFrame (MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py) never called SetIcon(), unlike ConsoleFrame and the Map window, which both call icon.SimpleIcon(...).get_ico(). Added a "WP" icon variant (numbered waypoint route) to MAVProxy/modules/lib/icon.py and set it on MissionEditorFrame, mirroring the existing Console/Map pattern.

  2. 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 .desktop file whose StartupWMClass matches the window's WM_CLASS, not from wx.Frame.SetIcon() at runtime — see wxWidgets/wxWidgets#24034. MAVProxy shipped shortcuts/mavproxy.desktop, but nothing installed it (not even pip install), and it had no StartupWMClass, 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) to SimpleIcon.
  • MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py: call self.SetIcon(icon.SimpleIcon("WP").get_ico()) right after wx.Frame.__init__(), wrapped in the same try/except pattern wxconsole_ui.py already uses.
  • shortcuts/mavproxy.desktop: add StartupWMClass=mavproxy.py, matching the actual WM_CLASS MAVProxy's windows report (confirmed via xprop WM_CLASS against live Console/Map windows).
  • MAVProxy/tools/install_desktop_icons.py: new opt-in helper (python3 -m MAVProxy.tools.install_desktop_icons) that copies the .desktop files to ~/.local/share/applications and the icons to ~/.local/share/icons/hicolor/256x256/apps (the standard freedesktop icon theme location — the old ~/.icon path documented in the README is not searched by GTK), then best-effort refreshes the desktop/icon caches. Not run automatically by pip 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+F2r on X11, log out/in on Wayland) to pick up a newly-installed .desktop file for icon caches.

Root cause verification

  • xprop WM_CLASS against running Console and Map windows: both report WM_CLASS(STRING) = "mavproxy.py", "Mavproxy" — confirming the value now set as StartupWMClass.
  • xprop ... _NET_WM_ICON on a Mission Editor window created via the patched MissionEditorFrame shows a correctly-set 128×128 icon (previously absent entirely).
  • Tested on Ubuntu 24.04 / GNOME (X11 session): before the fix, Console and Map showed the generic gear icon in Alt-Tab; after running the installer script and restarting GNOME Shell, both showed the correct MAVProxy icon.

Note on Mission Editor GUI verification

While testing, I found that under MAVProxy's normal module load misseditor / wp editor flow, the Mission Editor's window sometimes never appears at all — the child process (spawned via multiprocessing.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 modify mission_editor.py. I verified the SetIcon() fix itself works correctly by instantiating MissionEditorFrame directly in an unforked process (matching exactly how child_task constructs 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

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
Copilot AI review requested due to automatic review settings July 24, 2026 21:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Taskbar icons not present on Ubuntu

2 participants