3

I have created a .desktkop file to open GitHub using brave browser

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=GitHub
GenericName=GitHub
Comment=Github desktop app
Exec=/opt/brave.com/brave/brave-browser --profile-directory="Default" --app=https://github.com/
Icon=/home/parag/.icons/github-desktop.svg
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Categories=Network;Application;
Keywords=Github;gitapp;
X-Ubuntu-Gettext-Domain=Github

But the problem is that it comes as an instance of the browser with the browser icon in the sidebar.

enter image description here

I want it to show its own icon in the sidebar instead of the browser icon.

Is there any way to do it??

thanks in advance :))

Edit 1

I tryed Alt+F2 and typed lg and go to the windows section and here is the output

enter image description here

here WhatsApp opens as desired (with its own icon in the sidebar) but Github doesn't.

The only difference here is that app field for WhatsApp shows the desktop filename while for Github it shows the browser's desktop file name.

So does this mean that a desktop file opening a website will have its separate icon if only if the website is a web app?

Parag Katoch
  • 1,213
  • I don’t thing .svg files are supported for this use case, just PNGs that do not exceed 512px on any side. I have not tested non-PNG icons on newer versions of Ubuntu, though … – matigo Jul 11 '21 at 06:55
  • @matigo I think it works, actually, I have also created one .destkop for WhatsApp which works perfectly fine with a separate icon in the sidebar – Parag Katoch Jul 11 '21 at 08:15
  • 1
    You will need to see if you can start Brave with a different window class. If you then also specify that windowclass in your .desktop launcher, it will appear as a separate icon. – vanadium Jul 11 '21 at 14:01
  • @vanadium you mean startupVMClass like this https://askubuntu.com/a/1113914/1112104 ? – Parag Katoch Jul 11 '21 at 14:28
  • thanks found the way – Parag Katoch Jul 11 '21 at 14:52

1 Answers1

4

This method is applicable on creating only 1 .desktop file

I changed my Github.desktop file and added

StartupWMClass=Brave-browser

if you are using chrome then add Google-chrome instead

Next copy the default .desktop file for the browser to ~/.local/applications

cp /usr/share/applications/brave-browser.desktop ~/.local/share/applications/brave-browser.desktop

then open the copied .desktop file

gedit ~/.local/share/applications/brave-browser.desktop

and add this below the name field

StartupWMClass=brave-browser

in the case of chrome add google-chrome instead

At the end restart your gnome-session using Alt+F2 and typing 'r' followed by Enter


Result

A separate icon for github

enter image description here

enter image description here

Parag Katoch
  • 1,213
  • Nice, worked for me (Ubuntu 22.04) to create a Slack app:
    #!/usr/bin/env xdg-open
    [Desktop Entry]
    Terminal=false
    Type=Application
    Name=Slack Web
    Exec=/opt/google/chrome/google-chrome --profile-directory=Default --app=https://app.slack.com/client/<FULL PATH TO MY WORKSPACE>
    Icon=/usr/share/icons/slack/slack.png
    StartupWMClass=Google-chrome
    
    – user76933 Feb 15 '24 at 11:01