Quickly Setting up Awesome with Gnome

From awesome
Jump to: navigation, search

Setting up Awesome as Gnome's window manager gives you advantages from both worlds:

  • Dynamic window managing;
  • Easily configurable desktop;
  • Autostart goodness;
  • GTK theming without the fuss.

Of course, your login time gets worse, as you need to start up Gnome, but for some that may be well worth it.

How exactly you can configure such a setup depends on your Gnome version, but the overall process is similar.

Configuration: gnome < 2.12[edit]

These commands will change some settings in gconf in order to set up awesome as the default window manager and disable Nautilus' naughty root window behaviour. If your version of gnome is older than 2.12, this should do the trick.

 gconftool-2 --type bool --set /apps/nautilus/preferences/show_desktop False 
 # Disable buggy Nautilus desktop thing
 gconftool-2 --type string --set /desktop/gnome/applications/window_manager/current /usr/bin/awesome
 # Set awesome as your WM of choice -- note that you may be using /usr/local/bin/awesome if you compiled it yourself

Configuration: 2.12 <= gnome < 3[edit]

Normally[edit]

If you use a more recent version of gnome, you can try

 gconftool-2 --type bool --set /apps/nautilus/preferences/show_desktop False
 # Still disable the buggy Nautilus desktop thing
 gconftool-2 --type string --set /desktop/gnome/session/required_components/windowmanager awesome
 # sets awesome as wm

Obviously, if you prefer graphical stuff (I doubt it, you're using awesome!) you can use gconf-editor.

If your distribution doesn't provide /usr/share/applications/awesome.desktop, then you'll also have to add ~/.local/share/applications/awesome.desktop

 [Desktop Entry]
 Version=1.0
 Type=Application
 Name=Awesome
 Comment=The awesome launcher!
 TryExec=awesome
 Exec=awesome

If clients override on your gnome panel[edit]

without gdm[edit]

Try launching awesome outside gnome. Keep the gconftool lines, but forget about the ~/.config/autostart/awesome.desktop, and instead, use ~/.xinitrc:

 #!/bin/sh
 awesome &
 exec ck-launch-session gnome-session # ck-launch-session is advised for the dbus stuff to work fine.

Don't forget to make it executable:

 chmod +x ~/.xinitrc

Launch the whole thing with startx.

with gdm[edit]

Additionnally, if you use gdm, tell it to run the default system session. The last version might not allow you to do that and you need to add the file /usr/share/xsessions/xsession.desktop

 [Desktop Entry]
 Name=Xsession
 Comment=This runs ~/.xsession
 Exec=/etc/X11/Xsession

Add this file and choose to run Xsession, and link ~/.xsession to .xinitrc

 ln -s ~/.xsession ~/.xinitrc

Configuration: 3.0 <= gnome < 3.4[edit]

Go to System Settings -> System Info -> Graphics -> Forced Fallback Mode ON. This disables the Gnome 3 Shell, which is incompatible with exotic window managers (or any window manager but Mutter, for that matter).

Now, the easiest way is to create a file called .gnomerc in your $HOME with the following contents:

export WINDOW_MANAGER=/usr/local/bin/awesome-wm

Then you can create an executable script at /usr/local/bin/awesome-wm with the following content:

#!/bin/sh
awesome &

gnome-session session[edit]

You can also tell "gnome-session" about awesome through a session file. Save the following as /usr/share/gnome-session/sessions/awesome.session or ~/.config/gnome-session/sessions/awesome.session:

[GNOME Session]
Name=Awesome session
RequiredComponents=gnome-settings-daemon;
RequiredProviders=windowmanager;notifications;
DefaultProvider-windowmanager=awesome
DefaultProvider-notifications=notification-daemon

Note that this also disables gnome-panel. If you want to use it, add "gnome-panel;" to the RequiredComponents line.

Then tell gnome-session to use your new session by default, by running the following command:

gsettings set org.gnome.desktop.session session-name awesome 

Note that this uses the new gsettings framework, not the old gconf one.

Doing this means that selecting "Gnome" in your display manager now runs awesome.

Display manager session[edit]

Instead of changing the "Gnome" xsession in you display manager, you can also create a new xsession. This allows you to choose between regular gnome and awesome from the login prompt.

Save the awesome.session file as described in the previous section.

Save the following as /usr/share/applications/awesome.desktop (your distribution might already provide this for you, Debian does):

[Desktop Entry]
Version=1.0
Type=Application
Name=Awesome
Comment=The awesome launcher!
TryExec=awesome
Exec=awesome

Save the following as /usr/share/xsessions/gnome-awesome.desktop:

[Desktop Entry]
Name=Awesome GNOME
Comment=Dynamic window manager
TryExec=/usr/bin/gnome-session
Exec=gnome-session --session awesome
Type=XSession

Now, when logging in, choose the "Awesome GNOME" session type. Rename however you see fit (some suggestions: "GNOME tiling", "GNawesome", perhaps "Erdgeist").

Arch Linux[edit]

Just install the awesome-gnome package from AUR.

Debian[edit]

Note: The above gnome-awesome.desktop doesn't seem to work on Debian. It seems that on Debian gdm3 passes the Exec line from the gnome-awesome.desktop file as-is to /etc/X11/Xsession, and that script only supports a single command without arguments. Creating a gnome-awesome.desktop file modeled after the fallback session file that calls a wrapper script works around this.

Save the following as /usr/share/xsessions/gnome-awesome.desktop:

[Desktop Entry]
Name=Awesome GNOME
Comment=Dynamic window manager
TryExec=gnome-session
Exec=gnome-session-awesome
Type=XSession

Save the following as /usr/bin/gnome-session-awesome

#!/bin/bash
exec gnome-session --session awesome "$@"

The awesome.session file is as above.

Gentoo Linux[edit]

Enable the gnome use flag for x11-wm/awesome package


Ubuntu 11.10[edit]

Save the following as /usr/share/gnome-session/sessions/awesome.session:

[GNOME Session]
Name=Awesome session
RequiredComponents=gnome-settings-daemon;gnome-panel;
RequiredProviders=windowmanager;
DefaultProvider-windowmanager=awesome
DefaultProvider-notifications=notification-osd
DesktopName=GNOME

Save the following as /usr/share/applications/awesome.desktop:

[Desktop Entry]
Version=1.0
Type=Application
Name=Awesome
Comment=The awesome launcher!
TryExec=awesome
Exec=awesome

Save the following as /usr/share/xsessions/gnome-awesome.desktop:

[Desktop Entry]
Name=Awesome GNOME
Comment=Dynamic window manager
TryExec=/usr/bin/gnome-session
Exec=gnome-session --session=awesome
Type=XSession

Gnome 3.9 / Ubuntu 13.10[edit]

Save the following as /usr/share/gnome-session/sessions/awesome.session or /usr/local/share/gnome-session/sessions/awesome.session:

[GNOME Session]
Name=Awesome session
RequiredComponents=awesome;gnome-settings-daemon;
DesktopName=Awesome

Save the following as /usr/share/applications/awesome.desktop (unfortunately does not work in /usr/local/share/applications):

[Desktop Entry]
Version=1.0
Type=Application
Name=Awesome
Comment=The awesome launcher!
TryExec=awesome
Exec=awesome

Save the following as /usr/share/xsessions/awesome-gnome.desktop:

[Desktop Entry]
Name=Awesome GNOME
Comment=Dynamic window manager
Exec=gnome-session --session=awesome
TryExec=awesome
Type=Application
X-LightDM-DesktopName=Awesome GNOME
X-Ubuntu-Gettext-Domain=gnome-session-3.0

Now you need to modify at least /etc/xdg/autostart/gnome-settings-daemon.desktop to add Awesome to the OnlyShowIn key, the result should look like the following:

[Desktop Entry]
Type=Application
Name=GNOME Settings Daemon
Exec=/usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec
OnlyShowIn=GNOME;Unity;Awesome;
NoDisplay=true
X-GNOME-Autostart-Phase=Initialization
X-GNOME-Autostart-Notify=true
X-GNOME-AutoRestart=true
X-Ubuntu-Gettext-Domain=gnome-settings-daemon

You may also want to check any other files in this directory and modify the OnlyShowIn key, they gnome keyring and screensaver amon others are candidates for this.

Lastly don't forget to overide awesome's quit to use gnome-session-quit as described below.

If your cursor is invisible, you may need to set cursor - active to false. You can do this by running:

dconf write /org/gnome/settings-daemon/plugins/cursor/active false

If the gnome-control-center is missing some menues, check all files /usr/share/applications/gnome*panel*. Adding Awesome to the OnlyShowIn Key will make them visible and accessible again.

Finally[edit]

Log out and back in again. You should now have awesome as your default window manager. You should also have gnome-panel and all the other gnome things running.

Going Forward[edit]

You will likely want to choose either gnome-panel or awesome's main wibox as your panel. If you choose to disable your wibox, configure your rc.lua to not start it up. If you choose to disable gnome-panel, it is easiest to stop using gnome-session and run your session in the traditional way.

The traditional way is to have a .xinitrc or .Xsession file, which is used as your session. This file is usually a shell script that is run by the login manager or by X directly. When the shell script exits, your session ends. Here is a sample .Xsession / .xinitrc file. (Note that some distros call it .Xsession and others .xinitrc. You may want to make one and ln -s the other one if you don't know which script your distro uses.)

 gnome-settings-daemon &      # handles themes, starts gnome-screensaver. You may have to use gconf to disable it setting the background.
 nm-applet &                  # assuming you're using Network Manager
 pidgin &                     # if you're using pidgin. You can really put any programs here.
 gnome-power-manager &        # for laptops and stuff
 gnome-volume-manager &       # for mounting CDs, USB sticks, and such
 eval `gnome-keyring-daemon`  # SSH/GPG agent
 exec awesome                 # awesome receives xinit's process id; when it terminates, X will be terminated

If you're still using GDM, you can select something along the lines of "X client script" when you choose which session you want to use from the GDM login screen.

Note: For themes instead of gnome-settings-daemon you can use gtk-chtheme which can be found in the repository. It's advantage over gnome-settings-daemon is that it doesn't set background and consumes less memory.

Note: gnome-volume-manager seems to be renamed and kind of hidden as /usr/lib/gnome-settings-daemon/gnome-fallback-mount-helper at least on Ubuntu 13.10. gnome-power-manager seems to be gone too.

Problems[edit]

  • If you run into trouble with "awsetbg" -- ie. it does not set your background and pops up an error, install the program "feh". Installing it should be all you need to do.
  • If nautilus doesn't want to open gvfs locations (sshfs://, computer://, and so on) check your gnome-settings-daemon path. In some distros it is installed into /usr/libexec. Also you can try solution from https://bbs.archlinux.org/viewtopic.php?pid=660605 - add
   eval `dbus-launch --sh-syntax --exit-with-session`

to the beginning of ~/.xinitrc

  • If you run gnome-settings-daemon, but do not want it to set the background image then run the command below. Note that simply setting /desktop/gnome/background/draw_background to false will not prevent gnome-settings-daemon from setting the background.
   gconftool-2 --type bool --set /apps/gnome_settings_daemon/plugins/background/active False
  • If you use the gnome-session based launch method, quitting awesome may not log you out, leaving you stuck. In order to fix this, put the following at the beginning of your rc.lua:
    -- Override awesome.quit when we're using GNOME
    _awesome_quit = awesome.quit
    awesome.quit = function()
        if os.getenv("DESKTOP_SESSION") == "awesome-gnome" then
           os.execute("/usr/bin/gnome-session-quit")
        else
	    _awesome_quit()
        end
    end

This assumes that you copied the "gnome" xsession file and made a new "awesome-gnome" session. If you modified the existing gnome.session, replace "awesome-gnome" above with "gnome".

GNOME Awesome Applet[edit]

For users who want to use GNOME as much as possible (i.e. GNOME panel, notification area, run dialog, etc.), but still use Awesome as a window manager, GNOME Awesome Applet is a viable option. GNOME Awesome Applet is a standard GNOME panel applet that monitors Awesome (e.g. by showing the current layout as widgets in the wibox do) and enable various interactions with it (e.g. Lua prompt, GNOME Run Dialog, etc.).