You are not logged in.


I have two instance of a program running. Each is on a different workspace. However, on my workspace switcher display they both show the same default program icon. I would like to see a different icon for one of them. How can I accomplish that?
Thank you.
Offline


Anyone have any ideas on this one?
Thanks.
Offline


Which app is it? Does it support the "--class" parameter?
My first thought was to create a second .desktop file and change the "Icon=" and "StartupWMClass=" lines but I can't get that to work. In the past, I've used this method (requires xseticon) to change an application icon, and it does still work until you open a second instance of the app.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Thunderbird, with a different profile.
Last edited by KitchM (2025-09-15 22:22:00)
Offline


Actually, it looks like the xseticon process works for thunderbird. First, make sure you have xseticon installed.
Ten, create a script file with the following content:
#!/bin/bash
### EDIT THESE VALUES #########################################################
APP="thunderbird -P SECONDPROFILE"
ICON="/path/to/icon.png"
WAIT=2
###############################################################################
###############################################################################
### DON'T CHANGE ANYTHING BELOW
###############################################################################
function change-panel-icon {
sleep $WAIT
activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
activeWinId="${activeWinLine:40}"
xseticon -id "$activeWinId" "$ICON"
}
$APP & change-panel-icon...and change SECONDPROFILE to the name of your profile and change the ICON= to an actual path to a png icon file you want to use.
Make this script executable.
Then start the first instance of thunderbird normally, then start the second by executing this script.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Okay, I am trying to use that good idea. I edited the example and saved it as thunderbird2.sh on my desktop. I edited the first "App=" line to show "thunderbird -profile /home/path/to/my/profile/.thunderbird/t6XX2v7X.Secure/ –no-remote", and then the "ICON=" line to show "/home/path/to/my/icon/thunderbird-red.ico". Then I made it executable and double-clicked on it. The program ran correctly but failed to show the icon I desired on the workspace area where it was running. Used another icon that was the same but .png, and got the same results. It continually shows the default icon. I can only distinguish which running instance is which by their position in the workspaces.
Offline


Did you install xseticon?
It doesn't look like its available on Debian in its repositories. It is available as a snap - not sure how you feel about snaps. Otherwise, you'll need to compile from source.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Yup; installed it from Snap. Maybe it's not running?
Offline


You can test it manually. For example (using mousepad as an example and with mousepad open and running):
xseticon -id $(wmctrl -lv | grep -i mousepad | awk '{print $1}') /usr/share/pixmaps/xfce4_xicon.pngSee if you can change the icon manually. On my home computer I can change the icon of the second thunderbird instance, but I don't have thunderbird installed on this one to check.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Had to install wmctrl. Then got:
envir_utf8: 1
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
bash: xseticon: command not found
Offline


Researching snaps....
One thing to note, it will only have access to files in your home directory, so copy the png icon you want to use somewhere in $HOME.
Try this command:
snap run xseticon -id $(wmctrl -lv | grep -i mousepad | awk '{print $1}') /home/kitchm/file.pngWorks here for me. If it works for you, adjust the script above to suit.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Doesn't that cover all sub-directories too?
Offline


Yes
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Then, no, it didn't work. Still got same results of:
'{print $1}') /home/kitchm/file.png
envir_utf8: 1
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
error: snap "xseticon" is not installed
It appears I am having trouble with both wmctrl and the snap version of xseticon, even though both are installed.
Offline


Try running these commands:
sudo apt install wmctrl gawk
sudo snap install xseticon...then try again.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
wmctrl is already the newest version (1.07-7+b1).
gawk is already the newest version (1:5.2.1-2).
gawk set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
xseticon 0.1+bzr13-10-g8dbfcdd from 林博仁 Buo-ren Lin (brlin) installed
After editing the command to fit my directory structure, I ran it again and got:
envir_utf8: 1
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
xseticon: error: Invalid window id format: /home/xxx/Pictures/thunderbird-red.png.
Added later 03 min 01 s:
Ran command from #9 above and got the same response.
Added later 16 min 12 s:
xseticon appears to have a problem with "-id $(wmctrl -lv | grep -i mousepad | awk '{print $1}')"
Offline


xseticon: error: Invalid window id format: /home/xxx/Pictures/thunderbird-red.png
.....
xseticon appears to have a problem with "-id $(wmctrl -lv | grep -i mousepad | awk '{print $1}')"
Are you testing with mousepad, or thunderbird?
Maybe if there are two windows open its having trouble distinguishing between them. Try this instead to grab the first window:
snap run xseticon -id $(wmctrl -lv | grep -i mousepad | awk '{print $1}' | head -1) /home/xxx/Pictures/thunderbird-red.pngTo test this, open one instance of mousepad and run that command (replace 'xxx' with your username). Then open two fresh new instances and try again - only the first should change.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Started mousepad. Ran command as you listed and changed xxx to my user name. It changed the mousepad icon, but still returned:
envir_utf8: 1
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
Started another instance and it just opened a new tab in the first instance of mousepad.
Offline


envir_utf8: 1
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
You can ignore this - its just erroneous output.
Started another instance and it just opened a new tab in the first instance of mousepad.
Sorry, should have asked you to open it in another instance.
Anyways, it seemed to work so lets move back to the thunderbird script. Use this content:
#!/bin/bash
### EDIT THESE VALUES #########################################################
APP="thunderbird -P /home/path/to/my/profile/.thunderbird/t6XX2v7X.Secure/ –no-remote""
ICON="/home/path/to/my/icon/thunderbird-red.ico"
WAIT=2
###############################################################################
###############################################################################
### DON'T CHANGE ANYTHING BELOW
###############################################################################
function change-panel-icon {
sleep $WAIT
activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
activeWinId="${activeWinLine:40}"
snap run xseticon -id "$activeWinId" "$ICON"
}
$APP & change-panel-icon...Make sure the paths in the APP and ICON variables are correct.
Start your first regular instance of thunderbird. Then run this script to start the second instance. If all goes well, you should have two instances of thunderbird running, each with its own icon.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


First of all, please clarify the meaning of the word 'instance'. To me it means that the program will start up a separate and distinct copy of itself, which is separate from the first one.
It would appear that one can do this by starting a program in separate workspaces, and that would indicate that one needs to first move to another workspace before attempting to start that given program again.
Please keep in mind, that I only know about the case of Thunderbird (and I assume all Mozilla products). It appears that they watch for any attempt to run another copy within the same OS environment, regardless of how started. That is evidently where the '-no-remote' parameter comes into play.
Offline


First of all, please clarify the meaning of the word 'instance'. To me it means that the program will start up a separate and distinct copy of itself, which is separate from the first one.
Yes, that is what I mean and we are trying to get to. Start thunderbird as you usually do for your first profile. Then manually switch to the second workspace and run the script to start the second copy with second profile in the second workspace.
It would appear that one can do this by starting a program in separate workspaces, and that would indicate that one needs to first move to another workspace before attempting to start that given program again.
We can look at automating this after we confirm that the different icons are working.
Please keep in mind, that I only know about the case of Thunderbird (and I assume all Mozilla products). It appears that they watch for any attempt to run another copy within the same OS environment, regardless of how started. That is evidently where the '-no-remote' parameter comes into play.
Yes you are correct. Unless the application itself supports this kind of configuration (which thunderbird does not), the best we'll be able to do is use workarounds like this.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Okay, got it. Thanks.
So in the case of mousepad, we did not get another instance. We got another tab in the same program window.
But in trying the other instance of TB, I now had success. Praise the Lord! I am still a little taken about that it actually worked, but your good help made all the difference.
I can hardly believe it. Wow!
Totally awesome!
Thank you so much.
And please let me explain why this is so important to me. I like to use my own email client instead of using webmail. With the need to use a secure and anonymous account for some things, we have had a problem in the industry with using POP as a simple and easy way to configure our client of choice. One of the issues we face is the concern that, regardless of what service providers may claim or promise with regard to server storage privacy, we would like to download and remove our mail from the server whenever we get mail. This has led to a problem.
The more secure service providers tend to use IMAP. Some may see this as convenient, but then there is the aforementioned concern. Therefore we must configure our client to jump thru hoops to perform the download and delete process as automatically as we did with POP. Further, our POP and IMAP accounts must now be kept separate, and that requires separate instances of the same program. Thankfully TB can do this, but we cannot allow ourselves to be confused by which is which on our desktop and therefore the need for some sort of signal that causes us to notice. The different program icon serves this purpose.
Again, thank you very much for helping me solve this vexing problem.
Offline


Glad to hear it works.
If you'd like to automate this somewhat, you can create a .desktop file and run this script from the file (so you don't have to run it in a terminal window). You can also use wmctrl to change the workspace prior to starting the app:
#!/bin/bash
### EDIT THESE VALUES #########################################################
APP="thunderbird -P /home/path/to/my/profile/.thunderbird/t6XX2v7X.Secure/ –no-remote""
ICON="/home/path/to/my/icon/thunderbird-red.ico"
WAIT=2
###############################################################################
###############################################################################
### DON'T CHANGE ANYTHING BELOW
###############################################################################
function change-panel-icon {
sleep $WAIT
activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
activeWinId="${activeWinLine:40}"
snap run xseticon -id "$activeWinId" "$ICON"
}
wmctrl -s 1
$APP & change-panel-icon...note the addition of the wmctrl command. The "1" indicates the second workspace (numbering starts at 0), so change that to whatever number you need.
For the .desktop file, copy the existing thunderbird .desktop file from /usr/share/applications to ~/.local/share/applications, rename it to something else (like thunderbird2), then edit that file to change the "Name=" line (so you can differentiate them in the menu) and the "Exec=" line to run this script. Now you can start it from a menu.
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Actually, I found that numbering starts at 1. What do I misunderstand?
Offline


That's odd. 'man wmctrl' says:
<DESK> A Desktop is always specified by an integer which represents the
desktop numbers. Desktop numbers start at 0.Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
[ Generated in 0.013 seconds, 7 queries executed - Memory usage: 682.48 KiB (Peak: 731.32 KiB) ]