After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705323 - Shows up as 'Gpartedbin' in GNOME Shell
Shows up as 'Gpartedbin' in GNOME Shell
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2013-08-02 02:03 UTC by Jeremy Bicha
Modified: 2013-09-18 16:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (69.40 KB, image/png)
2013-08-02 02:03 UTC, Jeremy Bicha
  Details
Set GParted window class (v1) (2.18 KB, patch)
2013-08-08 21:24 UTC, Mike Fleetwood
none Details | Review

Description Jeremy Bicha 2013-08-02 02:03:03 UTC
Created attachment 250666 [details]
screenshot

gparted 0.16.1 on Ubuntu 13.10 Alpha running GNOME Shell 3.8.4.

When I run gparted in GNOME Shell, it shows up in the top bar and the Alt-Tab window switcher as 'Gpartedbin'. This also breaks the favorites handling. If I set Gparted as a "favorite" in GNOME Shell's Dash (the sidebar in the Activities Overview) and then run Gparted, it shows up as a separate app instead of reusing the existing icon. I'm attaching a screenshot of part of the top bar.

According to https://launchpad.net/bugs/1206687 the problem is that the window class is 'gpartedbin' instead of 'gparted'. (Incidentally I've only noticed this problem with Python apps.)

This can therefore be fixed by renaming gparted.desktop to gpartedbin.desktop or by renaming the window class to gparted. Renaming the .desktop would mean that anyone who had favorited gparted.desktop would have to re-favorite it after upgrading.
Comment 1 Mike Fleetwood 2013-08-02 07:54:01 UTC
Hi Jeremy,

I think this is the cause of the problem:

  # gparted
  # xprop | fgrep -i gparted
  (Click on running GParted window)
  WM_CLASS(STRING) = "gpartedbin", "Gpartedbin"
  WM_ICON_NAME(STRING) = "/dev/sda - GParted"
  WM_NAME(STRING) = "/dev/sda - GParted"

GParted currently never sets any window property to "Gpartedbin".
However gparted is a shell script which disables automounting and then
calls the gpartedbin binary.

  # ~mfleetwo/bin/gparted-1.16.1
  # xprop | fgrep -i gparted
  WM_CLASS(STRING) = "gpartedbin-0.16.1", "Gpartedbin-0.16.1"
  WM_ICON_NAME(STRING) = "/dev/sda - GParted"
  WM_NAME(STRING) = "/dev/sda - GParted"

So GTK+ is automatically setting the class based on the executable name.
I try to fix this.

Thanks,
Mike
Comment 2 Mike Fleetwood 2013-08-03 12:23:32 UTC
Documenting findings so far ...
(Using Fedora 19 with GNOME Shell to test with)


Easy workaround
---------------

Add '--class GParted' option to the command line.  Do this when running
gparted manually and add to the gparted.desktop file for when running
from the desktop.

E.g. Change exec line in the gparted.desktop file (Fedora 19 example)
to:
    Exec=/usr/bin/gparted --class GParted %f


Links
-----

Application Based GNOME 3
https://wiki.gnome.org/GnomeShell/ApplicationBased


Discussion
----------

What I don't understand at the moment is how gnome-terminal and gvim
work, yet gparted doesn't.  For gnome-terminal and gvim, GNOME Shell
uses the Name from the desktop file for the activities name, yet for
gparted it uses the WM_CLASS hint derived from the executable name.

gnome-terminal:
    gnome-terminal.desktop:
        Name=Terminal
        Exec=gnome-terminal
        StartupNotify=true
    WM_CLASS = "gnome-terminal-server", "Gnome-terminal"
    Running process:            /usr/libexec/gnome-terminal-server
    GNOME Shell Activites name: Terminal

gvim:
    gvim.desktop:
        Name=Vi IMproved
        Exec=gvim -f %F
    WM_CLASS = "gvim", "Gvim"
    Running process:             gvim
    GNOME Shell Activities name: Vi IMproved

gparted:
    gparted.desktop
        Name=GParted
        Exec=/usr/bin/gparted %f
        StartupNotify=true
    WM_CLASS = "gpartedbin", "Gpartedbin"
    Running process:             /usr/sbin/gpartedbin
    GNOME Shell Activities name: Gpartedbin
Comment 3 Jeremy Bicha 2013-08-03 16:32:30 UTC
Mike, thanks for the additional research. The "--class" trick could work but it probably won't work for people who manually run gparted from the terminal or a Run Command dialog.

The wiki page says that you should be able to call something like g_set_prgname ('gparted'); which is even nicer but I haven't tested that.

I believe the difference for gnome-terminal is that the binary name matches the desktop name (/usr/bin/gnome-terminal and gnome-terminal.desktop). Rename the .desktop, run update-desktop-database, restart GNOME Shell, and GNOME Shell will display the app as "Gnome-terminal".
Comment 4 Mike Fleetwood 2013-08-04 10:34:03 UTC
Hi Jeremy,

I have a patch for GParted which calls gdk_set_program_class("GParted").
It works but I just need to test it to make sure there are no adverse
effects of different types of desktops.

GNOME Terminal does the same.
Bug #685742 - Window class of terminals doesn't match the desktop file name
https://git.gnome.org/browse/gnome-terminal/commit/?id=3370c0e51159f5be476b909e94ac05e5362dd28a

Thanks for the update-desktop-database tip.  I'll try that.
Mike
Comment 5 Mike Fleetwood 2013-08-08 21:24:10 UTC
Created attachment 251210 [details] [review]
Set GParted window class (v1)

Hi Curtis,

Here's the patch for this.  (Been verbose with my commit message.
Hopefully there's no issue ignoring setting the class from the command
line.  At least GNOME Terminal does this too).

Tested on these desktops:
  GNOME 3.8 SHELL - Fedora 19
  XFCE 4.10 - Fedora 18
  KDE 4.8 - Kubuntu 12.04 LTS
  GNOME 2.x - Fedora 14, CentOS 5.9, CentOS 6.4, Debian 6

Thanks,
Mike
Comment 6 Curtis Gedak 2013-08-09 15:24:27 UTC
Thank you for the patch Mike.

I'm attending a conference all weekend but should be able to review this early next week.

Curtis
Comment 7 Curtis Gedak 2013-08-13 21:41:17 UTC
Thank you Mike for triaging this problem, providing a patch, and testing on a variety of shells and distros.

This patch worked well for me.  Prior to applying this patch I was able to confirm the "Gpartedbin" listing in the GNOME Shell task bar in my Fedora 19 beta VM.  With this patch, the taskbar lists "GParted" which is as it should be.

I found no ill effects in XFCE on Debian 7, or in KDE on Kubuntu 12.04.

The patch in comment #5 has been committed to the git repository for inclusion in the next release of GParted.

The relevant git commit can be viewed at the following link:

Ensure running GParted is named correctly under GNOME Shell (#705323)
https://git.gnome.org/browse/gparted/commit/?id=73a80db912a7f4f51173b0176e11336ce019ca57
Comment 8 Curtis Gedak 2013-09-18 16:53:24 UTC
The patch to address this report has been included in GParted 0.16.2 released on September 18, 2013.