gmusicbrowser - layout documentation
(the syntax is evolving, but I try to support backward compatibility)Updated on 27-10-07 for gmusicbrowser v0.962
Gmusicbrowser's interface is defined by layouts.
Layouts are found in 2 places:
- the default layouts installed with gmusicbrowser are in /usr/share/gmusicbrowser/layouts when installed
- custom layouts can be added by placing them in ~/.gmusicbrowser/layouts, which can be either a file or a folder containing multiple .layout files (read in alphabetical order)
[layout name]
key1 = value
key2 = value
...
long lines can be be splitted in multiple lines by ending them with a backslash
Look at the layout file for examples.
Keys define either containers or properties.
Keys are unique for a layout, duplicate key definitions replace the previous one.
There are currently 5 properties keys (Type, Default, Title, KeyBindings, ExtraWidgets) which I'll describe later.
If the name of the key begins with one of : HB,VB,HP,VP,MB,EB,TB the key is the name of a container that will contain widgets (also called layout elements or controls) or other containers
For containers the value is a list of widgets and containers, separated by a space, preceded by optional packing options, the widget names can be followed by a number(to have multiple widgets of the same name) and its options between parentheses
There must be one, and only one, container which has no parent, this container will be put in the layout window.
Normal containers
Containers options can be specified in parenthesis before the child widgets list, example :HBname = (option1=value1,option2=value2) widget1 widget2
, all containers accept the option border, that specify the amount of padding around the container.
- HB/VB : Horizontal/Vertical Boxes (based on GtkBox)
-
optional packing options are : (they must be in this order)
- number : padding (in pixels)
- _ : expand (the widget will use all remaining space in the container)
- - : right aligned
HBname = 2_-widget1(opt1=val,opt2=val) -widget2 2container3
Cover and ArtistPic widgets are treated specially, they ignore the expand mode, and expand until they reach a square size. example : in a HBox which has a height of 30, a Cover widget will use available space to expand if it has a width less than 30.
- HP/VP : Horizontal/Vertical Panes (based on GtkPaned)
-
Same as HB/VB but they contain only 2 widgets
And they only have one packing options : _ : expand
- TB : Notebook (based on GtkNotebook)
-
each widget is in a tab, no packing options but the syntax is a bit different, each widget is preceded by the tab title
the title can have spaces by using quotes
example :TBname = title1 widget1(options) "title with spaces" widget2(options) title3 container3
- EB : Expander (based on GtkExpander)
-
contains only one widget/container which can be showed/hidden
option : label : text for the optional widget syntax :FBname = (label="optional label") widget1
or :FBname = widget1
- FB : Fixed (based on GtkFixed)
-
Each widget is positionned at precise coordinates
syntax :FBname = x1,y1 widget1 x2,y2,w2,h2 widget2 ...
The widget is positioned at the x,y coordinate.
An optional width and height can follow the coordinates, to specify how much space the widget should use. An height or width of 0 means leave it as default.
x,y,w,h can be relative to the width/height of the container by preceding the number with '.'
x,y can be relative to the right/bottom border by prefixing it with '-'. - MB : Menus
- They can contain only MenuItem widgets or SM containers, no packing options
- SM : Submenu
- They can contain only MenuItem widgets or SM containers, no packing options, label is set with the label container option
- FR : Frame (based on GtkFrame)
-
Draw a border around its child, with an optional label.
shadow none, in, out, etched-in (default), etched-out label text of the label - SB : Scrolled window (based on GtkScrolledWindow)
-
Adds scrollbars to its child.
- AB : Alignment (based on GtkAlignment)
-
Controls the alignment and size of its child
options :xalign Horizontal position of child in available space, value between 0(left) and 1(right), default to .5 (center) yalign Vertical position of child in available space, value between 0(top) and 1(bottom), default to .5 (center) xscale If available horizontal space is bigger than needed for the child, how much of it to use for the child. 0.0 means none, 1.0 means all (default :1) yscale If available vertical space is bigger than needed for the child, how much of it to use for the child. 0.0 means none, 1.0 means all (default :1)
Special containers
There is also 2 special containers, widgets in these containers must belong to a normal container, and as the widget is defined elsewhere, widgets options can not be set here.- HSize/VSize : Size groups (see GtkSizeGroup)
- Force all widgets to have the same Horizontal/Vertical size, if the list of widgets begin with a number, the first widget Horizontal/Vertical size will be set to this number (in pixels)
example :HSize0 = 20 widget1 widget2
orHSize1 = widget1 widget2
- VolumeScroll :
- A unique virtual container (must be the exact name), for all widgets inside, the scroll wheel will modify the volume (unless the scroll event is intercepted, like in a scrollable list)
Properties keys
- Title :
- Set a title for the window instead of the default : songtitle by artist ('%S by %a')
Title = gmusicbrowser playing %S by %a from %l
- Type :
- A String of letters defining the type(s) of a layout, possible types : B(Browser window), T(Tray window), G(General or player window), F(Fullscreen), P(Page for use in TabbedLists experimental)
- Default :
- Default options used when the layout has no saved state, contains a space-separated list of keys and values, by pair,
widget_or_container_name widget_or_container_variable_options
There is a special key : Window, for the window properties : pos, size (format is numberxnumber for pos and size), sticky, ontop, below, fullscreen (0 or 1 for these)
example :
Default = Window size=1120x820,sticky=0 HPbig 780 FPane0 page=artist
- KeyBindings :
- Pairs of keys and action, example :
KeyBindings = Insert OpenSearch c-q EnqueueSelected c-Insert OpenCustom(a layout name)
key names are as shown in the key binding tab in the settings dialog action names can be found by running gmusicbrowser with command-line option -listcmd - DefaultFocus :
- name of a widget in the layout
set which widget gets the initial focus in the window, will probably only work with very simple widgets and with SongList, SongTree and SimpleSearch for now (let me now if you'd like more) - ExtraWidgets : Allows the addition of extra widgets to the layout (by options or plugin), for each widget types (only button exist now, I expect to add tab or menuitem in the future) a container can be specified where widgets of this type will be added.
syntax :ExraWidgets = button container(option1=value1,option2=value)
the option pack contains packing options as defined above for the container (for example '_' for expand in HBoxes). When the container is a HBox/VBox, the option pos=number can be used to specify at which position the widgets will be inserted. If the added widget s a button, the option relief can be used to specify the button's relief (none, half or normal)
A layout can be derived from a previously defined layout by adding " based on " followed the name of the reference layout :
[layout name] based on another layout name
In this case the layout starts with all the key definitions of the other layout
each key can be re-defined or deleted (if nothing follow the '=')
Widgets list
Most widget options are optional, '' means any other value => default behaviourAll widgets options are use this format :
key1=val1,key2=val2,...
, some still accept the old format val1,val2,...
for backward compatibilityThe widgets are listed with this format :
WidgetName | Widget Description | ||||
|
widgets related to playing song
Album | Currently playing Album | ||||||
Artist | Currently playing Artist | ||||||
Comment | Comment of currently playing song | ||||||
Cover | Album cover of currently playing song | ||||||
| |||||||
ArtistPic | Artist picture of currently playing song. Same options as Cover. With multiple artists, displays only one picture unless the option multiple was given, which can be set to v (vertical) or h (horizontal) | ||||||
Date | Year of currently playing song | ||||||
LabelTime | Position of currently playing song | ||||||
Length | Length of currently playing song | ||||||
LockAlbum | Album lock | ||||||
LockArtist | Artist lock | ||||||
Pos | Position of currently playing song in the playlist | ||||||
Title | Currently playing Title | ||||||
Title_by | Currently playing Title and Artist | ||||||
Scale | Playing position slider | ||||||
Stars | Currently playing Rating | ||||||
LabelsIcons | Icons for currently playing labels for which an icon is defined in ~/.gmusicbrowser/icons/ (by a .png or .svg named "label-" followed by the label name.) | ||||||
Visuals | Eye candy, only with gstreamer |
All the label widgets (Album, Artist, Comment, Date, Length, LabelTime, Pos, Title, Title_by) accepts the options 'font' and 'minsize'. The option 'font' is passed to the function pango_font_description_from_string. The option minsize, if set (it is set by default for Album, Artist, Comment, Title, Title_by), the label will request a minimum width (it can have more if packed with the expand option in a container), if the width is not enough to display the text, the text will scroll on mouseover. The value of the minsize option is the width it will request : the unit is in pixels if followed by a 'p' or in the width of the 'X' character if it is only a number
All labels also accept xalign and yalign options, a value between 0 (left/top) and 1 (right/bottom), .5 being center.
player buttons widgets
Next | Next button |
Play | Play/Pause button |
Prev | Previous button |
Stop | Stop button |
Quit | Quit button |
BContext | Button to open context window |
Playlist | Button to open Browser window |
Pref | Button to open Settings window |
ChooseAlbum | Open a window to select an album |
OpenQueue | Open a queue window |
Fullscreen | Button to switch to/from fullscreen mode |
ChooseRandAlbum | Button to select an album at random, option "action" can be playlist, addplay, insertplay, queue or replacequeue |
The BContext, Playlist and OpenQueue buttons accept the option 'toggle', if true (=1) the button will close the opened window if it is already opened
All buttons can be changed to an indicator(no button border, smaller) with the option button=0
Relief can be changed for buttons by using the option relief=none (default), half or normal.
Size of buttons and indicators can be set to menu, small-toolbar, large-toolbar, button, dialog, dnd (the actual size depends on gtk settings)
player indicators widgets
Filter | Playing filter indicator | ||||
Queue | Queue indicator | ||||
Sort | Sort mode indicator | ||||
Vol | Volume indicator | ||||
VolSlider | Volume slider | ||||
|
Size can be changed same as buttons, see above.
A lot of widgets, in particular labels, indicators and buttons can use the option click1 (or click2 ...) to (re)define the action executed when the widget is clicked with mouse button 1 (or 2 ...). Example :
click2=OpenSongProp
, bouttons widget also accept the option activate to (re)define the action executed when the button is activated with a mouse click or keyboardAlso, a lot of widgets, in particular labels, indicators and buttons, can use the option tip, to define a tooltip for the widget. The tip can contains variables like %a to display informations on the current song.
misc. widgets
AASearch | |||||||||
| |||||||||
Connections | List the active connections when in gstreamer-server mode (very rough for now, will be improved some day) | ||||||||
Context | Context view | ||||||||
| |||||||||
EditList | (special) | ||||||||
Filler | empty widget, for use with H/VSize | ||||||||
Label | custom label | ||||||||
| |||||||||
QueueActions | combobox to change the queued action | ||||||||
SongSearch | |||||||||
TogButton | Show/Hide other widget(s) | ||||||||
| |||||||||
HSeparator | Horizontal separator | ||||||||
VSeparator | Vertical separator | ||||||||
AddLabelEntry | Entry to add labels to the current song | ||||||||
PlayOrderCombo | Combo box to change play order, the option reqwidth set the requested width, it defaults to 100, -1 to let it grow, but it can grow much to wide, so it's best to set a minimum width and pack it with the expand option |
Songlist widgets
When there is more than one SongList/TabbedLists/QueueList in a layout, they must each but one be assigned a group number though the group option. The one without a group number will be the default with which other widgets interact withAll the other widgets which interact with a SongList/TabbedLists/QueueList accept the option 'group' to specify which one they interact with, it is only needed when the layout contain more than one SongList/TabbedLists/QueueList.
QueueList | Display queue (and edit it), accept the same options as SongList | ||||||||||||||||||
SongList | |||||||||||||||||||
| |||||||||||||||||||
TabbedLists | Songlists in tabs, can contain playlist, static lists and the queue. Experimental feature : layouts of type 'P' can be opened in TabbedLists (use the layout property key 'stockicon' to set the tab icon) | ||||||||||||||||||
SongTree | Very customizable Songlist replacement. Some things are still not implemented : drag and dropping columns, playlist, queue or static list mode, moving songs using the EditListButtons widget (arrows button) and type-ahead search. See this wiki page for some documentation. These options works : activate activateX headers songxpad songypad |
widgets related to songlists
(filter# is a number between 0-9, 0 is meant for FLock, when a filter is set all filters with a higher number are reset)All these widgets accept the option 'group' to specify which SongList/TabbedLists/QueueList they interact with, it is only needed when the layout contain more than one SongList/TabbedLists/QueueList.
AABox | Artist or Album box (name, picture and stats of selected album/artist) | ||||||||||||
| |||||||||||||
EditListButtons | buttons to remove/move the selected song(s) in the songlist and clear the list | ||||||||||||
| |||||||||||||
FBox | advanced search box (set filter#1) | ||||||||||||
FLock | Lock/unlock : current songlist filter is put in filter#0 | ||||||||||||
FPane | Filter pane | ||||||||||||
| |||||||||||||
PlayFilter | Button to Play current songlist filter | ||||||||||||
QueueFilter | Button to Enqueue current songlist filter | ||||||||||||
Refresh | Refilter songlist | ||||||||||||
ResetFilter | Reset songlist filter | ||||||||||||
SimpleSearch | simple search entry, search title/album/artist (set filter#1), the selector icon can be disabled with the option noselector=1. The option activate can be used to set a command to run after enter is pressed. | ||||||||||||
Total | Total number/length/size of selected/filter/library | ||||||||||||
|
MenuItem widgets (can only be put in a MB/SM)
HistItem | Filter history (set filter#1) | ||||||||||
LSortItem | Sort order for songlist | ||||||||||
MainMenuItem | main menu | ||||||||||
MenuItem | Custom menu item | ||||||||||
| |||||||||||
PFilterItem | playing filter menu | ||||||||||
PSortItem | playing sort order | ||||||||||
PlayItem | choose a Filter based on playing title/artist/album/filter (set filter#1) and follow playing songlist option | ||||||||||
QueueItem | queue menu | ||||||||||
SeparatorMenuItem | separator |