Duplicate Emacs icons in Task Manager when using emacsclient
Rens Oliemans
hallo at rensoliemans.nl
Tue Mar 18 08:12:22 GMT 2025
Hi all,
I'm using KDE Plasma version 6.2.3, and I'm having trouble pinning my
emacsclient application to my Task Manager (specifically, I have trouble keeping
it pinned). I have two application entries of Emacs:
- "Emacs", with 'Exec=emacs %F'
- "Emacs Client", with 'Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec /usr/local/stow/emacs/bin/emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec emacsclient --alternate-editor= --create-frame; fi" sh %F'
Note that this particular machine runs Emacs via a local checkout in
/usr/local/stow/emacs, but this same issue persists on my other machine which
has Emacs installed via my package manager 'regularly'.
I like to use emacs in --daemon mode, so I generally use the Client version.
However, sometimes KDE doesn't see the running emacsclient as the same
application as the pinned program anymore. The (unfortunately nondeterministic)
problem/reproduction steps are thus:
- Open emacs: open the "Emacs (Client)" application within the program.
- Pin that application to the Task Manager.
- Wait for some while. Sometimes a reboot is enough, often it takes a day or
two of random actions, even when nothing is done to the Task Manager or KDE
settings.
- The running emacsclient is not longer "associated" with the pinned desktop
entry in the Task Manager. This means that there are two icons: the pinned
icon without any associated application; and the running emacs application.
Since I want to select my running Emacs with Meta+1, I have to unpin the
pinned one and pin the second one again.
I haven't figured out a way to make this easily reproducable, apologies for
that. I do believe however that this isn't just my configuration, since it
happened on a clean install and these users all have the same problem:
- https://old.reddit.com/r/kde/comments/1fcj46g/issues_with_duplicate_emacs_on_icons_only_task/
This user claims that "after the weekend" the problem occurs, both on Plasma
6 and back on Plasma 5.27.5.
- https://forum.manjaro.org/t/pinned-emacs-is-not-grouped-on-task-manager/134182
- https://forum.manjaro.org/t/pinned-emacs-is-not-grouped-on-task-manager/134182/6
- https://fluca1978.github.io/2023/07/15/EmacsDaemonSystemDKDE.htlm
See the "Conclusions" section.
If it's relevant, the StartupWMClass is "Emacs" in both .desktop files.
Is there a workaround for this? Since the behaviour suddenly changes without
modifications to the Task Manager, it feels like a bug. Or am I misunderstanding
something? I'm happy to provide more information or try something out.
Best,
Rens
PS: My email bounced, I hope that this isn't a duplicate.
More information about the kde
mailing list