Skip to content

Instantly share code, notes, and snippets.

@agtbaskara
Created August 27, 2026 01:28
Show Gist options
  • Select an option

  • Save agtbaskara/ba03022690fe50c4f576da014ff1e1be to your computer and use it in GitHub Desktop.

Select an option

Save agtbaskara/ba03022690fe50c4f576da014ff1e1be to your computer and use it in GitHub Desktop.
Brave Duplicate Icon Fix (Ubuntu 22.04 / X11)

Brave Duplicate Icon Fix (Ubuntu 22.04 / X11)

Problem

Launching Brave creates a separate dock icon instead of using the pinned favorite.

Cause

Brave ships two desktop files that both declare StartupWMClass=brave-browser:

  • brave-browser.desktop — visible (the one you pin)
  • com.brave.Browser.desktop — hidden (NoDisplay=true)

On X11, GNOME binds the window to the hidden one, so it can't attach to the pinned icon → duplicate. (On Wayland it binds to the visible one, so no duplicate.)

Fix (keep X11)

Give the hidden twin its own WM class via a user override:

cp /usr/share/applications/com.brave.Browser.desktop ~/.local/share/applications/
sed -i 's/^StartupWMClass=brave-browser/StartupWMClass=com.brave.Browser/' ~/.local/share/applications/com.brave.Browser.desktop
gsettings set org.gnome.shell favorite-apps "['org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'brave-browser.desktop']"
update-desktop-database ~/.local/share/applications

Verify (should print StartupWMClass=com.brave.Browser):

grep StartupWMClass ~/.local/share/applications/com.brave.Browser.desktop

Then reboot, quit Brave fully, and launch from the pinned icon → single icon.

Notes

  • User override in ~/.local/share/applications/ survives Brave updates.
  • Alternative fix: switch the session to Ubuntu on Wayland at the login screen (no file edits).
  • Check session type with: echo $XDG_SESSION_TYPE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment