awesome

From ArchWiki
(Redirected from Awesome (window manager))
Jump to: navigation, search

From the awesome website:

awesome is a highly configurable, next generation framework window manager for X. It is very fast, extensible and licensed under the GNU GPLv2 license. It is primarily targeted at power users, developers and any people dealing with every day computing tasks and who want to have fine-grained control on its graphical environment.

Installation

Install awesome. The development version is awesome-gitAUR, which is considered unstable and may have a different configuration API.

To run awesome from Xinitrc, add exec awesome to ~/.xinitrc. To use the included xsession file, see Display manager.

KDM

Create as root:

/usr/share/apps/kdm/sessions/awesome.desktop
[Desktop Entry]
Name=Awesome
Comment=Tiling Window Manager
Type=Application
Exec=/usr/bin/awesome
TryExec=/usr/bin/awesome

With GNOME

You can set up GNOME to use awesome as the visual interface, but have GNOME work in the background. See awesome wiki for details.

Configuration

The lua based configuration file is at ~/.config/awesome/rc.lua.

Creating the configuration file

First, run the following to create the directory needed in the next step:

$ mkdir -p ~/.config/awesome/

Whenever compiled, awesome will attempt to use whatever custom settings are contained in ~/.config/awesome/rc.lua. This file is not created by default, so we must copy the template file first:

$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome/

The API for the configuration often changes when awesome updates. So, remember to repeat the command above when you get something strange with awesome, or you want to modify the configuration.

For more information about configuring awesome, check out the configuration page at awesome wiki

Examples

Note: The API for awesome configuration changes regularly, so you will likely have to modify any file you download.

Some good examples of rc.lua would be as follows:

Extensions

Several extensions are available for awesome (3.5+):

Extension Functionality
Bring up a view of all opened clients
Dynamic tagging
Pop-up notifications
Additional widgets
Start a program if no instance exists, else jump to it

Autorun programs

See awesome wiki and Autostart.

Changing keyboard layout

See awesome wiki and Keyboard configuration in Xorg.

Theming

Beautiful is a lua library that allows you to theme awesome using an external file, it becomes very easy to dynamically change your whole awesome colours and wallpaper without changing your rc.lua.

The default theme is at /usr/share/awesome/themes/default. Copy it to ~/.config/awesome/themes/default and change theme_path in rc.lua.

beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")

See also [1] and [2].

Wallpaper

Beautiful can handle your wallpaper, thus you do not need to set it up in your .xinitrc or .xsession files. This allows you to have a specific wallpaper for each theme.

With version 3.5 Awesome no longer provides a awsetbg command, instead it has a gears module. You can set your wallpaper inside theme.lua with

theme.wallpaper = "~/.config/awesome/themes/awesome-wallpaper.png" 

To load the wallpaper, make sure your rc.lua contains

beautiful.init("~/.config/awesome/themes/default/theme.lua")
for s = 1, screen.count() do
	gears.wallpaper.maximized(beautiful.wallpaper, s, true)
end

For a random background image, add [3] to rc.lua (v3.5+). To automatically fetch images from a given directory use [4] instead.

Tips and tricks

Hide / show wibox

To map Modkey-b to hide/show default statusbar on active screen (as default in awesome 2.3), add to your globalkeys in rc.lua:

awful.key({ modkey }, "b", function ()
    mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
end),

Screenshot

See Extra keyboard keys to ensure the PrtSc button is assigned correctly. Then install a screen capturing program such as scrot

Add to the globalkeys array:

 awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),

This function saves screenshots inside ~/screenshots/, edit as needed.

Removing window gaps

As of awesome 3.4, it is possible to remove the small gaps between windows; in the awful.rules.rules table there is a properties section, add to it

 size_hints_honor = false

Transparency

See composite manager.

In awesome 3.5, window transparency can be set dynamically using signals. For example, rc.lua could contain the following:

client.connect_signal("focus", function(c)
                              c.border_color = beautiful.border_focus
                              c.opacity = 1
                           end)
client.connect_signal("unfocus", function(c)
                                c.border_color = beautiful.border_normal
                                c.opacity = 0.7
                             end)

Conky

Merge-arrows-2.pngThis article or section is a candidate for merging with Conky.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Awesome#)

If using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain

own_window yes
own_window_transparent yes
own_window_type desktop

Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.

wiboxes

As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:

bg_normal = #000000AA

where "AA" is the transparency value.

To change transparency for the actual selected window by pressing Modkey + PgUp/PgDown you can also use transset-df and the following modification to your rc.lua:

globalkeys = awful.util.table.join(
    -- your keybindings
    [...]
    awful.key({ modkey }, "Next", function (c)
        awful.util.spawn("transset-df --actual --inc 0.1")
    end),
    awful.key({ modkey }, "Prior", function (c)
        awful.util.spawn("transset-df --actual --dec 0.1")
    end),
    -- Your other key bindings
    [...]
)

ImageMagick

Merge-arrows-2.pngThis article or section is a candidate for merging with Composite manager.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Awesome#)

You may have problems if you set your wallpaper with imagemagick's display command. It does not work well with xcompmgr. Please note that awsetbg may be using display if it does not have any other options. Installing habak, feh, hsetroot or whatever should fix the problem (grep -A 1 wpsetters /usr/bin/awsetbg to see your options).

Passing content to widgets with awesome-client

You can easily send text to an awesome widget. Just create a new widget:

mywidget = widget({ type = "textbox", name = "mywidget" })
mywidget.text = "initial text"

To update the text from an external source, use awesome-client:

echo -e 'mywidget.text = "new text"' | awesome-client

Do not forget to add the widget to your wibox.

Using a different panel with awesome

If you like awesome's lightweightness and functionality but do not like the way its default panel looks, you can install a different panel, for example xfce4-panel.

Then add it to the autorun section of your rc.lua. You may also comment out the section which creates wiboxes for each screen (starting from mywibox[s] = awful.wibox({ position = "top", screen = s })) but it is not necessary. Do not forget to check your rc.lua for errors by typing:

$ awesome -k rc.lua

You should also change your modkey+R keybinding, in order to start some other application launcher instead of built in awesome. See List of applications#Application launchers for examples. Do not forget to add:

      properties = { floating = true } },
    { rule = { instance = "$yourapplicationlauncher" },

to your rc.lua.

Application directories in menubar

awesome includes menubar. By default, pressing Mod+p will open a dmenu-like applications menu at the top of the screen. However, this menu only searches for .desktop files in /usr/share/applications and /usr/local/share/applications.

To change this, add the following line to rc.lua, ideally, under Menubar configuration:

app_folders = { "/usr/share/applications/", "~/.local/share/applications/" }

Note that the .desktop files are re-read each time awesome starts, thereby slowing down the startup. If you prefer other means of launching programs, the menubar can be disabled in rc.lua by removing local menubar = require("menubar") and other references to the menubar variable.

Pop-up menus

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: Duplicate section? (Discuss in Talk:Awesome#)

There is a simple menu by default in awesome 3, simplifying custom menus. [5] If you want a freedesktop.org menu, you could take a look at awesome-freedesktop. See [6] for an example for awesome3.

Applications menu

If you prefer to see a more traditional applications menu when you click on the Awesome icon, or right-click on an empty area of the desktop, you can follow the instructions in Xdg-menu#Awesome. However this menu is not updated when you add or remove programs. So, be sure to run the command to update your menu. It may look something like:

 xdg_menu --format awesome --root-menu /etc/xdg/menus/arch-applications.menu >~/.config/awesome/archmenu.lua

Titlebars

It is easy to enable titlebars in awesome by simply setting the variable titlebars_enabled to true in the config file. However, you may want to be able to toggle the titlebar on or off. You can do this by simply adding something like this to your key bindings:

awful.key({ modkey, "Control" }, "t",
   function (c)
       -- toggle titlebar
       awful.titlebar.toggle(c)
   end)

Then you may want to initially hide the titlebars. To do that just add this immediately after the title bar is created:

awful.titlebar.hide(c)

Battery notification

See [7] for a simple battery notification to add to rc.lua. Note that its needs naughty for the notifications (installed by default in version 3.5). Other examples are available at awesome wiki

Troubleshooting

Debugging rc.lua

Xephyr allows you to run X nested in another X's client window. This allows you to debug rc.lua without breaking your current desktop. Start by copying rc.lua into a new file (e.g. rc.lua.new), and modify it as needed. Then run new instance of awesome in Xephyr, supplying rc.lua.new as a config file like this:

$ Xephyr :1 -ac -br -noreset -screen 1152x720 &
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new

The advantage of this approach is that if you introduce bugs you do not break your current awesome desktop, potentially crashing X apps and losing work. Once you are happy with the new configuration, copy rc.lua.new to rc.lua and restart awesome.

awmtt

awmttAUR (Awesome WM Testing Tool) is an easy to use wrapper script around Xephyr. By default, it will use ~/.config/awesome/rc.lua.test. If it cannot find that test file, it will use your actual rc.lua. You can also specify the location of the configuration file you want to test:

$ awmtt start -C ~/.config/awesome/rc.lua.new

When you are done testing, close the window with:

$ awmtt stop

Or immediately see the changes you are doing to the configuration file by issuing:

$ awmtt restart

Log Files

If you are using LightDM, awesome will log errors to `$HOME/.xsession-errors`. If you use .xinitrc to start awesome, this FAQ entry may be a helpful resource.

Mod4 key

Merge-arrows-2.pngThis article or section is a candidate for merging with Configuring_keyboard_layouts_in_X.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Awesome#)

Awesome recommends to remap mod4, which by default should be Win key. If for some reason it is not mapped to mod4, use xmodmap to find out what is. To change the mapping, use xev to find the keycode and name of the key to be mapped. Then add something like the following to ~/.xinitrc

xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"
exec awesome

The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.

To remap mod4 with setxkbmap (conflict with xmodmap) see:

tail -50 /usr/share/X11/xkb/rules/evdev

To set the caps lock key as mod4 add the following to ~/.xinitrc:

setxkbmap -option caps:hyper

Mod4 key vs. IBM ThinkPad users

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: Duplicate section (Discuss in Talk:Awesome#)

IBM ThinkPads, IBM Model M's and Chromebooks do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:

modkey = "Mod4"

by:

modkey = "Mod1"

Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.

If you have a Chromebook or do not like to change the Awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap

clear lock
add mod4 = Caps_Lock

and run xmodmap ~/.Xmodmap to (re)load the file. This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.

Recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard and IBM Model M and xorg-server 1.14.5-2):

keysym Caps_Lock = Super_L Caps_Lock

Fix Java (GUI appears gray only)

Merge-arrows-2.pngThis article or section is a candidate for merging with Java.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Awesome#)

See awesome wiki and [8].

Eclipse: cannot resize/move main window

If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.

workbench.xml can be found in eclipse_workspace/.metadata/.plugins/org.eclipse.ui.workbench/. Edit the line:

<window height="xx" maximized="true" width="xx" x="xx" y="xx"

scrot: Cannot take a mouse selected screenshot with keyboard shortcuts

When using scrot, you may have problems at assigning a keyboard shortcut to the mouse selection option (formally scrot -s). To fix it, add the following line to your rc.lua:

awful.key( { modkey,	 }, <shortcut>, function () awful.util.spawn_with_shell("sleep 0.5 && scrot -s") end)

YouTube: fullscreen appears in background

If YouTube videos appear underneath your web browser when in fullscreen mode, or underneath the panel with controls hidden, add this to rc.lua

{ rule = { instance = "plugin-container" },
  properties = { floating = true } },

With Chromium add

{ rule = { instance = "exe" },
  properties = { floating = true } },

or:

{ rule = { role = "_NET_WM_STATE_FULLSCREEN" },
  properties = { floating = true } },

See [9].

Prevent the mouse scroll wheel from changing tags

In your rc.lua, change the Mouse Bindings section to the following;

-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end)))
-- }}}

Starting console clients on specific tags

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Useless without reasoning, probably related to instance names (Discuss in Talk:Awesome#)

It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). URxvt is known to work.

See also