WM_CLASS needs to match .desktop file name

Bug #725988 reported by Jasper St. Pierre on 2011-02-27
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
emacs23 (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: emacs23

emacs ships an emacs.desktop file, but the Debian source package uses its own emacsVER.desktop file.

Unfortunately, this messes up libraries like the shell application trackers and bamf that use WM_CLASS as a basis for the application.

This is fixable by renaming the desktop file, setting the EMACS_CLASS #define to be "Emacs23", or setting it through the 'x-resource-class variable in emacs lisp.

Jeremy Nickurak (nickurak) wrote :

How would one set the 'x-resource-class variable for this purpose? I've been trying emacs --eval '(setq x-resource-class "emacs-23")', but xprop still says Emacs,emacs. Likewise if I put (setq x-resource-class "emacs-notmuch") in .emacs

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in emacs23 (Ubuntu):
status: New → Confirmed
Fabien Tassin (fta) wrote :

just for reference, here is the gnome-shell bug that led me here:
https://bugzilla.gnome.org/show_bug.cgi?id=670092

in the Debian BTS, there a different bug with the same root cause:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630741
(i too see one of two emacs icon blurred)

Fabien Tassin (fta) wrote :

fix attached as a debdiff. wtm.
I'm no longer an uploader, so someone please review & sponsor.

note that I didn't use @MENU_VERSION@ in the patch as i would have meant making d/rules even more complex than it is today.
so "23" is hardcoded in there. Shouldn't be a problem for precise as it will never receive emacs 24.

Fabien Tassin (fta) wrote :

to test, run xprop and click on the emacs window.

$ xprop| grep CLASS
WM_CLASS(STRING) = "emacs23", "Emacs23"

The attachment "emacs23_23.3+1-1ubuntu8.debdiff" of this bug report has been identified as being a patch in the form of a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Bryce Harrington (bryce) on 2012-02-23
Changed in emacs23 (Ubuntu):
status: Confirmed → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package emacs23 - 23.3+1-1ubuntu8

---------------
emacs23 (23.3+1-1ubuntu8) precise; urgency=low

  * debian/patches/emacsVER-lp725988.patch: Set the X EMACS_CLASS
    to "Emacs23" to please bamf and gnome shell (LP: #725988)
  * debian/emacsVER.desktop: also set StartupWMClass (same reason)
 -- Fabien Tassin <email address hidden> Wed, 15 Feb 2012 18:42:46 +0100

Changed in emacs23 (Ubuntu):
status: Fix Committed → Fix Released
IRIE Shinsuke (irie) wrote :

Please drop the patch! Don't change the window class!
I think it is bad solution because changing the window class causes unwanted side-effects.

For example, the settings in ~/.Xresources file are not working at all (LP #949126), and probably the other programs which refer to the wm_class to find Emacs window also will not work correctly.

This issue affects only GNOME Shell users, but the problems caused by changing the wm_class happen to all Emacs users!

IRIE Shinsuke (irie) wrote :

Please reopen.

I cannot understand why EMACS_CLASS has been changed for such a minor issue.
Didn't you know the fact that the settings of Emacs can be put in ~/.Xresources?

Jasper St. Pierre (jstpierre) wrote :

Users really shouldn't have to edit a configuration file to make application tracking work correctly. If this breaks existing things, we could just rename the emacsVER.desktop file to emacs.desktop, which should fix it as well.

IRIE Shinsuke (irie) wrote :

Just renaming emacsVER.desktop to emacs.desktop actually works, but that causes another issue that the emacs.desktop file will conflict with the other flavor's one.

So I suggest the solution as follows:

1. Install upstream emacs.desktop file into /usr/share/emacs/23.3/etc/

2. Use the Debian alternatives system for /usr/share/applications/emacs.desktop by adding the following to emacsVER.postinst:

  --slave /usr/share/applications/emacs.desktop emacs.desktop \
          /usr/share/emacs/@FULL_VERSION@/etc/emacs.desktop \

3. Remove @MENU_VERSION@ from StartupWMClass in emacsVER.desktop

Note that emacsVER.desktop is still necessary when the multiple flavors (emacs23, emacs24, emacs-snapshot, etc.) are installed. emacsVER.desktop will be used to launch the desired flavor's Emacs.

IRIE Shinsuke (irie) wrote :

I posted a patch that fixes the regression bug:

https://bugs.launchpad.net/ubuntu/+source/emacs23/+bug/949126

So far it works fine for me.

IRIE Shinsuke (irie) wrote :

emacsVER-lp725988.patch is utterly incorrect bugfix that makes serious regression.

Please remove it, otherwise many Emacs users will be confused!

Peder Stray (pstray) wrote :

Please revert this "fix" as soon as possible!

era (era) wrote :

peder, irie, anyone who can repro: please create a new bug report and link to this one. If you have a patch which fixes this, please include it. See also https://lists.launchpad.net/ubuntu-elisp/msg00044.html

era (era) wrote :

Oh, sorry, I overlooked that this had already been done. Thanks Irie! LP #949126

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.