Awesome, or awesomewm, is a window manager which comes with a lot of features, right out of the box. It is written in the Lua programming language (almost), but configuring it does not require a lot of knowledge about the same. It is ideal for people starting out with window managers due to the fact that it is shipped with a lot of useful functionality which you would otherwise have to configure separately.
The easiest way to get started (on debian based systems) is this:
sudo apt install awesome
To run it, simple add the following line in your ~/.xsession file:
exec awesome
Logout and log back in again, and boom! You are good to go.
Getting Started
When you login, awesomewm already has a default wallpaper set. Along with 9 tags on the menubar.
The default modifier in awesomewm is <Win>. To spawn a terminal, press <Win> + <Enter>. To get a list of all shortcuts, awesomewm provides a comprehensive cheat-sheet. Just press <Win> + s to view it.
To activate the application menu simply click on the top left corner of the menu bar, or right click anywhere. You will be greeted with something like this:
This menu can be used as a quick launcher, and even be configured to hold items which you want. In addition, <Win> + r can be used for spawning a run menu on the menubar. But I prefer dmenu instead.
Tags
In awesomewm, the status bar shows the number of active tags. Awesome gives you 9 tags that we can switch between. To do so, simply hit <Win> + [1-9]. For example <Win> + 6 will take you to the 6th workspace. Note that whatever was running on the previous workspace keeps on running there as usual.
To shift a currently running window to another tag, simply press <Win> + <Shift> + [1-9].
Layouts
In awesomewm, movement between windows is done using <Win> + j|k and window resizing is done using <Win> + h|l.
Awesome offers different layouts per tag, which can be viewed on the left top corner of the menu bar and can be changed by clicking on the same:
Cornernew:
Cornetnww:
Cornerser:
Cornersww:
Dwindlew:
Fairhw:
Fairvw:
Floatingw:
Fullscreenw:
Magnifierw:
Maxw:
Spiralw:
Tilebottomw:
Tileleftw:
Tiletopw:
Tilww:
Configuration
The awesome configuration lies in $XDG_CONFIG_HOME/awesome/rc.lua file. For example: /etc/xdg/awesome/rc.lua. By default awesomewm looks at the ~/.config/awesome/rc.lua file if it can find it. If it can't then it defaults to the aforementioned configuration.
To edit it, simply run the following command for getting started:
cp /etc/xdg/awesome/rc.lua ~/.config/awesome/
vim ~/.config/awesome/rc.lua
After making any changes in rc.lua, awesomewm can be reloaded by pressing <Win> + <Ctrl> + r. In addition, the awesome-client can also be used for the same:
echo'awesome.restart()' | awesome-client
In this blog, we will be configuring the following things:
The configuration file, rc.lua, contains a globalkeys option which is a table that stores keybindings.
The first section stores the modifier keys, eg: {modkey,}, {modkey, "Shift"} or {modkey, "Control"}. The second part can be used to add keys to be pressed along with the modifier, and the third part is the function to be performed when the particular binding is pressed.
Each keybinding is a part of a group and a description can be provided to go along with them. Adding a keybinding is as simple as copy-pasting the above binding and changing it with respect to what action you want to perform. For example, the following binding spawns firefox whenever I press modkey + b:
awful.key({modkey,},"b",awful.spawn("firefox"))
Adding Startup Processes
You can spawn processes or applications easily by using the following commands in rc.lua. To open these applications on startup, simply add the commands at the bottom of the configuration:
-- spawning a programawful.spawn("firefox")-- running a script inside a shellawful.spawn.with_shell("launch.sh")-- setting wallpaper using nitrogenawful.spawn.with_shell("nitrogen --set-scaled /usr/share/backgrounds/crysis.jpg")
Adding and Removing Layouts
Lain is a library which provides a lot of useful commands for configuring widgets, adding layouts and other useful tweaks. Follow the repository to see how to use lain to its fullest:
Successor of awesome-vain, this module provides alternative layouts, asynchronous widgets and utility functions for Awesome.
Contributions
Constructive criticism and suggestions are welcome.
If you want to create a pull request, make sure that:
Your code fits with the general style of the module. In particular, you should use the same indentation pattern that the code uses, and also avoid adding space at the ends of lines.
Your code its easy to understand, maintainable, and modularized. You should also avoid code duplication wherever possible by adding functions to or using lain.helpers. If something is unclear, or you can not write it in such a way that it will be clear, explain it with a comment.
You test your changes before submitting to make sure that your code works and…
Let us get started by importing lain in our rc.lua:
locallain=require("lain")
To add a layout, namely centerwork, defined by lain, simply go to the awful.layout.layouts section and add lain.layout.centerwork. Other layouts can be removed from here, if you want to. The order of the layouts matter!
Adding Useless Gaps
Useless gaps refers to the space between windows that can be added for aesthetic purposes. For example:
These gaps can be configured at runtime by adding the following keybindings to globalkeys:
These commands will resize the gaps by a factor of 1 pixel every time we press modkey + Control + =|-.
Verdict
Even though configuring awesomewm is not as easy as i3, it offers a lot of things right out of the box and is easy to get started with. Lua configuration is slightly challenging when it comes to adding additional libraries and trying to keep the code modular but there is a very supportive community and third party libraries for the same.
Awesome is a solid window manager for both beginners and experts, and I highly recommend it for both.