Awesome is a highly configurable and fast tiled window manager for X much like dwm, ion and wmii. Since a couple of weeks Awesome 3.2 is available in Unstable. Awesome 3.x now uses a configuration file based on the Lua language. Awesome 3.2 is available in unstable and testing, this howto is NOT for Awsome 2 (stable)!
Part One
Fire up your favorite console and type:
- Code: Select all
su -c 'apt-get install awesome'
As user make a dir in your /home/$user/.config/ dir to store the config files of Awesome:
- Code: Select all
mkdir ~/.config/awesome
Now copy the default config files to this directory:
- Code: Select all
cp /etc/xdg/awesome/rc.lua ~/.config/awesome/
cp -r /usr/share/awesome/themes /home/toto/.config/awesome/
I don't use a display manager so here's my .xinitrc:
- Code: Select all
#!/bin/sh
xsetroot -solid black
xsetroot -cursor_name top_left_arrow
xset s off
xset dpms 300 600 900
xmodmap $HOME/.Xmodmap
xrdb -load $HOME/.Xdefaults
ivman &
#exec /usr/bin/startfluxbox
exec /usr/bin/awesome
If you don't use a display manager add the following line to your .xinitrc to start Awesome:
- Code: Select all
exec /usr/bin/awesome
Now it's time to start Awesome by typing startx from console or use your display managar to startup Awesome:
How to use Awesome
Awesome can be used with a mouse/keyboard or keyboard only.
These are the default mouse bindings:
Navigation
Button1 on tag name -- View tag.
Button4, Button5 on tag name -- Switch to previous or next tag.
Button4, Button5 on root window -- Switch to previous or next tag.
Button1, Button3, Button4, Button5 on layout symbol -- Switch to previous or next layout.
Layout modification
Mod4 + Button1 on tag name -- Tag current client with this tag only.
Mod4 + Button3 on tag name -- Toggle this tag for client.
Button3 on tag name -- Add this tag to current view.
Mod4 + Button1 on client window -- Move window.
Mod4 + Button3 on client window -- Resize window.
And these are the default key bindings:
Window manager control
Mod4 + Control + r -- Restart awesome.
Mod4 + Shift + q -- Quit awesome.
Mod4 + F1 -- Run prompt.
Mod4 + F4 -- Run Lua code prompt.
Mod4 + Return -- Spawn terminal emulator.
Clients
Mod4 + Control + i -- Print the client class and instance.
Mod4 + Shift + r -- Redraw the focused window.
Mod4 + m -- Maximize client.
Mod4 + f -- Set client fullscreen.
Mod4 + Shift + c -- Kill focused client.
Mod4 + t -- Mark a client.
Navigation
Mod4 + j -- Focus next client.
Mod4 + k -- Focus previous client.
Mod4 + u -- Focus first urgent client.
Mod4 + Left -- View previous tag.
Mod4 + Right -- View next tag.
Mod4 + 1-9 -- Switch to tag 1-9.
Mod4 + Control + j -- Focus next screen.
Mod4 + Control + k -- Focus previous screen.
Mod4 + Escape -- Focus previously selected tag set.
Layout modification
Mod4 + Shift + j -- Switch client with next client.
Mod4 + Shift + k -- Switch client with previous client.
Mod4 + h -- Decrease master width factor by 5%.
Mod4 + l -- Increase master width factor by 5%.
Mod4 + Shift + h -- Increase number of master windows by 1.
Mod4 + Shift + l -- Decrease number of master windows by 1.
Mod4 + Control + h -- Increase number of columns for non-master windows by 1.
Mod4 + Control + l -- Decrease number of columns for non-master windows by 1.
Mod4 + space -- Switch to next layout.
Mod4 + Shift + space -- Switch to previous layout.
Mod4 + Control + space -- Toggle client floating status.
Mod4 + Control + Return -- Swap focused client with master.
Mod4 + Control + 1-9 -- Toggle tag view.
Mod4 + Shift + 1-9 -- Tag client with tag.
Mod4 + Shift + Control + 1-9 -- Toggle tag on client.
Mod4 + Shift + F1-9 -- Tag marked clients with tag.
Take some time to familiarize yourself with the controls of Awesome before you take on part two.
Part Two
Now let's start fidling with the configuration file of Awesome (~/.config/awesome/rc.lua), it's written in Lua so I edited this file in Scite to make it more readable. You can change the config file on the fly. But before you do you can test if the config file is good by typing
- Code: Select all
awesome -k
in a console. If there's something wrong it'll print the linenumber of the config file and an error code. If everything is allright restart Awesome by using the following key combo: 'Mod4 + Control + r ' , this will load the modified config file.
Application rules
You can use the config file to make some applications float or send them to a specific workspace (tag). For example the Gimp and Audacious don't work well if they aren't floating.
In this part of rc.lua you can add applications you want to float or send to a specific tag:
- Code: Select all
-- Table of clients that should be set floating. The index may be either
-- the application class or instance. The instance is useful when running
-- a console app in a terminal like (Music on Console)
-- x-terminal-emulator -name mocp -e mocp
floatapps =
{
-- by class
["MPlayer"] = true,
["pidgin"] = true,
["galculator"] = true,
["audacious"] = true,
["gimp"] = true
-- by instance
}
-- Applications to be moved to a pre-defined tag by class or instance.
-- Use the screen and tags indices.
apptags =
{
["Gimp"] = { screen = 1, tag = 9 },
["Kazehakase"] = { screen = 1, tag = 1 },
["Midori"] = { screen = 1, tag = 1 },
["Iceweasel"] = { screen = 1, tag = 1 },
["Sylpheed"] = { screen = 1, tag = 2 },
["pidgin"] = { screen = 1, tag = 2 }
}
Let's say you want the Gimp to float and open in tag 9. For this to happen you add the following line to 'floatapps =':
- Code: Select all
["gimp"] = true,
This will make the Gimp float. To send the Gimp to tag 9 add the following line to 'apptags =':
- Code: Select all
["Gimp"] = { screen = 1, tag = 9 },
Notice the comma behind the code, you do this for every app except the last in the list. You can add as many rules to the list as you want.
If you don't now the Class name of an application you can use xprop to find out, use it from a console:
- Code: Select all
xprop WM_CLASS
The mouse cursor will change in a cross, click on the application you want to find out the 'class name'. The output will look like this if you happen to click on xclock for example:
WM_CLASS(STRING) = "xclock", "XClock", the first is the name "xclock" the second the class "XClock".
Tag names and layouts
By default Awesome has named the tags from 1-9 and they all have the same layout. You can change the tag names and tag specific layouts in the following part of Awesome's config file:
- Code: Select all
-- {{{ Tags
-- Define tags table.
mytags = {}
mytags[1] = { name = "ichi", layout = layouts[7] }
mytags[2] = { name = "ni", layout = layouts[3] }
mytags[3] = { name = "san", layout = layouts[3] }
mytags[4] = { name = "yon", layout = layouts[3], mwfact = .60 }
mytags[5] = { name = "go", layout = layouts[1] }
mytags[6] = { name = "roku", layout = layouts[1] }
mytags[7] = { name = "nana", layout = layouts[5] }
mytags[8] = { name = "hachi", layout = layouts[6] }
mytags[9] = { name = "kyu", layout = layouts[10] }
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = {}
-- Create 9 tags per screen.
for tagnumber = 1, 9 do
-- Create the tag with name from table above
tags[s][tagnumber] = tag(mytags[tagnumber].name)
-- Add tags to screen one by one
tags[s][tagnumber].screen = s
-- Set layout
if mytags[tagnumber].layout then
awful.layout.set(mytags[tagnumber].layout, tags[s][tagnumber])
else
awful.layout.set(layouts[1], tags[s][tagnumber])
end
if mytags[tagnumber].mwfact then
awful.tag.setmwfact(mytags[tagnumber].mwfact, tags[s][tagnumber])
end
if mytags[tagnumber].nmaster then
awful.tag.setnmaster(mytags[tagnumber].nmaster, tags[s][tagnumber])
end
end
-- I'm sure you want to see at least one tag.
tags[s][1].selected = true
end
-- }}}
If you want to give your tags a different name and layout replace the code below (from the standard Awesome config) with the code above.
- Code: Select all
-- {{{ Tags
-- Define tags table.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = {}
-- Create 9 tags per screen.
for tagnumber = 1, 9 do
tags[s][tagnumber] = tag(tagnumber)
-- Add tags to screen one by one
tags[s][tagnumber].screen = s
awful.layout.set(layouts[1], tags[s][tagnumber])
end
-- I'm sure you want to see at least one tag.
tags[s][1].selected = true
end
-- }}}
In the upper part of the code you can change the name and layout like this:
- Code: Select all
mytags[1] = { name = "WWW", layout = layouts[10] }
This gives 'tag 1' the name 'WWW' and the layout is 'floating'
I've numberd the layouts in my rc file to make it easy to understand:
- Code: Select all
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.tile, -- 1
awful.layout.suit.tile.left, -- 2
awful.layout.suit.tile.bottom, -- 3
awful.layout.suit.tile.top, -- 4
awful.layout.suit.fair, -- 5
awful.layout.suit.fair.horizontal, -- 6
awful.layout.suit.max, -- 7
awful.layout.suit.max.fullscreen, -- 8
awful.layout.suit.magnifier, -- 9
awful.layout.suit.floating -- 10
}
You can also disable some layouts by placing two minus signs before the layouts, like this:
- Code: Select all
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.tile, -- 1
awful.layout.suit.tile.left, -- 2
awful.layout.suit.tile.bottom, -- 3
--awful.layout.suit.tile.top,
awful.layout.suit.fair, -- 4
--awful.layout.suit.fair.horizontal,
awful.layout.suit.max, -- 5
awful.layout.suit.max.fullscreen, -- 6
--awful.layout.suit.magnifier,
awful.layout.suit.floating -- 7
}
As you can see this changes the numbering of the layouts, you can also change the order of the layouts.
Adding shortcuts to Awesome's menu
In this example I've added leafpad and mocp (which starts in a console) to the menu.
- Code: Select all
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
{ "restart", awesome.restart },
{ "quit", awesome.quit }
}
mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal },
{ "leafpad", "leafpad" },
{ "mocp", terminal .. " -e mocp" },
{ "Debian", debian.menu.Debian_menu.Debian }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu })
Here you can change the default editor and terminal
- Code: Select all
-- This is used later as the default terminal and editor to run.
terminal = "rxvt"
editor = os.getenv("EDITOR") or "editor"
editor_cmd = terminal .. " -e " .. editor
If you want to change for example the terminal used by Awesome, just replace "rxvt" with your favorite console.
Shortcut keys
In the examples below you can see how to add shortcut keys to quickly start programs you use often with a keystroke like 'Control+F1' to start fbrun or setup your multimedia keys:
- Code: Select all
key({ "Control" }, "F1", function () awful.util.spawn ("fbrun -nearmouse -font terminus-8") end),
key({ "Control" }, "F2", function () awful.util.spawn ("xterm") end),
key({ "Control" }, "F3", function () awful.util.spawn ("rox") end),
key({ }, "XF86Music", function () awful.util.spawn ("mocp --play") end),
key({ }, "XF86AudioPlay", function () awful.util.spawn ("mocp --toggle-pause") end),
key({ }, "XF86AudioStop", function () awful.util.spawn ("mocp --exit") end),
key({ }, "XF86AudioNext", function () awful.util.spawn ("mocp --next") end),
key({ }, "XF86AudioPrev", function () awful.util.spawn ("mocp --previous") end),
You can put your keys in the 'global keys =' part of rc.lua. I've put my shortcut keys below the 'Standard progam' part:
- Code: Select all
-- Standard program
key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
key({ modkey, "Control" }, "r", awesome.restart),
key({ modkey, "Shift" }, "q", awesome.quit),
key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
-- My keys
key({ "Control" }, "F1", function () awful.util.spawn ("fbrun -nearmouse -font terminus-8") end),
key({ "Control" }, "F2", function () awful.util.spawn ("xterm") end),
key({ "Control" }, "F3", function () awful.util.spawn ("rox") end),
key({ "Control" }, "F4", function () awful.util.spawn ("leafpad") end),
key({ "Control" }, "F5", function () awful.util.spawn ("kazehakase") end),
key({ "Control" }, "F6", function () awful.util.spawn ("midori") end),
key({ "Control" }, "F7", function () awful.util.spawn ("iceweasel") end),
key({ "Control" }, "F8", function () awful.util.spawn ("sylpheed") end),
key({ "Control" }, "F11", function () awful.util.spawn ("xlock -nolock -mode random -fullrandom") end),
key({ "Control" }, "F12", function () awful.util.spawn ("xlock -mode random -fullrandom") end),
key({ "Control" }, "Print", function () awful.util.spawn ("scrot") end),
key({ "Control", "Mod1" }, "Escape", function () awful.util.spawn ("xkill") end),
-- Multimedia keys
key({ }, "XF86Music", function () awful.util.spawn ("mocp --play") end),
key({ }, "XF86AudioPlay", function () awful.util.spawn ("mocp --toggle-pause") end),
key({ }, "XF86AudioStop", function () awful.util.spawn ("mocp --exit") end),
key({ }, "XF86AudioNext", function () awful.util.spawn ("mocp --next") end),
key({ }, "XF86AudioPrev", function () awful.util.spawn ("mocp --previous") end),
Part two of this howto is almost finished now, I'll only have to add a howto change the layout of the panel and then howto use/change themes in part three.
Here you can find my rc.lua, my theme and a couple of screenshots 1, 2 and 3.
More information can be found on the following sites:
Awesome home page
Awesome Wiki
User config examples