2003 January 5

Metacity Configuration

Just installed RedHat 8.0, and discovered they've changed the window manager from sawfish to metacity, and don't even ship enlightenment anymore. The story, apparently, is that the sawfish project went moribund, so the GNOME guys switched to metacity.

Here follows technical notes on my reconfiguration issues.

Reinstalling enlightenment and all the libraries it depends on every time I set up a new linux machine is getting really old, and the only reason I really even do it is because last time I looked around it was the only one configureable enough to let me use a few features I've been hooked on since the days of OpenWin in SunOS 4. Namely:

  • Focus follows mouse,
  • Ability to drag windows around by any part of the frame (not just the titlebar), and
  • Raise and lower current window from the keyboard.
Simple enough, and ridiculously useful, but hardly anybody seems to set these features on by default. I have no idea why not.

So I looked around a little, and found that, while Red Hat's default desktop config only exposes options for the first of my preferences (focus follows mouse), metacity does have hidden options for the others. Alt-F7 switches the mouse to window-move mode, which is kind of nifty, and there are available hooks for keyboard raise and lower -- just no keys bound to them by default.

[[Update (03/01/06): It has been pointed out to me that all of these can actually be set from the Preferences>Keyboard Shortcuts control panel. Sigh. So they can. The problem with making these things "intuitive" for "ordinary users" is that those of us used to the old way of doing things get left high and dry. ]].

For reference of any who google their way here, here is the (almost) complete documentation of functions metacity makes available for key binding. (I'm leaving off run_command, mostly because I'm lazy and don't expect to use it, but if that sounds like something you'd want, look in /etc/gconf/schemas/metacity.schemas.

Global Keybindings

Set these properties like so:
shell% gconftool-2 --type=string --set /apps/metacity/global_keybindings/switch_windows '<Alt>Tab'

Name Default binding Description
switch_windows <Alt>Tab Move focus between windows
switch_panels <Control><Alt>Tab Move focus between panels and the desktop
cycle_windows <Alt>Escape Move focus between windows
cycle_panels <Control><Alt>Escape Move focus between panels and the desktop
show_desktop <Control><Alt>d Hide all windows and focus desktop
switch_to_workspace_1 disabled Switch to workspace 1
switch_to_workspace_2 disabled Switch to workspace 2
switch_to_workspace_3 disabled Switch to workspace 3
switch_to_workspace_4 disabled Switch to workspace 4
switch_to_workspace_5 disabled Switch to workspace 5
switch_to_workspace_6 disabled Switch to workspace 6
switch_to_workspace_7 disabled Switch to workspace 7
switch_to_workspace_8 disabled Switch to workspace 8
switch_to_workspace_9 disabled Switch to workspace 9
switch_to_workspace_10 disabled Switch to workspace 10
switch_to_workspace_11 disabled Switch to workspace 11
switch_to_workspace_12 disabled Switch to workspace 12
switch_to_workspace_left <Control><Alt>Left Switch to workspace on the left
switch_to_workspace_right <Control><Alt>Right Switch to workspace on the right
switch_to_workspace_up <Control><Alt>Up Switch to workspace above the current space
switch_to_workspace_down <Control><Alt>Down Switch to workspace below the current space

Window Keybindings

Set these properties like so:
shell% gconftool-2 --type=string --set /apps/metacity/window_keybindings/activate_window_menu '<Alt>space'

Name Default binding Description
activate_window_menu <Alt>space Activate window menu
toggle_fullscreen disabled Toggle fullscreen mode
toggle_maximized disabled Toggle maximization state
toggle_shaded disabled Toggle shaded state
close <Alt>F4 Close a window
minimize <Alt>F9 Minimize a window
begin_move <Alt>F7 Move a window
begin_resize <Alt>F8 Resize a window
toggle_on_all_workspaces disabled Toggle whether the window is on all workspaces
move_to_workspace_1 disabled Move window to workspace 1
move_to_workspace_2 disabled Move window to workspace 2
move_to_workspace_3 disabled Move window to workspace 3
move_to_workspace_4 disabled Move window to workspace 4
move_to_workspace_5 disabled Move window to workspace 5
move_to_workspace_6 disabled Move window to workspace 6
move_to_workspace_7 disabled Move window to workspace 7
move_to_workspace_8 disabled Move window to workspace 8
move_to_workspace_9 disabled Move window to workspace 9
move_to_workspace_10 disabled Move window to workspace 10
move_to_workspace_11 disabled Move window to workspace 11
move_to_workspace_12 disabled Move window to workspace 12
move_to_workspace_left disabled Move window one workspace to the left
move_to_workspace_right disabled Move window one workspace to the right
move_to_workspace_up disabled Move window one workspace up
move_to_workspace_down disabled Move window one workspace down
raise_or_lower disabled Raise window if obscured, lowers it otherwise
raise disabled Raise window above other windows
lower disabled Lower window below other windows

And in case anyone would like to have it, here's the script I'm using to reset my own keybindings. Make it executable and set it to run when you log in.


# ctrl-alt-up to raise window (disabling old binding)
gconftool-2 --type=string --set /apps/metacity/global_keybindings/switch_to_workspace_up 'disable'
gconftool-2 --type=string --set /apps/metacity/window_keybindings/raise '<Ctrl><Alt>Up'

# ctrl-alt-down to lower window (disabling old binding)
gconftool-2 --type=string --set /apps/metacity/global_keybindings/switch_to_workspace_down 'disable'
gconftool-2 --type=string --set /apps/metacity/window_keybindings/lower '<Ctrl><Alt>Down'

# alt-space to move window (changing old binding)
gconftool-2 --type=string --set /apps/metacity/window_keybindings/activate_window_menu '<Ctrl><Alt>space'
gconftool-2 --type=string --set /apps/metacity/window_keybindings/begin_move '<Alt>space'

# shift-alt-left/right to move window to workspace left/right
gconftool-2 --type=string --set /apps/metacity/window_keybindings/move_to_workspace_left '<shift><alt>Left'
gconftool-2 --type=string --set /apps/metacity/window_keybindings/move_to_workspace_right '<shift><alt>Right'
# ctrl-f1/f2/f3/f4 to jump to workspaces
gconftool-2 --type=string --set /apps/metacity/window_keybindings/move_to_workspace_1 '<Ctrl>F1'
gconftool-2 --type=string --set /apps/metacity/window_keybindings/move_to_workspace_2 '<Ctrl>F2'
gconftool-2 --type=string --set /apps/metacity/window_keybindings/move_to_workspace_3 '<Ctrl>F3'
gconftool-2 --type=string --set /apps/metacity/window_keybindings/move_to_workspace_4 '<Ctrl>F4'


is it possible to set up "active border" on metacity?

Posted by: davide on March 28, 2003 12:14 PM

Is it possible to mouse-drag items across workspaces?

Posted by: Jeff on June 9, 2003 10:54 AM

Is it possible to mouse-drag items across/between different workspaces?

Posted by: Jeff on June 9, 2003 10:55 AM

You can mouse-drag the mini-images of windows between workspaces in the Gnome Panel -- and if you play with the Preferences (rightclick the workspace applet), you can make those minis big enough to actually grab hold of. I use an array of workspaces four across and one deep, so they display better.

But most of the time I use keybindings on move_to_workspace_left/right to move windows around. Just focus a window and hit shift-alt-left/right-arrow to move to the next or previous workspace.

Posted by: colin on June 9, 2003 11:37 AM

I'm having other problems, I use other features, such removeing the pop-to-front on click... I often use the ability to move a window behind other windows..

I find it frustrating, with every new version of RedHat, I loose functionality in the window interface.. This functionality, and configurability of the window manager has always been what I loved about X-Based operating systems.

Anyone know how to replace meta-city with a better window manager ?

Michael Nielsen.

Posted by: Michael Nielsen on July 4, 2003 05:21 AM

You should be able to create a ~/.xsession script and get it when you choose the "Default" session when you log in under gdm. The last line of your ~/.xsession should be something like:

/usr/bin/enlightenment > $HOME/.enlightenment/ERRORS
(at least, if you're using the enlightenment window manager, which it sounds like is what you want). If you want to start other programs (terminals, xclocks, instances of emacs or mozilla, just add lines like

mozilla &
earlier in the ~/.xsession script.

I haven't tested this with RH 9, but this is how it used to work.

Posted by: colin roald on July 4, 2003 06:13 PM

any comments / suggestions on using metacity without gnome? I would especially like to be able to create custom menus keyed to the 3 mouse buttons.

Posted by: Jeff on October 3, 2003 01:22 AM

Does anyone know of a way to change the mouse keys config in metacity, like to click and hold the right mouse button instead of the middle mouse button to resize a window? I'd really rather use the right mouse button...

Posted by: ernie on October 3, 2003 02:53 PM

Sawfish also had the ability to bind keys with custom code. I set a key to just raise xterms and another to just raise emacs windows. How do I do this in metacity?

Posted by: Matt on November 23, 2003 10:55 PM

I have been looking for an option to make windows popup under the mouse cursor in metacity, but can't find it. Does anyone know if this is possible at all?
The only window placement i can get is in the top left corner for _each_ window.
Some help would be appreciated.

Posted by: Jasper on November 27, 2003 05:10 PM

Oh yeah...for those looking for a GUI interface to configuring metacity, check out: gconf-editor

Posted by: Jasper on November 27, 2003 05:11 PM

I'd like to configure Metacity so some key (say, F3, or Ctrl-F3) toggles the vertical
maximization of a window. That is, pressing the key will change the vertical size
of the window to fill the desktop. Pressing the key again at some later time will
return the window to its previous vertical size.

fvwm2 does this when configured with:

Key F3 A N Maximize 0 100

Any advice?

Posted by: Ben on March 25, 2004 02:04 PM

does anyone know a way to disable the "shade" option in the window menu?
Thanks in advance

Posted by: oredondo on March 30, 2004 09:17 AM


Metacity-2.8.1 (as part of Fedora Core 2), and how in the world can I configure it so that windows do NOT move off the edge of the current screen?

I've been using FVWM for years, but decided that I needed to "learn" GNOME and all that, to better support my users.

I can't believe that this sort of basic configuration capability is so totally missing!

Posted by: Jonathan B. Horen on June 9, 2004 11:33 AM

In metacity 2.8.1 (shipped with RH FC2) there is a bug: when ~/.metacity folder is removed, the desktop will not load because a session is referenced in ~/.gnome2/sessions that does not (at that point) exist - so metacity will die and desktop will stop loading (needs C-A-BS). This can be fixed by renaming the ~/.gnome2/sessions file to something else and trying again. I WISH this was more 'gracefully' handled! Who needs to read this to fix it?


Posted by: Filip G on July 23, 2004 09:06 PM
Post a comment
Yes   No   (like the Turing Test, but easier)

TrackBack Links
If you run a blog that supports TrackBack, you can link to this article with this TrackBack key.