Ensure running GParted is named correctly under GNOME Shell (#705323)

Under GNOME Shell a running instance of GParted was getting named
"Gpartedbin".  Ultimately GNOME Shell [1] uses the WM_CLASS X Window
property [2], which GDK defaults from the executable name.

    $ xprop WM_NAME WM_CLASS
    (Click on running GParted window)
    WM_NAME(STRING) = "/dev/sda - GParted"
    WM_CLASS(STRING) = "gpartedbin", "Gpartedbin"

Set the Class name, second string of the WM_CLASS X Window property, to
"GParted".  (This prevents the use of the '--class' GTK+/GDK common
command line option [3] to override the class name, but I expect nobody
ever uses the option.  GNOME Terminal has the same limitation.  It also
has the same change setting the Class name [4]).

References:

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

[2] WM_CLASS Property, Inter-Client Communication Conventions Manual
    http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.5

[3] Running GTK+ Applications, Common command line options
    https://developer.gnome.org/gtk3/stable/gtk-running.html

[4] Bug #685742 - Window class of terminals doesn't match the desktop
    file name
    https://bugzilla.gnome.org/show_bug.cgi?id=685742
    https://git.gnome.org/browse/gnome-terminal/commit/?id=3370c0e51159f5be476b909e94ac05e5362dd28a

Closes Bug #705323 - Shows up as 'Gpartedbin' in GNOME Shell
This commit is contained in:
Mike Fleetwood 2013-08-02 13:06:14 +01:00 committed by Curtis Gedak
parent b16d66c34b
commit 73a80db912
1 changed files with 5 additions and 2 deletions

View File

@ -29,6 +29,9 @@ int main( int argc, char *argv[] )
Gtk::Main kit( argc, argv ) ;
//Set WM_CLASS X Window property for correct naming under GNOME Shell
gdk_set_program_class( "GParted" ) ;
//i18n
bindtextdomain( GETTEXT_PACKAGE, GNOMELOCALEDIR ) ;
bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" ) ;