Difference between revisions of "Awesome (window manager)"

From ArchWiki
Jump to navigation Jump to search
(Make for loop easier to read (?))
(redir)
 
(36 intermediate revisions by 18 users not shown)
Line 1: Line 1:
[[Category:Dynamic WMs (English)]]
+
#REDIRECT [[awesome]]
[[Category:HOWTOs (English)]]
 
{{i18n|Awesome3}}
 
 
 
From the awesome website:
 
 
 
"''[http://awesome.naquadah.org/ 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==
 
 
 
[http://aur.archlinux.org/packages.php?ID=41362 awesome] is available in the [[AUR]] because of cairo-xcb backend.
 
 
 
Alternatively, install the newer development branch [http://aur.archlinux.org/packages.php?ID=13916 awesome-git] from the [[AUR]].
 
 
 
==Getting Started==
 
 
 
===Using awesome===
 
To run awesome without a login manager, simply add '''<tt>exec awesome</tt>''' 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 '''<tt>exec ck-launch-session awesome</tt>''' can solve your problems.
 
 
 
To start awesome from a login manager, see [[Display Manager|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. <br>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
 
However, you can also start awesome as preferred user without any login manager and even without logging in, after editing ~/.xinitrc and /etc/inittab properly. Refer to the article [[Start X at boot]].
 
 
 
==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 <tt>~/.config/awesome/rc.lua</tt>.
 
 
 
===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 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 [http://awesome.naquadah.org/wiki/Awesome_3_configuration 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:
 
 
 
* http://git.sysphere.org/awesome-configs/tree/ - Awesome 3.4 configurations from Adrian C. (anrxc)
 
* http://pastebin.com/f6e4b064e - Darthlukan's awesome 3.4 configuration.
 
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua
 
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua
 
* http://oxmoz.no-ip.org/awesome/rc.lua
 
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - Awesome 3 with small titlebar and statusbar.
 
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua
 
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua
 
* User Configuration Files  http://awesome.naquadah.org/wiki/User_Configuration_Files
 
 
 
===Debug rc.lua using Xephyr===
 
 
 
This is my prefered way to debug rc.lua, without breaking my current desktop. I first copy my rc.lua into a new file, rc.lua.new, and modify it as needed. Then, I run new instance of awesome in Xephyr (allows you to run X nested in another X's client window, supplying rc.lua.new as a config file like this:
 
 
 
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &
 
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new
 
 
 
Big advantage of this approach is that if I break rc.lua.new, I don't break my current awesome desktop (and possibly crash all my X apps, lose all unsaved things and so on...). Once I'm happy with my new settings, I move rc.lua.new to rc.lua and restart awesome. And I can be sure it will work and restarting with new config won't mess up things.
 
 
 
==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 ~/.config/awesome/themes/default and change theme_path in rc.lua.
 
 
 
More details [http://awesome.naquadah.org/wiki/Beautiful here]
 
 
 
A few sample [http://awesome.naquadah.org/wiki/Beautiful_themes 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 awsetbg to set your wallpaper, you can write:
 
 
 
wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }
 
 
 
{{Note|For awsetbg to work you need to have a program that can manage desktop backgrounds installed. For example '''[[Feh]]'''.}}
 
 
 
====Random Background Image====
 
To rotate the wallpapers randomly, just comment the wallpaper_cmd line above, and add a script into your .xinitrc with the codes below:
 
<pre>
 
while true;
 
do
 
  awsetbg -r <path/to/the/directory/of/your/wallpapers>
 
  sleep 15m
 
done &
 
</pre>
 
 
 
==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 wibox in awesome 3===
 
 
 
To map Modkey-b to hide/show default statusbar on active screen (as default in awesome 2.3), add to your ''clientkeys'' in rc.lua:
 
 
 
awful.key({ modkey }, "b", function ()
 
    mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
 
end),
 
 
 
===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 too 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 matter where) type:
 
 
 
Lua code:
 
 
 
  awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),
 
 
 
A good place to put 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===
 
 
 
[http://awesome.naquadah.org/wiki/Eminent Eminent] is a small lua library that monkey-patches awful to provide you with effortless and quick wmii-style dynamic tagging. Unlike shifty, eminent does not aim to provide a comprehensive tagging system, but tries to make dynamic tagging as simple as possible. In fact, besides importing the eminent library, you do not have to change your rc.lua at all, eminent does all the work for you.
 
 
 
[http://awesome.naquadah.org/wiki/Shifty Shifty] is an Awesome 3 extension that implements dynamic tagging. It also implements fine client matching configuration allowing YOU to be the master of YOUR desktop only by setting two simple config variables and some keybindings!
 
 
 
===Space Invaders===
 
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders] is a demo to show the possibilities of the Awesome Lua API.
 
 
 
Please note that it is no longer included in the Awesome package since the 3.4-rc1 release.
 
 
 
===Naughty for popup notification===
 
TODO
 
[http://awesome.naquadah.org/wiki/index.php?title=Naughty]
 
 
 
===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 ''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.
 
 
 
An example for awesome3:
 
<pre>
 
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 }
 
                                      }
 
                            })
 
</pre>
 
 
 
===More Widgets in awesome===
 
''Widgets in awesome are objects that you can add to any widget-box (statusbars and titlebars), they can provide various information about your system, and are useful for having access to this information, right from your window manager. Widgets are simple to use and offer a great deal of flexibility.'' -- Source [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets].
 
 
 
There's a widely used widget library called '''Wicked''' (compatible with awesome versions '''prior to 3.4'''), that provides more widgets, like MPD widget, CPU usage, memory usage, etc. For more details see the [http://awesome.naquadah.org/wiki/index.php?title=Wicked Wicked page].
 
 
 
As a replacement for Wicked in awesome v3.4 check '''[http://awesome.naquadah.org/wiki/Vicious Vicious]''', '''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' and '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''. If you pick vicious, you are also suggested to take a good look at [http://git.sysphere.org/vicious/tree/README vicious documentation].
 
 
 
===Transparency===
 
Awesome has support for true transparency through xcompmgr.  Note that you'll probably want the git version of xcompmgr, which is [http://aur.archlinux.org/packages.php?ID=16554 available in AUR]. 
 
 
 
Add this to your ~/.xinitrc:
 
xcompmgr &
 
See ''man xcompmgr'' or [[xcompmgr]] for more options.
 
 
 
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:
 
 
 
client.add_signal("focus", function(c)
 
                              c.border_color = beautiful.border_focus
 
                              c.opacity = 1
 
                            end)
 
client.add_signal("unfocus", function(c)
 
                                c.border_color = beautiful.border_normal
 
                                c.opacity = 0.7
 
                              end)
 
 
 
Note that if you are 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.
 
 
 
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.
 
 
 
==== ImageMagick ====
 
You may have problems if you set your wallpaper with imagemagick's ''display'' command, it doesn't work well with xcompmgr. Please note that awsetbg may be using ''display'' if it doesn't 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).
 
 
 
===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 in pairs(autorunApps) do
 
        awful.util.spawn(app)
 
    end
 
end
 
or like this:
 
os.execute("mutt &"),
 
os.execute("weechat-curses &"),
 
 
 
To execute an application only once, e.g. for restarting awesome, use this function (from the [http://awesome.naquadah.org/wiki/Autostart awesome wiki]):
 
function run_once(prg)
 
if not prg then
 
do return nil end
 
end
 
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")
 
end
 
 
 
-- AUTORUN APPS!
 
run_once("parcellite")
 
 
 
===Passing content to widgets with awesome-client===
 
 
 
You can easily send text to an awesome widget. Just create a new widget:
 
<pre>
 
mywidget = widget({ type = "textbox", name = "mywidget" })
 
mywidget.text = "initial text"
 
</pre>
 
To update the text from an external source, use awesome-client:
 
<pre>
 
echo -e 'mywidget.text = "new text"' | awesome-client
 
</pre>
 
Don't forget to add the widget to your wibox.
 
 
 
===Using some eyecandy panels with awesome===
 
 
 
If you like awesome lightweightness and functionality, but don't like it hacker stile look, you can transform it into eyecandy by using alternative panel. Just install xfce4-panel by:
 
<pre>
 
sudo pacman -S xfce4-panel
 
</pre>
 
Then add it to autorun section of your rc.lua (howto is written above). Supposing that configuration of panel won't be difficult for awesome user. You can also comment section, which create wiboxes for each screen (starting from "mywibox[s] = awful.wibox({ position = "top", screen = s })" ) but it isn't necessary. Any way don't forget to check your rc.lua by typing
 
<pre>
 
awesome -k rc.lua
 
</pre>
 
Also you should change your "modkey+R" keybinding, in order to start some other application launcher instead of built in awesome. Xfrun4, bashrun, etc. Check the Application launchers section of [[openbox]] article for  examples. Don't forget to add
 
<pre>
 
      properties = { floating = true } },
 
    { rule = { instance = "$yourapplicationlauncher" },
 
</pre>
 
to your rc.lua.
 
It should work with other panels, but I didn't tested them. Also feel free to add other parts of DE to your awesome.
 
 
 
==Troubleshooting==
 
 
 
===Mod4 key===
 
 
 
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, 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
 
 
 
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.
 
 
 
====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.
 
 
 
If you don't 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 [http://wiki.archlinux.org/index.php/Extra_Keyboard_Keys_in_Xorg#Introduction_2 (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.
 
 
 
===Brasero===
 
If Brasero doesn't detect your blank disks when started in Awesome, but works just fine when started in Gnome, try using
 
$ dbus-launch brasero
 
 
 
==External Links==
 
* http://awesome.naquadah.org/wiki/FAQ - FAQ
 
* http://www.lua.org/pil/ - Programming in Lua (first edition)
 
* http://awesome.naquadah.org/ - The official awesome website
 
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki
 
* http://www.penguinsightings.org/desktop/awesome/ - A review
 

Latest revision as of 17:18, 29 August 2011

Redirect to: