A few notes to explain how to theme gmusicbrowser using customs gtk themes.
Feel free to improve this page.
First you need to have some knowledge about how gtk themes works, this page have all the technical details.
To launch gmusicbrowser with a custom gtkrc file, you can type this :
GTK2_RC_FILES=gtkrc gmusicbrowser
replace gtkrc by the full or relative path and filename.
To help finding the path of widgets you want to theme, I've added some functions to my Debug.pm plugin, you can find it there (put it in ~/.config/gmusicbrowser/plugins/
).
Note that some things will not work with version older than 1.0.2 (widget names and the WB container).
Example of what you can put in a gtkrc file :
style "test" { bg[NORMAL] = "#000000" fg[NORMAL] = "#ffffff" base[NORMAL] = "#000000" text[NORMAL] = "#ffffff" } widget_class "*" style "test"
This define the style “test”, the style simply defines the 4 colors bg, fg, base, and text in the “NORMAL” state. Widgets use some or all of these colors to draw themselves. A widget can be in 5 states : NORMAL, ACTIVE, PRELIGHT, SELECTED and INSENSITIVE.
The theme is applied to all widgets which class_path match “*”, that is all widgets. The class_path is a string made of the class name of all widget and all of its parents, joined by a period “.”, the character “*” match 0 or more characters.
For example, the “Total” gmb widget is made up of a gtkbutton containing a gtklabel. In the Browser layout the gtk_label of Total has this class_path : GtkWindow.SVBox.SHBox.GtkButton.GtkLabel
So to apply the style “test” to only the gtklabel of the Total widget, you would have to use :
widget_class "GtkWindow.SVBox.SHBox.GtkButton.GtkLabel" style "test"
But, this has a few problems :
Browser.VBmain.HBstatus.Total.GtkLabel
So by modifying the Browser layout like this :
the path of “Total”'s gtklabel becomes : Browser.VBmain.HBstatus.WBTotal.Total.GtkLabel
And with a gtkrc of :
style "test" = "theme-default" { bg[NORMAL] = "#000000" fg[NORMAL] = "#ffffff" base[NORMAL] = "#000000" text[NORMAL] = "#ffffff" } widget "Browser.*WBTotal*" style "test"
Note that this time it uses “widget” instead of “widget_class” to match against the path of the widget instead of its class_path. The style “test” is applied to all gtk widgets named WBTotal and their children, only in a the “Browser” Layout. And the background of the button is black in NORMAL state.
Gtk3 uses a completely different theme system.
To launch gmusicbrowser with a custom gtk3 theme, for example named gmbtheme, you can type this :
GTK_THEME=gmbtheme gmusicbrowser
To create the custom theme, create ~/.themes/gmbtheme/gtk-3.0/ and put a gtk.css file in that folder that could contain for example:
@import url("/usr/share/themes/TraditionalOk/gtk-3.0/gtk.css"); @define-color theme_bg_color #000000; @define-color theme_fg_color #ffffff; * { color: #ff00ea; font: 30px "Comic Sans"; }
Obviously that is just a silly example to get started, you can use that to change many many things, more info there. That method even allows you to theme specific widgets of gmusicbrowser, to get access to the widget names and hierarchy, you can use GtkInspector