Found this somewhat obscure problem without a solution I could find online. So figured I'd post it here.
So what appears to be causing this is the change of $HOSTNAME
that is a common in sandboxing applications. If the $HOSTNAME
is different from the user opening the application, it will make a new icon for the application.
While I gave an example using Firejail for simplicity's sake、 I actually use Bubblewrap. I'm sure the solution will be similar in Firejail. I would love if anyone could provide the answer for it for completion's sake though.
So in Bubblewrap, you would basically just remove these lines:
--unshare-uts \
--hostname FIREFOX \
Alternatively, you could actually still unshare-uts as long as the $HOSTNAME
remains the same. (I'm not sure if this would provide any additional protection though.) For example:
--unshare-uts \
--hostname "${HOSTNAME}" \
Another alternative is you could actually change your $HOSTNAME
before starting the program. export HOSTNAME=FIREFOX
did not work for me. But hostnamectl hostname FIREFOX
did. The problem with this is that your $HOSTNAME
will remain the same as long as the program is running. Which may break other programs or cause other issues
hostnamectl hostname FIREFOX
bwrap \
[...]
--unshare-uts \
--hostname FIREFOX \
[...]
/usr/lib/firefox/firefox
hostnamectl hostname "${HOSTNAME}"
I have not tested this, but in theory, you should be able to run a script in the background that would sleep for maybe 5 seconds, waiting for the application to start, then set the $HOSTNAME
back. Unsure of any problems this might cause though.
Obviously, this is all up to you whether the solution for this minor inconvenience makes sense for you and your situation/"threat model".