Awesome3

From ArchWiki

(Redirected from Awesome)
Jump to: navigation, search


i18n
Česky
English
简体中文

Contents

Introduction

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 primarly 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

Awesome 3.x is available in the community repositories, just:

# pacman -S awesome

Wicked is a lua library for awesome3 to provide more widgets, like MPD Widgets, CPU usage, memory usage, etc. You can require() it from within rc.lua, and set up all your widgets from inside the same config file, without having to run a separate program with separate config files. Wicked has not appeared in the standard repositories at present, but in the AUR. If you really want it, just:

# yaourt -S wicked-git

Awesome-git and wicked-git

Git-based development versions are available from AUR, see awesome-git, wicked-git.

There are several ways to install them. The easiest is to use "yaourt" (also available in the AUR). If you have yaourt installed, simply:

# yaourt -S awesome-git wicked-git

Getting Started

Using awesome

To run awesome without a login manager, simply add exec awesome to the startup script of your choice (e.g. ~/.xinitrc.)

If you have problems with some devices (like mounting usbkeys, reading dvds) be sure to read documentation about hal and policykit. When you don't use a login manager, nothing is automated. In some cases, using exec ck-launch-session awesome can solve your problems.

To start awesome from a login manager, see this article.

SLIM is a popular lightweight login manager and comes highly recommended. You should do like this:

1) Edit /etc/slim.conf for start awesome session, add awesome to sessions line. For example:

sessions             awesome,wmii,xmonad

2) Edit ~/.xinitrc file

DEFAULT_SESSION=awesome
case $1 in
  awesome) exec awesome ;;
  wmii) exec wmii ;;
  xmonad) exec xmonad ;;
  *) exec $DEFAULT_SESSION ;;
esac

Configuration

Awesome includes some good default settings right out of the box, but sooner or later you'll want to change something. The lua based configuration file is at ~/.config/awesome/rc.lua.

Creating the configuration file

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/rc.lua

The syntax of the configuration often changes when awesome updates. So, remember to repeate the command above when you get something strange with awesome, or you'd like to modify the configuration.

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

More configuration resources

Note: The syntax of 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:

Themes

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 ~/.awesome/themes/default and change theme_path in rc.lua.

More details here

A few sample themes

Setting up your wallpaper

Beautiful can handle your wallpaper, thus you don't need to set it up in your .xinitrc or .xsession files. This allows you to have a specific wallpaper for each theme. If you take a look at the default theme file you'll see a wallpaper_cmd key, the given command is executed when beautiful.init("path_to_theme_file") is run. You can put here you own command or remove/comment the key if you don't want Beautiful to interfere with your wallpaper business.

For instance, if you use fbsetbg to set your wallpaper, you can write:

wallpaper_cmd = fbsetbg -f .config/awesome/themes/awesome-wallpaper.png

Tips & Tricks

Feel free to add any tips or tricks that you would like to pass on to other awesome users.

Expose effect like compiz

Revelation brings up a view of all your open clients; left-clicking a client pops to the first tag that client is visible on and raises/focuses the client. In addition, the Enter key pops to the currently focused client, and Escape aborts.

http://awesome.naquadah.org/wiki/Revelation

Hide / show statusbars in awesome 3.0?

Lua code:

mystatusbar.screen = nil

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

keybinding.new({ modkey }, "b", function () 
     if mystatusbar[mouse.screen].screen == nil then 
        mystatusbar[mouse.screen].screen = mouse.screen
    else
        mystatusbar[mouse.screen].screen = nil
    end
end):add()

Do not forget replace mystatusbar with the name of your statusbar

Enable printscreens

To enable printscreens in awesome through the PrtScr button you need to have a screen capturing program. Scrot is a easy to use utility for this purpose and is available in Arch repositories.

Just type:

# pacman -S scrot

and install optional dependencies if you feel that you need them.

Next of we need to get the key name for PrtScr, most often this is named "Print" but one can never be to sure.

Start up:

# xev

And press the PrtScr button, the output should be something like:

 KeyPress event ....
     root 0x25c, subw 0x0, ...
     state 0x0, keycode 107 (keysym 0xff61, Print), same_screen YES,
     ....

In my case as you see, the keyname is Print.

Now to the configuration of awesome!

Somewhere in your globalkeys array (doesn't mather where) type:

Lua code:

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

A good place to place this is bellow the keyhook for spawning a terminal. To find this line search for: awful.util.spawn(terminal) in your favourite text editor.

Also, this function saves screenshots inside ~/screenshots/, edit this to fit your needs.

Dynamic tagging using Eminent

TODO... [1]

Note: Eminent is a bit old and outdated. We have a new library in the works, Shifty. It hasn't been included with the main source yet, but is very promising. I'd recommend waiting for that and then writing this section for it. Shifty Video (.ogv)

Note2: There is actually yet another implementation of this feature. I'm hoping it merges with Shifty, and I'm poking the developers in that direction.

Space Invaders

TODO [2]

Naughty for popup notification

TODO [3]

Popup Menus

There's a simple menu by default in awesome3, and customed menus seem very easy now. However, if you're using 2.x awesome, have a look at awful.menu.

An example for awesome3:

myawesomemenu = {
   { "lock", "xscreensaver-command -activate" },
   { "manual", terminal .. " -e man awesome" },
   { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
   { "restart", awesome.restart },
   { "quit", awesome.quit }
}

mycommons = {
   { "pidgin", "pidgin" },
   { "OpenOffice", "soffice-dev" },
   { "Graphic", "gimp" }
}

mymainmenu = awful.menu.new({ items = { 
                                        { "terminal", terminal },
                                        { "icecat", "icecat" },
                                        { "Editor", "gvim" },
                                        { "File Manager", "pcmanfm" },
                                        { "VirtualBox", "VirtualBox" },
                                        { "Common App", mycommons, beautiful.awesome_icon },
                                        { "awesome", myawesomemenu, beautiful.awesome_icon }
                                       }
                             })

Widgets using wicked

Wicked is a lua library for awesome3 to provide more widgets.

Make sure that you've installed wicked. See the Installation section above.

Configuring wicked is easy, just add the following line to the top of your rc.lua and you're ready to go.

require("wicked")

Then add the following lines in the end of your rc.lua:

-- Widgets using wicked
-- Merory usage
memwidget = widget({
   type = 'textbox',
   name = 'memwidget',
   align = "right"
})
wicked.register(memwidget, wicked.widgets.mem,
   ' RAM: $1% ($2Mb/$3Mb) || ')

--date
datewidget = widget({
   type = 'textbox',
   name = 'datewidget',
})
wicked.register(datewidget, wicked.widgets.date,
   ' %c')

-- file system
fswidget = widget({
   type = 'textbox',
   name = 'fswidget',
   align = "right"
})
wicked.register(fswidget, wicked.widgets.fs,
   ' DiskUsage: /root ${/ usep}% , /home ${/home usep}% (${/home used}/${/home size}) || ', 30)

-- cpu
cpuwidget = widget({
   type = 'textbox',
   name = 'cpuwidget',
   align = "right"
})
wicked.register(cpuwidget, wicked.widgets.cpu,
   ' CPU: $1% $2% || ')

-- net
netwidget = widget({
   type = 'textbox',
   name = 'netwidget',
   align = "right"
})
wicked.register(netwidget, wicked.widgets.net,
   ' NET: ${wlan0 down}/${wlan0 up} (${wlan0 rx}/${wlan0 tx})',
nil, nil, 3)

-- statebar in the bottom
mystatebar = wibox( {position = "bottom", fg = beautiful.fg_normal, bg = beautiful.bg_normal} )
mystatebar.widgets = {
   datewidget,
   fswidget,
   cpuwidget,
   memwidget,
   netwidget,
}
mystatebar.screen = 1

and restart awesome to check the effection.

More details see the Wicked.

Transparency

Awesome has support for (2D) transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is available in AUR.

Add this to your ~/.xinitrc

    xcompmgr &

See man xcompmgr or xcompmgr for more options.

you can set this window transparency dynamically in the rc.lua add

    c.opacity = 1

to the awful.hooks.focus.register hook (to restore Visibility) add

    c.opacity = 0.4

to the awful.hooks.unfocus.register hook (to make the Window transparent. Adjust value as comfortable)

As of Awesome 3.1, there is now built-in pseudo transparency for wiboxes. To enable, just add 2 more hexadecimals to the colors in your theme file (~/.config/awesome/themes/default usually), like shown here:

    bg_normal = #000000AA

where "AA" is the transparency value.

Autorun programs

Just add the following codes in the rc.lua, and replace the applications in the autorunApps section with anything you like. Example:

-- Autorun programs
autorun = true
autorunApps = 
{ 
   "swiftfox",
   "mutt",
   "consonance",
   "linux-fetion",
   "weechat-curses",
}
if autorun then
   for app = 1, #autorunApps do
       awful.util.spawn(autorunApps[app])
   end
end

Troubleshooting

Mod4 key

Alias the Win key. Somehow, my Mod4 key isn't mapped by default. If that's your case too, you can check the keycode of your Mod4 key with

$ xev

It should be 115 for the left one. Then add this to your ~/.xinitrc

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


Mod4 key vs. IBM ThinkPad users

IBM ThinkPads 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.


Cairo Memory Leak

If you experiencing memory leaks then try cairo-git in AUR. Forum Thread

Update: The recent Cairo 1.8.6 release is also fine to use it seems as the fix from git should be in there.

Additional Resources

Personal tools