Metacity was the default GTK2 Window Manager for Ubuntu. Metacity compositing was introduced in Ubuntu 8.10 Jaunty. Some of the most familiar tasks handled by Metacity include window management, keyboard shortcuts, and themes.
Metacity is installed and enabled by default. The compositing feature must be enabled after installation. If compositing is enabled two features are evident: shadows will appear around window edges, and when using ALT-Tab to switch windows a thumbnail of each window, rather than a static icon, is seen. Refer to the Configuration section for instructions on how to turn on compositing.
Metacity runs by default unless the user has made a change to the system (for instance, running Compiz). If Metacity was turned off and the user wishes to restart it:
Open the Appearance Preferences applet:
via the Main Menu - System > Preferences > Appearance, or
via terminal - (Applications > Accessories > Terminal or ALT-F2) and enter:
Once the Appearance tab is open by either method, select the Visual Effects tab and click on None.
Note: Selecting a choice other than None will exit Metacity and start Compiz if hardware permits.
With the command below entered in a terminal or in the ALT-F2 Run Command window:
The user's Metacity configuration settings are stored in .xml files in various subfolders of ~/.gconf/apps/metacity. There are five major components, discussed below.
The general section contains settings which control the Titlebar fonts, compositing, window focus, and certain mouse click actions. This section also sets the some button layouts and themes, and enables/disables compositing.
There are three ways to change the general settings.
A. The Main Menu:
System > Preferences > Windows
* A GUI Windows Preferences applet will open.
* A few basic options are available for change, such the action to be accomplished when the mouse is double-clicked.
* The Movement Key section allows the user to hold the specified key and use the mouse to drag a window when clicked anywhere on the window. If not enabled, the mouse will only drag the window if held on the titlebar.
System > Preferences > Keyboard Shortcuts
* A GUI Keyboard Shortcuts applet will open.
* Options which can be changed in this area include minimize/maximize key combinations, windows workspace movement, and window switching.
* Changes in the Window Management section will update Metacity settings.
* To make a change, select the line and press the desired key combination. No typing is required.
* To remove an entry, highlight the line and press the backspace key.
B. Configuration Editor
This GUI editor is the primary method of investigating and controlling Metacity settings. All existing options are available for editing and new options can be created from within the Configuration Editor.
To open the Configuration Editor, navigate to Applications, System Tools > Configuration Editor or in terminal run:
If you do not see the System Tools menu, enable it by right clicking the Main Menu icon or bar and selecting Edit Menus. Highlight System Tools in the left pane and select Configuration Editor in the right panel. Once enabled, press OK.
In the left panel tree view, navigate to /apps/metacity/general. In this section, you will find a variety of selections to modify general windows behavior and set the number of workspaces.
In the left section is the tree view (apps/metacity/general).
- In the upper right section are the names of the settings and their and present values.
- In the lower right section is an explanation of what the selection controls and information on possible inputs.
- To make a change:
For string entries, either right click the entry in the Name column and select Edit key, or double click the Value window. Type a new value. For some inputs, possible values are listed in the lower right pane.
- For check box entries, click on the check box to select or deselect the option.
To reset the value to the default entry, right click anywhere on the appropriate listing in the right panel and select Unset Key.
- The command takes the form of:
# gconftool-2 -s --type type keyname 'value'
The command always starts with gconftool-2 --set or gconftool-2 -s
type is int, bool, float, string, list, or pair. This can also be entered as "-t type".
keyname is the path and name of the command. If you have the Configuration Editor open, you can view it in the lower right panel in the Key name: block.
value is the entry normally made in the Value block (a string, true or false, or an integer), placed between quotation symbols if there is a space in the input field.
gconftool-2 -s -t string /apps/metacity/general/titlebar_font 'Sans Bold 10'
Originally available in Compiz but not Metacity, compositing became a part of Metacity with Gnome 2.24 and was incorporated into Ubuntu 8.04 Hardy. Compositing permits advanced visual effects by using buffers and manipulating the images before they appear on the screen. In Metacity, these effects include window shadowing, smoother window movement, and thumbnail views when using ALT-Tab to switch between windows.
To turn compositing on, open the Configuration Editor as described previously and go to /apps/metacity/general. Select the compositing_manager or use the terminal:
gconftool-2 -s --type bool /apps/metacity/general/compositing_manager true # or metacity -c
The Global keybindings section consists of default and user-configurable keybindings.
- Some of the default settings include:
Forward cycle window focus
Backward cycle focus
Cycle window focus without a popup window
Minimize/unminimize all, to show desktop
Technique: Before changing a key combination, the user may wish to test the new combination to ensure it is not already assigned to another command or action.
- The default global keybindings may be changed by the user by clicking on the value and entering a new key or key combination.
To reset the global keybinding the to default value, right click anywhere on the applicable line in the right panel and select Unset Key.
Normal values in this section include <Control>, <Ctrl>, <Shift>, <Alt>, F1-F12, letters and Escape. You can view pre-existing values or look in the lower right information section for appropriate entries. Letter entries are case-insensitive.
The run_command_N is associated with a key combination in this section. The command actually executed by run_command_N is determined by entries in the next section (keybinding_commands).
Metacity provides blank command_N entries, with N being a numeral 1 through 12. These can be set by the user. The run_command_N key combination value in this section is combined with the corresponding global_keybindings command in the previous section to create a customized keyboard shortcut. An example is presented later in this section.
If the command in the Value field is not in the user's $PATH, include the full path to the command.
The default screenshot application is designated in this section and will be started when the Print Screen key is pressed.
Practical Keybinding Example
A user wishes to use the <Control>G key combination to start the GNU Image Manipulation Program (Gimp). Refer to the previous screenshots for reference.
Test the <Control>G key combination to ensure it is not already assigned.
You could also perform a search in the Configuration Editor with: Edit > Find > Search for: <Control>G and enable Search also in key values.
Repeat the search for <Control>g, <Ctrl>G, and <Ctrl>g
Open the Configuration Editor from the Main Menu: System Tools > Configuration Editor.
Select a run_command in apps/metacity/global_keybindings. In this example, we choose run_command_2.
Currently unassigned key combinations will have a value of disabled.
Double click the highlighted entry in the Value column or right click the highlighted entry in the Name column and select Edit Key....
Type <Control>G in the entry window. Press ENTER to store the value.
Letters are NOT case sensitive in key combinations. g is the same as G for the key combination only.
Select apps/metacity/keybinding_commands in the left pane and command_2 in the right pane.
Double click the highlighted entry in the Value column or right click the highlighted entry in the Name column and select Edit Key....
Enter the run command for the desired action. In this case, gimp
- Note: For some applications, it may be necessary to include the complete path to the run command of the application.
- Press ENTER to store the entry.
Test the command by simultaneously pressing <Control>G.
- Exit the Configuration Editor if you are done.
If you prefer the terminal, or would like a demonstration of it's power, you can do the same thing with:
Open a terminal: Applications > Accessories >Terminal.
- Run the following two commands:
gconftool-2 -s -t string /apps/metacity/global_keybindings/run_command_2 '<Control>G' gconftool-2 -s -t string /apps/metacity/keybinding_commands/command_2 'gimp'
This section assigns key combinations for moving, closing, and sizing windows. Keys can also be assigned to move a window to specific workspaces.
Super is the designation for the key often referred to as the Windows key.
KP_ refer to keypad keys.
Some of these settings may be changed via the System, Preferences, Keyboard Shortcuts applet.
Names can be assigned to workspaces in the Metacity section above.
To display workspace names make sure Show workspace names in switcher is selected after the names have been entered in Metacity.
The graphic to the right displays the lower right portion of a default monitor display with the Preferences of the Workspace Switcher called up with a right mouse click. Note the 4 workspaces have been named Home, Work, VMs and Terminal by Metacity and are displayed in the lower panel.
Note: The number of workspaces is set in the general section.
Themes control window frame options, colors, controls, icons, pointers and more. Ubuntu provides the ability to easily add, remove and customize a wide variety of themes. The default theme of an installation can be changed with just a few clicks of your mouse. Installed themes are normally stored in the /usr/share/themes folder. User installed themes are normally found in the ~/.themes folder.
Installing & Selecting Themes
Themes can be installed by a variety of methods.
Several themes come pre-installed on an Ubuntu distribution. They are accessed via the Main Menu's System > Preferences > Appearance: Theme tab. The new theme takes effect as soon as it is selected.
Synaptic Package Manager (System > Administration > Synaptic Package Manager). In the Quick search window in the upper menu area, search for metacity theme and you will find a variety of themes which you can install. Synaptic will download and install the themes in the correct folder. They can then be selected from the Appearance: Theme tab discussed earlier.
Some themes downloaded via Synaptic depend on other themes which may not be installed. If you try to use one of these themes, you will get a message in the Appearance tab telling you what other theme must be installed.
Themes installed via Synaptic are removed via Synaptic or via terminal command executed as root.
- Third Party Themes. Many themes are available from third parties.
Themes should be packaged as a tar.gz files.
- If the installation of a theme is successful you will will be informed. If the theme installation requires other packages to function properly you may be notified during the installation. Failed theme installations will not display in the available themes window; a failure notification may or may not be presented.
Once correctly installed, the theme will be available for selection in the Appearance tab.
- To install a theme:
- Download the package.
Locate the downloaded file and ensure it is in the proper format - .tar.gz
Open the Theme tab via the Main Menu (System > Preferences > Appearance).
Select Install and navigate to the file location (normally the user's Desktop) to install the theme.
- The Theme applet will extract the theme and place the theme's folder in the user's ~/.themes folder.
- Several links to theme collections are provided at the end of this page.
Not only can users download or create their own themes, Ubuntu allows users to customize existing themes.
To customize a theme, navigate to the Theme tab via Main Menu > System > Preferences > Appearance.
Press the Customize tab and select the theme you wish to modify.
Make selections from any or all of the available categories: Controls, Colors, Window Border, Icons, and Pointer.
The user can combine individual items from different existing themes. Custom themes saved in this manner are placed in the user's .themes folder (~/.themes).
Selecting OK after making any change will create a theme named Custom. This or any other theme can be renamed by highlighting it, selecting Save As, and entering a new name.
Users can create their own themes by customizing existing themes as described earlier or build themes from scratch. There are many sites that describe the process. Here is the the gnome.org theme tutorial.
System themes (default themes and those installed with Synaptic) can be removed via Synaptic or by removing the individual folder and subfolders from /usr/share/themes.
Themes installed by the user may deleted using the Delete key in the Appearance tab or by removing the applicable folder/subfolders from the user's .themes folder (~/.themes)
Metacity & Compiz
Some users seeking advanced effects turn from Metacity to Compiz, while others switch from one to the other depending on what they are doing on their computers. Compiz is installed on the initial Ubuntu installation in Ubuntu 9.04 Jaunty, while Metacity now includes compositing.
For users who intend to switch to Compiz, or those who plan on using both, there are several applications which can make things simpler. While this page is not devoted to Compiz, Metacity users who occasionally use Compiz will also benefit from installing these applications.
Install fusion-icon and compizconfig-settings-manager via Synaptic or run the following command:
sudo apt-get install fusion-icon compizconfig-settings-manager
fusion-icon This panel applet allows the user to quickly switch between Metacity and Compiz as well as allowing the user to select which window decorator (compiz-decorator or gtk-window-decorator) Compiz employs.
Start this applet by running fusion-icon in a terminal or selecting Applications > System Tools > Compiz Fusion Icon. This will start Compiz and place the fusion-icon on the panel for easy access.
A right-click on the fusion-icon panel icon allows selection of the GTK Window Decorator, the Window Manager (Metacity or Compiz), reloading the Window Manager, and quick access to the CompizConfig Settings Manager.
compizconfig-settings-manager. This GUI application allows access to Compiz's extensive menu.
Start this application via System > Preferences > CompizConfig Settings Manager or running ccsm in a terminal.
The GTK Window Decorator can be enabled in the Effects, Window Decoration section.
The Compiz decorator default setting is /usr/bin/compiz-decorator
To use the GTK decorator, change the value to gtk-window-decorator --replace