6

I have a "youtube" gnome application that launches a "youtube" firefox profile. It has a youtube icon so that it is recognizable in the app list. The problem is that once started, it get the firefox icons and is groupes with all other firefox windows.

I would like to keep the youtube icon and keep it separated from the "standard" firefox windows in the dock. Is it possible ?

The youtube.desktop file :

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Youtube
Comment=Watch videos on Youtube
Type=Application
Exec=/usr/bin/firefox -no-remote -P youtube https://www.youtube.com/
Icon=/home/me/.local/share/applications/youtube_logo.png

I've tried the "WMClasses" solutions described here : Firefox profiles with different icons in Ubuntu dock but it seems outdated : with firefox 100.0.2, firefox --class test creates a windows with wmclass=firefox

MoaMoaK
  • 61

1 Answers1

-1

This is how I did it in Linux Mint 21.3 cinnamon:

I created a file for each firefox profile in ~/.local/share/applications/firefox-work-script.sh

This file contains this small script:

bash
#!/bin/bash

source_dir contains the icons for work profile (one png file named "default128.png" is enough)

source_dir="/opt/firefox/browser/chrome/icons/default/work/"

target_dir is where firefox keeps it's default icons. move "default128.png" into a folder named "default" in the target folder and remove the rest.

target_dir="/opt/firefox/browser/chrome/icons/default/"

cp -f ${source_dir}* ${target_dir}

this line will run Firefox with profile "work". change it to your own profile name.

/opt/firefox/firefox -p work

Create respectful icon for each profile and put them in their respectful directory. in the above example, the directory name is work. Size of the icon should be less than 256x256. but regardless of the actual size, the name of the file should be default128.png. taskbar will resize the icon to fit in the taskbar but depending on taskbar size it might not look good. My taskbar size is thin so I change my icon size to 48x48 to keep the quality at best. but it's not necessary.

Final folder structure:

/opt/firefox/browser/chrome/icons/default/
                                  ├── default128.png
                                  ├── default/
                                  │   └── default128.png
                                  ├── game/
                                  │   └── default128.png
                                  └── work/
                                      └── default128.png

Then in the .desktop file of firefox (e.g. firefox-work-profile.desktop. The shortcut file that runs firefox and usually is in the same folder that we created the above script) I have this:
NOTE: change the "YOUR_USER_NAME" to your user name. Obviously.

[Desktop Entry]
Name=Firefox Work
Exec=/home/YOUR_USER_NAME/.local/share/applications/firefox-work-script.sh
Comment=Mozilla Firefox Work Profile
Icon=/opt/firefox/browser/chrome/icons/default/work/default128.png
StartupNotify=true
Terminal=false
Type=Application
Categories=Network;WebBrowser;
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;
Actions=new-window;new-private-window;

[Desktop Action new-window] Name=New Window Exec=/opt/firefox/firefox -p work

[Desktop Action new-private-window] Name=New Incognito Window Exec=/opt/firefox/firefox -p work -private

And that's it. Except for these two things:

1- Important: I needed to delete all theme related firefox icons for the theme that was active in my theme settings (mine was Mint-Y). I searched for firefox keyword in /usr/share/icons/Mint-Y/apps/ and deleted them all.

2- Remember to do all of the above for your default profile too since you will have at least two profiles and default profile needs it's own icon.

This was the general idea and can be used differently (probably).

Dasem
  • 1