Package: awesome
Version: 3.2~rc4-1
Severity: important

First of all, sorry for the lousy subject, but it's exactly what's happening.
I thought it was fault of my rc.lua, but i discarded it because i tried using
the default rc.lua shipped with Debian and crashed too.
This so-called random crash could happen within 15 mins or less of usage, 
usually the apps that i have running are: pidgin, xfce4-terminal, iceweasel and
sonata. So I've tried, with no results, not running any of these apps but the 
crashes still happened.
The result of 'awesome -k' is "Configuration file syntax OK." so i dont really
know what could be.

Oh, BTW. Also i installed 'wicked', but since i'm not using it, i don't think
it has anything to do with these crashes.
So i'll leave as an attach the gdb log and my rc.lua config

Thanks for your work!

Regards,
Mauro

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=es_AR.UTF-8, LC_CTYPE=es_AR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages awesome depends on:
ii  libc6                     2.9-4          GNU C Library: Shared libraries
ii  libcairo2                 1.8.6-2        The Cairo 2D vector graphics libra
ii  libdbus-1-3               1.2.12-1       simple interprocess messaging syst
ii  libev3                    3.43-1.1       high-performance event loop librar
ii  libglib2.0-0              2.18.4-2       The GLib library of C routines
ii  libimlib2                 1.4.2-4        powerful image loading and renderi
ii  liblua5.1-0               5.1.3-1        Simple, extensible, embeddable pro
ii  libncurses5               5.7+20090228-1 shared libraries for terminal hand
ii  libpango1.0-0             1.22.4-2       Layout and rendering of internatio
ii  libreadline5              5.2-4          GNU readline and history libraries
ii  libx11-6                  2:1.1.5-2      X11 client-side library
ii  libxcb-atom1              0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-aux0               0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-event1             0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-icccm1             0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-image0             0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-keysyms0           0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-property1          0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-randr0             1.1-1.1        X C Binding, randr extension
ii  libxcb-render-util0       0.3.3-2+b1     utility libraries for X C Binding 
ii  libxcb-render0            1.1-1.1        X C Binding, render extension
ii  libxcb-shm0               1.1-1.1        X C Binding, shm extension
ii  libxcb-xinerama0          1.1-1.1        X C Binding, xinerama extension
ii  libxcb-xtest0             1.1-1.1        X C Binding, xtest extension
ii  libxcb1                   1.1-1.1        X C Binding
ii  menu                      2.1.41         generates programs menu for all me

Versions of packages awesome recommends:
ii  x11-xserver-utils             7.3+5      X server utilities

awesome suggests no packages.

-- no debconf information


-- 
JID: lavaram...@jabber.org | http://lusers.com.ar/
2B82 A38D 1BA5 847A A74D 6C34 6AB7 9ED6 C8FD F9C1
[00:03:25] terminaldelmal:~$ gdb -p $(pidof awesome)
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Attaching to process 3463
Reading symbols from /usr/bin/awesome...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libxcb.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxcb.so.1
Reading symbols from /usr/lib/libpangocairo-1.0.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libpangocairo-1.0.so.0
Reading symbols from /usr/lib/libpango-1.0.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libpango-1.0.so.0
Reading symbols from /usr/lib/libgobject-2.0.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libgobject-2.0.so.0
Reading symbols from /usr/lib/libgmodule-2.0.so.0...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libgmodule-2.0.so.0
Reading symbols from /usr/lib/libglib-2.0.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libglib-2.0.so.0
Reading symbols from /usr/lib/libxcb-randr.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-randr.so.0
Reading symbols from /usr/lib/libxcb-xtest.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-xtest.so.0
Reading symbols from /usr/lib/libxcb-xinerama.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-xinerama.so.0
Reading symbols from /usr/lib/libxcb-aux.so.0...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxcb-aux.so.0
Reading symbols from /usr/lib/libxcb-keysyms.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-keysyms.so.0
Reading symbols from /usr/lib/libxcb-icccm.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-icccm.so.1
Reading symbols from /usr/lib/libxcb-atom.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-atom.so.1
Reading symbols from /usr/lib/libxcb-image.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-image.so.0
Reading symbols from /usr/lib/libxcb-shm.so.0...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxcb-shm.so.0
Reading symbols from /usr/lib/libxcb-property.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-property.so.1
Reading symbols from /usr/lib/libxcb-event.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-event.so.1
Reading symbols from /usr/lib/libcairo.so.2...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libcairo.so.2
Reading symbols from /usr/lib/libxcb-render-util.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-render-util.so.0
Reading symbols from /usr/lib/libxcb-render.so.0...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxcb-render.so.0
Reading symbols from /usr/lib/libImlib2.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libImlib2.so.1
Reading symbols from /usr/lib/libev.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libev.so.3
Reading symbols from /usr/lib/liblua5.1.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/liblua5.1.so.0
Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /usr/lib/libdbus-1.so.3...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libdbus-1.so.3
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /usr/lib/libX11.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libX11.so.6
Reading symbols from /usr/lib/libXau.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libXau.so.6
Reading symbols from /usr/lib/libXdmcp.so.6...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libXdmcp.so.6
Reading symbols from /usr/lib/libpangoft2-1.0.so.0...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libpangoft2-1.0.so.0
Reading symbols from /usr/lib/libfreetype.so.6...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libfreetype.so.6
Reading symbols from /usr/lib/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /usr/lib/libfontconfig.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libfontconfig.so.1
Reading symbols from /usr/lib/libpcre.so.3...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libpcre.so.3
Reading symbols from /lib/libdl.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /usr/lib/libpixman-1.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libpixman-1.so.0
Reading symbols from /usr/lib/libdirectfb-1.0.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libdirectfb-1.0.so.0
Reading symbols from /usr/lib/libfusion-1.0.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libfusion-1.0.so.0
Reading symbols from /usr/lib/libdirect-1.0.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libdirect-1.0.so.0
Reading symbols from /lib/libpthread.so.0...
(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x7f289ed8c6f0 (LWP 3463)]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /usr/lib/libpng12.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libpng12.so.0
Reading symbols from /usr/lib/libXrender.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libXrender.so.1
Reading symbols from /usr/lib/libXext.so.6...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libXext.so.6
Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /lib/ld-linux-x86-64.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib/libxcb-xlib.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libxcb-xlib.so.0
Reading symbols from /usr/lib/libexpat.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libexpat.so.1
Reading symbols from /lib/libnss_compat.so.2...(no debugging symbols 
found)...done.
Loaded symbols for /lib/libnss_compat.so.2
Reading symbols from /lib/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libnss_nis.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib/libnss_nis.so.2
Reading symbols from /lib/libnss_files.so.2...(no debugging symbols 
found)...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /usr/lib/pango/1.6.0/modules/pango-basic-fc.so...(no 
debugging symbols found)...done.
Loaded symbols for /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
Reading symbols from /usr/lib/imlib2/loaders/zlib.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/zlib.so
Reading symbols from /usr/lib/imlib2/loaders/xpm.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/xpm.so
Reading symbols from /usr/lib/imlib2/loaders/tiff.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/tiff.so
Reading symbols from /usr/lib/libtiff.so.4...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libtiff.so.4
Reading symbols from /usr/lib/libjpeg.so.62...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libjpeg.so.62
Reading symbols from /usr/lib/imlib2/loaders/tga.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/tga.so
Reading symbols from /usr/lib/imlib2/loaders/pnm.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/pnm.so
Reading symbols from /usr/lib/imlib2/loaders/png.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/png.so
Reading symbols from /usr/lib/imlib2/loaders/lbm.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/lbm.so
Reading symbols from /usr/lib/imlib2/loaders/jpeg.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/jpeg.so
Reading symbols from /usr/lib/imlib2/loaders/id3.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/id3.so
Reading symbols from /usr/lib/libid3tag.so.0...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libid3tag.so.0
Reading symbols from /usr/lib/imlib2/loaders/gif.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/gif.so
Reading symbols from /usr/lib/libgif.so.4...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libgif.so.4
Reading symbols from /usr/lib/imlib2/loaders/bz2.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/bz2.so
Reading symbols from /lib/libbz2.so.1.0...(no debugging symbols found)...done.
Loaded symbols for /lib/libbz2.so.1.0
Reading symbols from /usr/lib/imlib2/loaders/bmp.so...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/bmp.so
Reading symbols from /usr/lib/imlib2/loaders/argb.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/imlib2/loaders/argb.so
(no debugging symbols found)
0x00007f289b392843 in epoll_wait () from /lib/libc.so.6
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f289ed8c6f0 (LWP 3463)]
0x00007f289baeb25a in ?? () from /usr/lib/liblua5.1.so.0
(gdb) bt
#0  0x00007f289baeb25a in ?? () from /usr/lib/liblua5.1.so.0
#1  0x00007f289baecfd0 in ?? () from /usr/lib/liblua5.1.so.0
#2  0x00007f289baeddb4 in ?? () from /usr/lib/liblua5.1.so.0
#3  0x00007f289bae46fe in ?? () from /usr/lib/liblua5.1.so.0
#4  0x00007f289bae3e37 in ?? () from /usr/lib/liblua5.1.so.0
#5  0x00007f289bae3eb5 in ?? () from /usr/lib/liblua5.1.so.0
#6  0x00007f289badff75 in lua_pcall () from /usr/lib/liblua5.1.so.0
#7  0x0000000000415760 in ?? ()
#8  0x00007f289bd09217 in ev_loop () from /usr/lib/libev.so.3
#9  0x000000000040deb9 in main ()
(gdb) bt full
#0  0x00007f289baeb25a in ?? () from /usr/lib/liblua5.1.so.0
No symbol table info available.
#1  0x00007f289baecfd0 in ?? () from /usr/lib/liblua5.1.so.0
No symbol table info available.
#2  0x00007f289baeddb4 in ?? () from /usr/lib/liblua5.1.so.0
No symbol table info available.
#3  0x00007f289bae46fe in ?? () from /usr/lib/liblua5.1.so.0
No symbol table info available.
#4  0x00007f289bae3e37 in ?? () from /usr/lib/liblua5.1.so.0
No symbol table info available.
#5  0x00007f289bae3eb5 in ?? () from /usr/lib/liblua5.1.so.0
No symbol table info available.
#6  0x00007f289badff75 in lua_pcall () from /usr/lib/liblua5.1.so.0
No symbol table info available.
#7  0x0000000000415760 in ?? ()
No symbol table info available.
#8  0x00007f289bd09217 in ev_loop () from /usr/lib/libev.so.3
No symbol table info available.
#9  0x000000000040deb9 in main ()
No symbol table info available.
(gdb)
-- mi rc.lua

-- Standard awesome library
require("awful")

-- Theme handling library
require("beautiful")

-- Notification library
require("naughty")

-- wicked
-- require("wicked")

-- Load Debian menu entries
require("debian.menu")

-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
theme_path = "/home/mauro/.config/awesome/themes/theme"

-- Actually load theme
beautiful.init(theme_path)

-- {{{ functions

function execute_command(command)
   local fh = io.popen(command)
   local str = ""
   for i in fh:lines() do
      str = str .. i
   end
   io.close(fh)
   return str
end

--- }}}

-- {{{ vars

terminal = "x-terminal-emulator"
editor = os.getenv("EDITOR") or "editor"
editor_cmd = terminal .. " -e " .. editor

modkey = "Mod1"
modkey4 = "Mod4"

spacer = " "
wrapleft = "("
wrapright = ")"

-- }}}

-- {{{ layouts

layouts =
{
    awful.layout.suit.tile,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.max,
    awful.layout.suit.floating
}

-- }}}

-- {{{ widgets

volwidget = widget({ type = 'textbox', name = 'volwidget', align = "right" })
volwidget.text = " v:" .. execute_command("~/bin/vol-status") .. "%"

tempwidget = widget({ type = 'textbox', name = 'tempwidget', align = "right" })
tempwidget.text = " t:" .. execute_command("~/bin/temp-status") .. "C"

datewidget = widget({ type = 'textbox', name = 'datewidget', align = "right" })
datewidget.text = " d:" .. execute_command("~/bin/date-status")

batwidget = widget({ type = 'textbox', name = 'batwidget', align = "right" })
batwidget.text = " b:" .. execute_command("~/bin/bat-status") .. "%"

-- }}}

-- 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,
    ["pinentry"] = true,
    ["gimp"] = true,
    -- by instance
    ["mocp"] = true
}

-- {{{ Applications to be moved to a pre-defined tag by class or instance.
-- Use the screen and tags indices.
apptags =
{
    -- im
    ["pidgin"] = { screen = 1, tag = 2 },
    ["gajim"] = { screen = 1, tag = 2 },

    -- muzzak
    ["sonata"] = { screen = 1, tag = 4 },

    -- web
    ["Iceweasel"] = { screen = 1, tag = 3 },
    ["epiphany-browser"] = { screen = 1, tag = 3 },
    ["liferea"] = { screen = 1, tag = 3 },
}

-- }}}

use_titlebar = false
-- }}}

-- {{{ Tags

awtags = {}
awtags[1] = { name = "ichi", layout = layouts[1] }
awtags[2] = { name = "ni", layout = layouts[1] }
awtags[3] = { name = "san", layout = layouts[1] }
awtags[4] = { name = "shi", layout = layouts[1] }
awtags[5] = { name = "go", layout = layouts[1] }

tags = {}
for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = {}
    for tagnumber = 1,5 do
       tags[s][tagnumber] = tag(awtags[tagnumber].name)
       tags[s][tagnumber].screen = s

       if awtags[tagnumber].layout then
          awful.layout.set(awtags[tagnumber].layout, tags[s][tagnumber])
       else
          awful.layout.set(layouts[1], tags[s][tagnumber])
       end
    end

    -- I'm sure you want to see at least one tag.
    tags[s][1].selected = true
end
-- }}}

-- {{{ Wibox

-- 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 },
                                        { "Debian", 
debian.menu.Debian_menu.Debian }
                                      }
                            })

mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
                                     menu = mymainmenu })

-- Create a systray
mysystray = widget({ type = "systray", align = "right" })

-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = { button({ }, 1, awful.tag.viewonly),
                      button({ modkey }, 1, awful.client.movetotag),
                      button({ }, 3, function (tag) tag.selected = not 
tag.selected end),
                      button({ modkey }, 3, awful.client.toggletag),
                      button({ }, 4, awful.tag.viewnext),
                      button({ }, 5, awful.tag.viewprev) }
mytasklist = {}
mytasklist.buttons = { button({ }, 1, function (c)
                                          if not c:isvisible() then
                                              awful.tag.viewonly(c:tags()[1])
                                          end
                                          client.focus = c
                                          c:raise()
                                      end),
                       button({ }, 3, function ()
                                          if instance then instance:hide() end 
instance = awful.menu.clients({ width=250 })
                                      end),
                       button({ }, 4, function ()
                                          awful.client.focus.byidx(1)
                                          if client.focus then 
client.focus:raise() end
                                      end),
                       button({ }, 5, function ()
                                          awful.client.focus.byidx(-1)
                                          if client.focus then 
client.focus:raise() end
                                      end) }

for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = widget({ type = "textbox", align = "left" })
    -- Create an imagebox widget which will contains an icon indicating which 
layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = widget({ type = "imagebox", align = "right" })
    mylayoutbox[s]:buttons({ button({ }, 1, function () 
awful.layout.inc(layouts, 1) end),
                             button({ }, 3, function () 
awful.layout.inc(layouts, -1) end),
                             button({ }, 4, function () 
awful.layout.inc(layouts, 1) end),
                             button({ }, 5, function () 
awful.layout.inc(layouts, -1) end) })

    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, 
mytaglist.buttons)

    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist.new(function(c)
                                                  return 
awful.widget.tasklist.label.currenttags(c, s)
                                              end, mytasklist.buttons)

    -- Create the wibox
    mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = 
beautiful.bg_normal })
    -- Add widgets to the wibox - order matters

    mywibox[s].widgets = { mytaglist[s],
                           mytasklist[s],
                           mypromptbox[s],
                           batwidget,
                           volwidget,
                           tempwidget,
                           datewidget,
                           mylayoutbox[s],
                           s == 1 and mysystray or nil }
    mywibox[s].screen = s
end
-- }}}

-- {{{ Mouse bindings
root.buttons({
    button({ }, 3, function () mymainmenu:toggle() end),
    button({ }, 4, awful.tag.viewnext),
    button({ }, 5, awful.tag.viewprev)
})
-- }}}

-- {{{ Key bindings
globalkeys =
{
    key({ modkey,           }, "Left",   awful.tag.viewprev       ),
    key({ modkey,           }, "Right",  awful.tag.viewnext       ),
    key({ modkey,           }, "Escape", awful.tag.history.restore),

    key({ modkey,           }, "j",
        function ()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    key({ modkey,           }, "k",
        function ()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),

    -- Layout manipulation
    key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1) 
end),
    key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1) 
end),
    key({ modkey, "Control" }, "j", function () awful.screen.focus( 1)       
end),
    key({ modkey, "Control" }, "k", function () awful.screen.focus(-1)       
end),
    key({ modkey,           }, "u", awful.client.urgent.jumpto),
    key({ modkey,           }, "Tab",
          function ()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
          end),

    -- Standard program
    key({ modkey,           }, "Return",
          function ()
               awful.prompt.run({ prompt = "Run: " },
               mypromptbox[mouse.screen],
               awful.util.spawn, awful.completion.bash,
               awful.util.getdir("cache") .. "/history")
          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 keybindings
    key({ modkey,           }, "F1",    function () awful.util.spawn 
("xfce4-terminal") end),
    key({ modkey,           }, "F2",    function () awful.util.spawn ("gmrun") 
end),
    key({ modkey,           }, "F3",    function () awful.util.spawn ("thunar") 
end),

    -- volume keybindings
    -- vol down
    key({ modkey4,          }, "F7",    function () awful.util.spawn ("aumix 
-v-5") end),
    -- vol up
    key({ modkey4,          }, "F8",    function () awful.util.spawn ("aumix 
-v+5") end),
    -- vol mute
    key({ modkey4,          }, "F9",    function () awful.util.spawn ("aumix 
-v0") end),

    -- mpd keybindings
    -- play/pause
    key({ modkey4,          }, "t",    function () awful.util.spawn ("mpc 
toggle") end),
    -- random
    key({ modkey4,          }, "r",    function () awful.util.spawn ("mpc 
random") end),
    -- next
    key({ modkey4,          }, "n",    function () awful.util.spawn ("mpc 
next") end),
    -- prev
    key({ modkey4,          }, "p",    function () awful.util.spawn ("mpc 
prev") end),

}

-- Client awful tagging: this is useful to tag some clients and then do stuff 
like move to tag on them
clientkeys =
{
    key({ modkey, "Shift"   }, "f",      function (c) c.fullscreen = not 
c.fullscreen  end),
    key({ modkey, "Shift"   }, "c",      function (c) c:kill()                  
       end),
    key({ modkey, "Control" }, "space",  awful.client.floating.toggle           
          ),
    key({ modkey, "Control" }, "Return", function (c) 
c:swap(awful.client.getmaster()) end),
    key({ modkey, "Shift"   }, "o",      awful.client.movetoscreen              
          ),
    key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                
       end),
    key({ modkey }, "t", awful.client.togglemarked),
    key({ modkey,}, "m",
        function (c)
            c.maximized_horizontal = not c.maximized_horizontal
            c.maximized_vertical   = not c.maximized_vertical
        end),
}

-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
   keynumber = math.min(9, math.max(#tags[s], keynumber));
end

for i = 1, keynumber do
    table.insert(globalkeys,
        key({ modkey, "Control" }, i,
            function ()
                local screen = mouse.screen
                if tags[screen][i] then
                    tags[screen][i].selected = not tags[screen][i].selected
                end
            end))
    table.insert(globalkeys,
        key({ modkey, "Shift" }, i,
            function ()
                if client.focus and tags[client.focus.screen][i] then
                    awful.client.movetotag(tags[client.focus.screen][i])
                end
            end))
    table.insert(globalkeys,
        key({ modkey, "Control", "Shift" }, i,
            function ()
                if client.focus and tags[client.focus.screen][i] then
                    awful.client.toggletag(tags[client.focus.screen][i])
                end
            end))
end


for i = 1, keynumber do
    table.insert(globalkeys, key({ modkey, "Shift" }, "F" .. i,
                 function ()
                     local screen = mouse.screen
                     if tags[screen][i] then
                         for k, c in pairs(awful.client.getmarked()) do
                             awful.client.movetotag(tags[screen][i], c)
                         end
                     end
                 end))
end

-- Set keys
root.keys(globalkeys)
-- }}}

-- {{{ Hooks
-- Hook function to execute when focusing a client.
awful.hooks.focus.register(function (c)
    if not awful.client.ismarked(c) then
        c.border_color = beautiful.border_focus
    end
end)

-- Hook function to execute when unfocusing a client.
awful.hooks.unfocus.register(function (c)
    if not awful.client.ismarked(c) then
        c.border_color = beautiful.border_normal
    end
end)

-- Hook function to execute when marking a client
awful.hooks.marked.register(function (c)
    c.border_color = beautiful.border_marked
end)

-- Hook function to execute when unmarking a client.
awful.hooks.unmarked.register(function (c)
    c.border_color = beautiful.border_focus
end)

-- Hook function to execute when the mouse enters a client.
awful.hooks.mouse_enter.register(function (c)
    -- Sloppy focus, but disabled for magnifier layout
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
        and awful.client.focus.filter(c) then
        client.focus = c
    end
end)

-- Hook function to execute when a new client appears.
awful.hooks.manage.register(function (c, startup)
    -- If we are not managing this application at startup,
    -- move it to the screen where the mouse is.
    -- We only do it for filtered windows (i.e. no dock, etc).
    if not startup and awful.client.focus.filter(c) then
        c.screen = mouse.screen
    end

    if use_titlebar then
        -- Add a titlebar
        awful.titlebar.add(c, { modkey = modkey })
    end
    -- Add mouse bindings
    c:buttons({
        button({ }, 1, function (c) client.focus = c; c:raise() end),
        button({ modkey }, 1, awful.mouse.client.move),
        button({ modkey }, 3, awful.mouse.client.resize)
    })
    -- New client may not receive focus
    -- if they're not focusable, so set border anyway.
    c.border_width = beautiful.border_width
    c.border_color = beautiful.border_normal

    -- Check if the application should be floating.
    local cls = c.class
    local inst = c.instance
    if floatapps[cls] then
        awful.client.floating.set(c, floatapps[cls])
    elseif floatapps[inst] then
        awful.client.floating.set(c, floatapps[inst])
    end

    -- Check application->screen/tag mappings.
    local target
    if apptags[cls] then
        target = apptags[cls]
    elseif apptags[inst] then
        target = apptags[inst]
    end
    if target then
        c.screen = target.screen
        awful.client.movetotag(tags[target.screen][target.tag], c)
    end

    -- Do this after tag mapping, so you don't see it on the wrong tag for a 
split second.
    client.focus = c

    -- Set key bindings
    c:keys(clientkeys)

    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)

    -- Honor size hints: if you want to drop the gaps between windows, set this 
to false.
    -- c.size_hints_honor = false
end)

-- Hook function to execute when arranging the screen.
-- (tag switch, new client, etc)
awful.hooks.arrange.register(function (screen)
    local layout = awful.layout.getname(awful.layout.get(screen))
    mylayoutbox[screen].image = nil
    --if layout and beautiful["layout_" ..layout] then
    --    mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
    --else
    --    mylayoutbox[screen].image = nil
    --end

    -- Give focus to the latest client in history if no window has focus
    -- or if the current window is a desktop or a dock one.
    if not client.focus then
        local c = awful.client.focus.history.get(screen, 0)
        if c then client.focus = c end
    end
end)

-- Hook called every minute
awful.hooks.timer.register(20, 
  function ()
           volwidget.text = " v:" .. execute_command("~/bin/vol-status") .. "%"
           tempwidget.text = " t:" .. execute_command("~/bin/temp-status") .. 
"C"
           datewidget.text = " d:" .. execute_command("~/bin/date-status")
           batwidget.text = " b:" .. execute_command("~/bin/bat-status") .. "%"
  end)
-- }}}

-- autostart!!
-- os.execute("thunar --daemon &")

Reply via email to