Config as of Thu, Nov 06 16:21
Works with awesome-git
-------------------------------------------
--Bavardage Awesome Config--
-------------------------------------------
require("awful")
--require("tabulous")
require("beautiful")
require("radical")
-- {{{ Variable definitions
theme_path = ".config/awesome/themes/default"
terminal = "urxvt"
barHeight = 20
modkey = "Mod4"
layouts =
{
"tile",
"tileleft",
"tilebottom",
"tiletop",
"fairh",
"fairv",
"magnifier",
"max",
"spiral",
"dwindle",
"floating"
}
tagnames = {"im", "web", "editor", "ūnus", "duo", "três"}
floatapps =
{
-- by class
["MPlayer"] = true,
["phun.bin"] = true,
["gimp"] = true,
}
apptags =
{
["firefox"] = { screen = 1, tag = 2 },
["midori"] = { screen = 1, tag = 1 },
["pidgin"] = {screen = 1, tag = 1 },
["epdfview"] = {screen = 1, tag = 5},
["irssi"] = {screen = 1, tag = 1},
["emacs"] = {screen = 1, tag = 3},
}
use_titlebar = false
-- END VARIABLE DEFINITONS}}}
-- {{{ Initialization
--normal width,
--max hover width,
--yoffset (from top),
--updateinterval (seconds)
--launchers (table with elements of form {imagepath, command})
beautiful.init(theme_path)
awful.beautiful.register(beautiful)
radical.init({
width = 75,
maxWidth = 120,
yOffset = 100,
ontop = true,
update = 0.01,
launchers = {
{"/usr/share/icons/bw2vista/scalable/apps/gnome-web-browser.png", "firefox"},
{"/usr/share/icons/bw2vista/scalable/emblems/emblem-mail.png", "thunderbird"},
{"/usr/share/icons/bw2vista/scalable/apps/im-aim.png", "exec ~/Scripts/irssi.sh"},
{"/usr/share/icons/bw2vista/scalable/apps/emacs.png", "emacs"},
{"/usr/share/icons/bw2vista/scalable/apps/ooo-writer.png", "soffice --write"},
{"/usr/share/icons/bw2vista/scalable/apps/terminal.png", "urxvtc"},
}
})
-- END INITIALISATION}}}
-- {{{ Functions
function textBox(nameIn, alignIn, defaultText)
temp = widget({
type = "textbox", name = nameIn, align = alignIn
})
temp.text = defaultText
return temp
end
function imageBox(nameIn, pathIn, alignIn, resize)
return textBox(nameIn, alignIn, "<bg image=\"" .. pathIn .. "\" resize=\"" .. resize .. "\"/>")
end
function clickableIcon(iconpath, align, callback)
icon = widget({ type="imagebox", name="icon", align=align })
icon.image = image(iconpath)
icon:buttons({
button({ }, 1, callback),
})
return icon
end
function joinTables(t1, t2)
for k,v in ipairs(t2) do table.insert(t1, v) end return t1
end
function magic()
end
-- END FUNCTIONS}}}
-- {{{ Tags.
tags = {}
for s = 1, screen.count() do
tags[s] = {}
for tagnumber = 1, #tagnames do
tags[s][tagnumber] = tag({ name = tagnames[tagnumber], layout = layouts[1] })
tags[s][tagnumber].screen = s
end
tags[s][1].selected = true
end
-- END TAGS}}}
-- {{{ Widgets
-- Archbox
--no need, just use menu instead
-- archbox = imageBox("archicon", "/home/ben/Pictures/awesome-arch-red.png", "left", "true")
-- Taglist
taglist = awful.widget.taglist.new(1, awful.widget.taglist.label.all, {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)})
-- Tasklist
tasklist = awful.widget.tasklist.new(function(c)
return awful.widget.tasklist.label.currenttags(c, 1) end, {})
-- Launchboxen
launchboxen = {}
function launchboxen:add(image, command)
local index = #self + 1
self[index] = clickableIcon(image, "left", function () awful.spawn(command) end )
end
launchboxen:add("/usr/share/pixmaps/firefox.png", "exec firefox")
--launchboxen:add("/usr/share/icons/hicolor/32x32/apps/pidgin.png", "exec pidgin")
launchboxen:add("/home/ben/Pictures/irssi_white.png", "exec ~/Scripts/irssi.sh")
launchboxen:add("/usr/share/icons/bw2vista/scalable/actions/media-playback-start.png", "exec xmms2 toggleplay")
launchboxen:add("/usr/share/icons/bw2vista/scalable/actions/media-playback-stop.png", "exec xmms2 stop")
launchboxen:add("/usr/share/icons/bw2vista/scalable/actions/media-seek-backward.png", "exec xmms2 prev")
launchboxen:add("/usr/share/icons/bw2vista/scalable/actions/media-seek-forward.png", "exec xmms2 next")
-- Clocktext
clocktext = textBox("clock", "right", "ThE tImE")
function clocktextUpdate ()
clocktext.text = "<b> " .. os.date("%a, %b %d %I:%M%p") .. "</b> "
end
awful.hooks.timer.register(10, clocktextUpdate)
--Promptbox
promptbox = widget({ type = "textbox", name = "promptbox", align = "left" })
-- Systray
systray = widget({ type = "systray", name = "systray", align = "right" })
-- Menu
awesomemenu = {
{"manual", terminal .. " -e man awesome" },
{"edit config", "emacs" .. " " .. awful.util.getdir("config") .. "/rc.lua" },
{"restart", awesome.restart },
{"quit", awesome.quit }
}
mainmenu = {
{"awesome", awesomemenu, "/usr/share/awesome/icons/awesome16.png" },
{"open terminal", terminal },
{"wireless", "urxvt -e sh -c \"screen sh -c 'sudo netcfg-auto-wireless wlan0 && read line'\""},
{"suspend", "sudo pm-suspend"},
{"hibernate", "sudo pm-hibernate"},
{"shutdown", "sudo halt"},
}
launcher = awful.widget.launcher({ name = "mylauncher",
image = "/home/ben/Pictures/awesome-arch-red.png",
menu = { id="mymainmenu", items=mainmenu, menu_toggle=true } })
--test icon thing
icolol = widget({ type="imagebox", name="icon", align="left" })
icolol.image = image("/usr/share/icons/bw2vista/scalable/actions/down.png")
icolol_launching = true
function icolol.mouse_enter()
if icolol_launching then
icolol_launching = false
icolol.image = image("/usr/share/icons/bw2vista/scalable/actions/up.png")
radical.displayItems()
else
icolol_launching = true
icolol.image = image("/usr/share/icons/bw2vista/scalable/actions/down.png")
radical.hideItems()
end
end
-- END WIDGETS }}}
-- {{{ Statusbars
statusbars = {}
for s = 1, screen.count() do
statusbars[s] = wibox({ position = "top", name = "mystatusbar" .. s,
fg = beautiful.fg_normal, bg = beautiful.bg_normal, height=barHeight })
-- Add widgets to the statusbar - order matters
local widgetlist = {
archbox,
launcher,
taglist,
}
for index = 1, #launchboxen do
table.insert(widgetlist, launchboxen[index])
end
joinTables(widgetlist, {icolol, clocktext, })
statusbars[s].widgets = widgetlist
statusbars[s].screen = s
end
bottombar = wibox({position = "bottom", name="bottombar",
fg = beautiful.fg_normal, bg = beautiful.bg_normal })
bottombar.widgets = {promptbox, tasklist, systray}
bottombar.screen = 1
-- }}}
-- {{{ Mouse bindings
awesome.buttons({
button({ }, 4, awful.tag.viewnext),
button({ }, 5, awful.tag.viewprev)
})
-- }}}
-- {{{ Key bindings
--AWESOME
keybinding({ modkey, "Control" }, "r", awesome.restart):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
--TAG CONTROL
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber));
end
for i = 1, keynumber do
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
tags[screen][i].selected = not tags[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.client.movetotag(tags[screen][i])
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.client.toggletag(tags[screen][i])
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
--keybinding({ modkey }, "Up", tagBack):add()
--CLIENT MANIPULATION
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
keybinding({ "Mod1" }, "F4", function () client.focus:kill() end):add()
--LAYOUT MANIPULATION
keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
keybinding({ modkey }, "m", function() awful.tag.incnmaster(1) end):add()
keybinding({ modkey, "Shift" }, "m", function() awful.tag.incnmaster(-1) end):add()
---PROGRAM MANIPULATION
-- keybinding({ "Mod1" }, "grave", function () awful.spawn(menu) end):add()
keybinding({ "Control" }, "grave", function () awful.spawn(terminal) end):add()
keybinding({ "Mod1" }, "grave", function ()
awful.prompt.run({ prompt = "Run: ",
fg_cursor="#ffffff",
bg_cursor="#000000" },
promptbox,
awful.util.spawn,
awful.completion.bash,
awful.util.getdir("cache") .. "history")
end):add()
keybinding({ modkey }, "grave",
function ()
awful.tag.viewonly(tags[mouse.screen][6])
awful.spawn(terminal)
end):add()
keybinding({ "Mod4" }, "p", function () awful.util.spawn("exec xmms2 toggleplay") end):add()
keybinding({ "Mod4" }, "n", function () awful.util.spawn("exec xmms2 next") end):add()
keybinding({ "Mod4" }, "s", function () awful.util.spawn("exec xmms2 stop") end):add()
keybinding({ modkey, "Control" }, "Left", radical.displayItems ):add()
keybinding({ modkey, "Control" }, "Right", radical.hideItems ):add()
--END KEYBINDINGS}}}
-- {{{ Hooks
--
function hook_focus(c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_focus
end
end
--
function hook_unfocus(c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_normal
end
end
-- Hook function to execute when marking a client
function hook_marked(c)
c.border_color = beautiful.border_marked
end
-- Hook function to execute when unmarking a client
function hook_unmarked(c)
c.border_color = beautiful.border_focus
end
-- Hook function to execute when the mouse is over a client.
function hook_mouseover(c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= "magnifier" then
client.focus = c
end
end
-- Hook function to execute when a new client appears.
function hook_manage(c)
c.floating_placement = "smart"
if use_titlebar then
awful.titlebar.add(c, { modkey = modkey })
end
c:buttons({
button({ }, 1, function (c) client.focus = c; c:raise() end),
button({ modkey }, 1, function (c) c:mouse_move() end),
button({ modkey }, 3, function (c) c:mouse_resize() end),
})
-- 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
client.focus = c
-- Check if the application should be floating.
local cls = c.class:lower()
local inst = c.instance:lower()
if floatapps[cls] then
c.floating = floatapps[cls]
elseif floatapps[inst] then
c.floating = 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
--set it as slave? no
-- awful.client.setslave(c)
c.honorsizehints = true
end
-- Hook function to execute when arranging the screen
-- (tag switch, new client, etc)
function hook_arrange(screen)
if not client.focus then
local c = awful.client.focus.history.get(screen, 0)
if c then client.focus = c end
end
end
-- Set up some hooks
awful.hooks.focus.register(hook_focus)
awful.hooks.unfocus.register(hook_unfocus)
awful.hooks.marked.register(hook_marked)
awful.hooks.unmarked.register(hook_unmarked)
awful.hooks.manage.register(hook_manage)
awful.hooks.mouse_enter.register(hook_mouseover)
awful.hooks.arrange.register(hook_arrange)
-- }}}
Config as of Fri, Oct 03 21:17
Works with awesome3 final
--------------------------------
---Bavardage's Awesome Config---
--------------------------------
require("awful")
--require("wicked")
--require("beautiful") -- I still don't use beautiful at all in my config. I probably will at some point, but today is not that point ^^
--{{{ Custom Variables
terminal = "exec rxvt"
menu = "exec ~/Scripts/dmenu.sh"
modkey = "Mod4"
theme_path = "lol/"
fonts = {normal = "zekton 12"}
bg = {normal = "#e7e7e7", focus = "#d97600", focus_choices = {"#669bcb", "#d97600", "#6eb22c"}, urgent = "#ffaa88"}
fg = {normal = "#444444", focus = "#fefefe", urgent = "#fefefe"}
border = bg
mainBarHeight = 30
tagnames = {"ūnus", "duo", "três", "doc", "im", "web", "terms"}
layouts = {"tile", "tileleft", "tilebottom", "tiletop", "floating"}
defaultLayout = layouts[1]
tagRules = { ---compare the wm_class and name of the client
["midori"] = "web",
["firefox"] = "web", --firefox
["pidgin"] = "im",
["epdfview"] = "doc",
["irssi"] = "im",
}
floatingRules = { --wm class again
["gimp"] = true,
["phun.bin"] = true
}
---}}}
awesome.font_set(fonts['normal'])
awesome.colors_set({ fg = fg['normal'], bg = bg['normal'] })
-- beautiful.init(theme_path)
-- awful.beautiful.register(beautiful)
---{{{ Utility Variables and Functions
--VARIABLES
tagsByName = {}
tagsByNumber = {}
tagsActive = {}
tagsUrgent = {}
currentTag = nil
lastTag = nil
tempCoords = nil
--FUNCTIONS
function colourise(text, fgcolour, bgcolour) --british spelling ftw
return "<bg color=\"" .. bgcolour .. "\"/><span color=\"" .. fgcolour .. "\">" .. text .. "</span>"
end
function textBox(nameIn, alignIn, defaultText)
temp = widget({
type = "textbox", name = nameIn, align = alignIn
})
temp.text = defaultText
return temp
end
function imageBox(nameIn, pathIn, alignIn, resize)
return textBox(nameIn, alignIn, "<bg image=\"" .. pathIn .. "\" resize=\"" .. resize .. "\"/>")
end
function clientRules(c)
local screen = mouse.screen
for class,tag in pairs(tagRules) do
if c.class:lower():find(class) or c.name:lower():find(class) then
if tagsByName[screen][tag] then
awful.client.movetotag(tagsByName[screen][tag], c)
end
end
end
for class,bool in pairs(floatingRules) do
if c.class:lower():find(class) and bool then
c.floating = true
end
end
end
function tagBack()
awful.tag.viewonly(lastTag)
end
function setStatusText(text)
statustext.text = text
end
function joinTables(t1, t2)
for k,v in ipairs(t2) do table.insert(t1, v) end return t1
end
---}}}
---{{{ Setup Tags
for s = 1, screen.count() do
tagsByName[s] = {}
tagsByNumber[s] = {}
for tagnumber = 1, #tagnames do
tagsByName[s][tagnames[tagnumber]] = tag({name = tagnames[tagnumber], layout = defaultLayout})
tagsByNumber[s][tagnumber] = tagsByName[s][tagnames[tagnumber]]
tagsByNumber[s][tagnumber].mwfact = 0.618033988769
tagsByNumber[s][tagnumber].screen = s
tagsByNumber[s][tagnumber].layout = "tilebottom"
end
tagsByNumber[s][1].selected = true
end
--special for im tag
tagsByName[1]['im'].layout = "tileleft"
tagsByName[1]['im'].mwfact = 0.2
---}}}
---{{{ Widgets
--ARCHBOX
archicon = imageBox("archicon", "/home/ben/Pictures/awesome-arch-red.png", "left", "true")
archicon:mouse_add(mouse({ }, 1, function () awful.spawn("exec /home/ben/builds/PyShutdown/PowerDown.py") end ))
--TAGLIST
taglist = widget({type = "taglist", name = "taglist", height=30 })
taglist:mouse_add(
mouse({}, 1, function (object, tag) awful.tag.viewonly(tag) end)
)
function taglist.label(t)
local bg_color
local fg_color
local background = ''
if t.selected then
local choice = math.random(1,3)
bg_color = bg['focus_choices'][choice]
fg_color = fg['focus']
end
local sel = client.focus
if sel and sel:tags()[t] then
background = "resize=\"true\" image=\"/usr/share/awesome/icons/taglist/squarefw.png\""
else
for k, c in pairs(client.get()) do
if c:tags()[t] then
background = "resize=\"true\" image=\"/usr/share/awesome/icons/taglist/squarew.png\""
if c.urgent then
bg_color = bg['urgent']
fg_color = fg['urgent']
end
end
end
end
if bg_color and fg_color then
text = "<bg "..background.." color='"..bg_color.."'/> <span color='"..fg_color.."'>"..t.name.."</span> "
else
text = " <bg "..background.." />"..t.name .. " "
end
return text
end
--LAUNCHBOXEN
launchboxen = {}
function launchboxen:add(image, command)
local index = #self + 1
self[index] = imageBox("launchbox" .. index, image, "left", "true")
self[index]:mouse_add(mouse({ }, 1, function () awful.spawn(command) end))
end
launchboxen:add("/usr/share/pixmaps/firefox.png", "exec firefox")
launchboxen:add("/usr/share/icons/hicolor/32x32/apps/pidgin.png", "exec pidgin")
launchboxen:add("/home/ben/Pictures/irssi_white.png", "exec ~/Scripts/irssi.sh")
--CLOCK ICON
clockicon = imageBox("clockicon", "/usr/share/icons/bw2vista/scalable/emblems/emblem-urgent.png", "right", "false")
--CLOCK TEXT
clocktext = textBox("clock", "right", "ThE tImE")
function clocktextUpdate ()
clocktext.text = "<b> " .. os.date("%a, %b %d %I:%M%p") .. "</b> "
end
awful.hooks.timer.register(10, clocktextUpdate)
---NOTEO
noteo = textBox("noteo", "left", "")
---}}}
---{{{Statusbar
statusbars = {}
for s = 1, screen.count() do
statusbars[s] = statusbar({
position = "top", name = "statusbar" .. s,
fg = fg['normal'], bg = bg['normal'],
height = mainBarHeight
})
---add widgets
local widgetlist = {
archicon,
taglist,
}
for index = 1, #launchboxen do
table.insert(widgetlist, launchboxen[index])
end
joinTables(widgetlist, {
noteo,
clockicon,
clocktext
})
statusbars[s]:widgets(widgetlist)
statusbars[s].screen = s
end
bottombar = statusbar ({position = "bottom", height = 16, name = "bottombar"})
bottombar:widgets({(widget({ type = "systray", name = "systray", align = "right" }))})
bottombar.screen = 1
---}}}
---{{{Keybindings
--AWESOME
keybinding({ modkey, "Control" }, "r", awesome.restart):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
--TAG CONTROL
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tagsByNumber[s], keynumber));
end
for i = 1, keynumber do
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.tag.viewonly(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
tagsByNumber[screen][i].selected = not tagsByNumber[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.movetotag(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.toggletag(tagsByNumber[screen][i])
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
keybinding({ modkey }, "Up", tagBack):add()
--CLIENT MANIPULATION
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
keybinding({ "Mod1" }, "F4", function () client.focus:kill() end):add()
--LAYOUT MANIPULATION
keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
keybinding({ modkey }, "m", function() awful.tag.incnmaster(1) end):add()
keybinding({ modkey, "Shift" }, "m", function() awful.tag.incnmaster(-1) end):add()
---PROGRAM MANIPULATION
keybinding({ "Mod1" }, "grave", function () awful.spawn(menu) end):add()
keybinding({ "Control" }, "grave", function () awful.spawn(terminal) end):add()
keybinding({ modkey }, "grave", function ()
awful.tag.viewonly(tagsByName[mouse.screen]["terms"])
awful.spawn(terminal)
end):add()
keybinding({ "Mod4" }, "p", function () awful.spawn("exec xmms2 toggleplay") end):add()
keybinding({ "Mod4" }, "n", function () awful.spawn("exec xmms2 next") end):add()
keybinding({ "Mod4" }, "s", function () awful.spawn("exec xmms2 stop") end):add()
---}}}
---{{{Hooks
--FOCUS HOOK
function hook_focus(c)
if not awful.client.ismarked(c) then
c.border_color = border['focus']
end
c.opacity = 1.0
end
--UNFOCUS HOOK
function hook_unfocus(c)
if not awful.client.ismarked(c) then
c.border_color = border['normal']
end
c.opacity = 0.6
end
--MARKED HOOK
function hook_marked(c)
c.border_color = border_marked
end
--UNMARKED HOOK
function hook_unmarked(c)
c.border_color = border_focus
end
--MOUSEOVER HOOK
function hook_mouseover(c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= "magnifier" then
client.focus = c
end
end
--MANAGE HOOK
function hook_manage(c)
-- Add mouse bindings
c:mouse_add(mouse({ }, 1, function (c) client.focus = c; c:raise() end))
c:mouse_add(mouse({ modkey }, 1, function (c) c:mouse_move() end))
c:mouse_add(mouse({ modkey }, 3, function (c) c:mouse_resize() end))
-- Setup borders
c.border_width = 1
c.border_color = border['normal']
client.focus = c
-- Client rules
clientRules(c)
-- Honor size hints
c.honorsizehints = true
end
--ARRANGE HOOK
function hook_arrange(screen)
tag = awful.tag.selected(mouse.screen)
if currentTag ~= tag then
lastTag = currentTag
currentTag = tag
end
end
--SETUP HOOKS
awful.hooks.focus.register(hook_focus)
awful.hooks.unfocus.register(hook_unfocus)
awful.hooks.marked.register(hook_marked)
awful.hooks.unmarked.register(hook_unmarked)
awful.hooks.manage.register(hook_manage)
awful.hooks.mouseover.register(hook_mouseover)
awful.hooks.arrange.register(hook_arrange)
---}}}
Config as of Mon, Sep 01, 20:45
Works with -rc4
--------------------------------
---Bavardage's Awesome Config---
--------------------------------
require("awful")
--require("beautiful") -- I still don't use beautiful at all in my config. I probably will at some point, but today is not that point ^^
--{{{ Custom Variables
terminal = "exec rxvt"
menu = "exec ~/Scripts/dmenu.sh"
modkey = "Mod4"
theme_path = "lol/"
fonts = {normal = "augie 10"}
bg = {normal = "#444444", focus = "#a10121", urgent = "#ffff00"}
fg = {normal = "#dddddd", focus = "#dae0d2", urgent = "#a10121"}
border = bg
mainBarHeight = 30
tagnames = {"ūnus", "duo", "doc", "im", "web", "terms"}
layouts = {"tile", "tileleft", "tilebottom", "tiletop", "floating"}
defaultLayout = layouts[1]
tagRules = { ---compare the wm_class and name of the client
["midori"] = "web",
["firefox"] = "web", --firefox
["pidgin"] = "im",
["epdfview"] = "doc",
["irssi"] = "im",
}
floatingRules = { --wm class again
["gimp"] = true,
["phun.bin"] = true
}
---}}}
awesome.font_set(fonts['normal'])
awesome.colors_set({ fg = fg['normal'], bg = bg['normal'] })
-- beautiful.init(theme_path)
-- awful.beautiful.register(beautiful)
---{{{ Utility Variables and Functions
--VARIABLES
tagsByName = {}
tagsByNumber = {}
tagsActive = {}
tagsUrgent = {}
currentTag = nil
lastTag = nil
tempCoords = nil
--FUNCTIONS
function colourise(text, fgcolour, bgcolour) --british spelling ftw
return "<bg color=\"" .. bgcolour .. "\"/><span color=\"" .. fgcolour .. "\">" .. text .. "</span>"
end
function textBox(nameIn, alignIn, defaultText)
temp = widget({
type = "textbox", name = nameIn, align = alignIn
})
temp.text = defaultText
return temp
end
function imageBox(nameIn, pathIn, alignIn, resize)
return textBox(nameIn, alignIn, "<bg image=\"" .. pathIn .. "\" resize=\"" .. resize .. "\"/>")
end
function clientRules(c)
local screen = mouse.screen
for class,tag in pairs(tagRules) do
if c.class:lower():find(class) or c.name:lower():find(class) then
if tagsByName[screen][tag] then
awful.client.movetotag(tagsByName[screen][tag], c)
end
end
end
for class,bool in pairs(floatingRules) do
if c.class:lower():find(class) and bool then
c.floating = true
end
end
end
function tagBack()
awful.tag.viewonly(lastTag)
end
function setStatusText(text)
statustext.text = text
end
function joinTables(t1, t2)
for k,v in ipairs(t2) do table.insert(t1, v) end return t1
end
---}}}
---{{{ Setup Tags
for s = 1, screen.count() do
tagsByName[s] = {}
tagsByNumber[s] = {}
for tagnumber = 1, #tagnames do
tagsByName[s][tagnames[tagnumber]] = tag({name = tagnames[tagnumber], layout = defaultLayout})
tagsByNumber[s][tagnumber] = tagsByName[s][tagnames[tagnumber]]
tagsByNumber[s][tagnumber].mwfact = 0.618033988769
tagsByNumber[s][tagnumber].screen = s
tagsByNumber[s][tagnumber].layout = "tilebottom"
end
tagsByNumber[s][1].selected = true
end
---}}}
---{{{ Widgets
--ARCHBOX
archicon = imageBox("archicon", "/home/ben/Pictures/awesome-arch-red.png", "left", "true")
archicon:mouse_add(mouse({ }, 1, function () awful.spawn("exec /home/ben/builds/PyShutdown/PowerDown.py") end ))
--TAGLIST
taglist = widget({type = "taglist", name = "taglist", height=30 })
taglist:mouse_add(
mouse({}, 1, function (object, tag) awful.tag.viewonly(tag) end)
)
function taglist.label(t)
local bg_color
local fg_color
local background = ''
if t.selected then
bg_color = bg['focus']
fg_color = fg['focus']
end
local sel = client.focus
if sel and sel:tags()[t] then
background = "resize=\"true\" image=\"/usr/share/awesome/icons/taglist/squarefw.png\""
else
for k, c in pairs(client.get()) do
if c:tags()[t] then
background = "resize=\"true\" image=\"/usr/share/awesome/icons/taglist/squarew.png\""
if c.urgent then
bg_color = bg['urgent']
fg_color = fg['urgent']
end
end
end
end
if bg_color and fg_color then
text = "<bg "..background.." color='"..bg_color.."'/> <span color='"..fg_color.."'>"..t.name.."</span> "
else
text = " <bg "..background.." />"..t.name .. " "
end
return text
end
--LAUNCHBOXEN
launchboxen = {}
function launchboxen:add(image, command)
local index = #self + 1
self[index] = imageBox("launchbox" .. index, image, "left", "true")
self[index]:mouse_add(mouse({ }, 1, function () awful.spawn(command) end))
end
launchboxen:add("/usr/share/pixmaps/firefox.png", "exec firefox")
launchboxen:add("/usr/share/icons/hicolor/32x32/apps/pidgin.png", "exec pidgin")
launchboxen:add("/usr/share/icons/bw2vista/scalable/apps/gnome-terminal.png", "exec urxvt")
--CLOCK ICON
clockicon = imageBox("clockicon", "/usr/share/icons/bw2vista/scalable/emblems/emblem-urgent.png", "right", "false")
--CLOCK TEXT
clocktext = textBox("clock", "right", "ThE tImE")
function clocktextUpdate ()
clocktext.text = "<b> " .. os.date("%a, %b %d %I:%M%p") .. "</b> "
end
awful.hooks.timer.register(10, clocktextUpdate)
---NOTEO
noteo = textBox("noteo", "left", "")
---}}}
---{{{Statusbar
statusbars = {}
for s = 1, screen.count() do
statusbars[s] = statusbar({
position = "top", name = "statusbar" .. s,
fg = fg['normal'], bg = bg['normal'],
height = mainBarHeight
})
---add widgets
local widgetlist = {
archicon,
taglist,
}
for index = 1, #launchboxen do
table.insert(widgetlist, launchboxen[index])
end
joinTables(widgetlist, {
noteo,
clockicon,
clocktext
})
statusbars[s]:widgets(widgetlist)
statusbars[s].screen = s
end
bottombar = statusbar ({position = "bottom", height = 16, name = "bottombar"})
bottombar.widgets = {(widget({ type = "systray", name = "systray", align = "right" }))}
bottombar.screen = 1
---}}}
---{{{Keybindings
--AWESOME
keybinding({ modkey, "Control" }, "r", awesome.restart):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
--TAG CONTROL
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tagsByNumber[s], keynumber));
end
for i = 1, keynumber do
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.tag.viewonly(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
tagsByNumber[screen][i].selected = not tagsByNumber[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.movetotag(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.toggletag(tagsByNumber[screen][i])
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
keybinding({ modkey }, "Up", tagBack):add()
--CLIENT MANIPULATION
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
keybinding({ "Mod1" }, "F4", function () client.focus:kill() end):add()
--LAYOUT MANIPULATION
keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
keybinding({ modkey }, "m", function() awful.tag.incnmaster(1) end):add()
keybinding({ modkey, "Shift" }, "m", function() awful.tag.incnmaster(-1) end):add()
---PROGRAM MANIPULATION
keybinding({ "Mod1" }, "grave", function () awful.spawn(menu) end):add()
keybinding({ "Control" }, "grave", function () awful.spawn(terminal) end):add()
keybinding({ modkey }, "grave", function ()
awful.tag.viewonly(tagsByName[mouse.screen]["terms"])
awful.spawn(terminal)
end):add()
keybinding({ "Mod4" }, "p", function () awful.spawn("exec xmms2 toggleplay") end):add()
keybinding({ "Mod4" }, "n", function () awful.spawn("exec xmms2 next") end):add()
keybinding({ "Mod4" }, "s", function () awful.spawn("exec xmms2 stop") end):add()
---}}}
---{{{Hooks
--FOCUS HOOK
function hook_focus(c)
if not awful.client.ismarked(c) then
c.border_color = border['focus']
end
c.opacity = 1.0
end
--UNFOCUS HOOK
function hook_unfocus(c)
if not awful.client.ismarked(c) then
c.border_color = border['normal']
end
c.opacity = 0.6
end
--MARKED HOOK
function hook_marked(c)
c.border_color = border_marked
end
--UNMARKED HOOK
function hook_unmarked(c)
c.border_color = border_focus
end
--MOUSEOVER HOOK
function hook_mouseover(c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= "magnifier" then
client.focus = c
end
end
--MANAGE HOOK
function hook_manage(c)
-- Add mouse bindings
c:mouse_add(mouse({ }, 1, function (c) client.focus = c; c:raise() end))
c:mouse_add(mouse({ modkey }, 1, function (c) c:mouse_move() end))
c:mouse_add(mouse({ modkey }, 3, function (c) c:mouse_resize() end))
-- Setup borders
c.border_width = 1
c.border_color = border['normal']
client.focus = c
-- Client rules
clientRules(c)
-- Honor size hints
c.honorsizehints = true
end
--ARRANGE HOOK
function hook_arrange(screen)
tag = awful.tag.selected(mouse.screen)
if currentTag ~= tag then
lastTag = currentTag
currentTag = tag
end
end
--SETUP HOOKS
awful.hooks.focus.register(hook_focus)
awful.hooks.unfocus.register(hook_unfocus)
awful.hooks.marked.register(hook_marked)
awful.hooks.unmarked.register(hook_unmarked)
awful.hooks.manage.register(hook_manage)
awful.hooks.mouseover.register(hook_mouseover)
awful.hooks.arrange.register(hook_arrange)
---}}}
Here it is, as of Sun, Aug 10, 19:45
Works with -rc2
--------------------------------
---Bavardage's Awesome Config---
--------------------------------
require("awful")
--require("beautiful")
--{{{ Custom Variables
terminal = "exec rxvt"
menu = "exec ~/Scripts/dmenu.sh"
modkey = "Mod4"
fonts = {normal = "augie 10"}
bg = {normal = "#444444", focus = "#a10121", urgent = "#ffff00"}
fg = {normal = "#dddddd", focus = "#dae0d2", urgent = "#a10121"}
border = bg
mainBarHeight = 30
tagnames = {"ūnus", "duo", "doc", "im", "web", "terms"}
layouts = {"tile", "tileleft", "tilebottom", "tiletop", "floating"}
defaultLayout = layouts[1]
tagRules = { ---compare the wm_class of the client
["midori"] = "web",
["firefox"] = "web", --firefox
["pidgin"] = "im",
["epdfview"] = "doc"
}
floatingRules = { --wm class again
["gimp"] = true,
["phun.bin"] = true
}
---}}}
awesome.font_set(fonts['normal'])
awesome.colors_set({ fg = fg['normal'], bg = bg['normal'] })
---{{{ Utility Variables and Functions
--VARIABLES
tagsByName = {}
tagsByNumber = {}
tagsActive = {}
tagsUrgent = {}
currentTag = nil
lastTag = nil
tempCoords = nil
--FUNCTIONS
function colourise(text, fgcolour, bgcolour) --british spelling ftw
return "<bg color=\"" .. bgcolour .. "\"/><span color=\"" .. fgcolour .. "\">" .. text .. "</span>"
end
function textBox(nameIn, alignIn, defaultText)
temp = widget({
type = "textbox", name = nameIn, align = alignIn
})
temp.text = defaultText
return temp
end
function imageBox(nameIn, pathIn, alignIn, resize)
return textBox(nameIn, alignIn, "<bg image=\"" .. pathIn .. "\" resize=\"" .. resize .. "\"/>")
end
function clientRules(c)
local screen = mouse.screen
for class,tag in pairs(tagRules) do
print("class is " .. class)
print("c.class is " .. c.class)
if c.class:lower():find(class) then
if tagsByName[screen][tag] then
awful.client.movetotag(tagsByName[screen][tag], c)
end
end
end
for class,bool in pairs(floatingRules) do
if c.class:lower():find(class) and bool then
c.floating = true
end
end
end
function tagBack()
awful.tag.viewonly(lastTag)
end
function setStatusText(text)
statustext.text = text
end
function joinTables(t1, t2)
for k,v in ipairs(t2) do table.insert(t1, v) end return t1
end
---}}}
---{{{ Setup Tags
for s = 1, screen.count() do
tagsByName[s] = {}
tagsByNumber[s] = {}
for tagnumber = 1, #tagnames do
tagsByName[s][tagnames[tagnumber]] = tag({name = tagnames[tagnumber], layout = defaultLayout})
tagsByNumber[s][tagnumber] = tagsByName[s][tagnames[tagnumber]]
tagsByNumber[s][tagnumber].mwfact = 0.618033988769
tagsByNumber[s][tagnumber].screen = s
end
tagsByNumber[s][1].selected = true
end
---}}}
---{{{ Widgets
--ARCHBOX
archicon = imageBox("archicon", "/home/ben/Pictures/awesome-arch-red.png", "left", "true")
archicon:mouse_add(mouse({ }, 1, function () awful.spawn("exec /home/ben/builds/PyShutdown/PowerDown.py") end ))
--TAGLIST
taglist = widget({type = "taglist", name = "taglist" })
taglist:mouse_add(
mouse({}, 1, function (object, tag) awful.tag.viewonly(tag) end)
)
--[[function taglist.label(t)
local text = ""
if t.selected then
text = colourise(t.name, fg['focus'], bg['focus'])
elseif tagsUrgent[t.name] then
text = colourise(t.name, fg['urgent'], bg['urgent'])
else
text = t.name
end
if tagsActive[t.name] then
text = colourise("<i><b>" .. text .. "</b></i>", bg['focus'], bg['normal'])
end
return " " .. text .. " "
end--]]
function taglist.label(t)
local bg_color
local fg_color
local background = ''
if t.selected then
bg_color = bg['focus']
fg_color = fg['focus']
end
local sel = client.focus_get()
if sel and sel.tags[t] then
background = "resize=\"true\" image=\"/usr/share/awesome/icons/taglist/squarefw.png\""
else
for k, c in pairs(client.get()) do
if c.tags[t] then
background = "resize=\"true\" image=\"/usr/share/awesome/icons/taglist/squarew.png\""
if c.urgent then
bg_color = bg['urgent']
fg_color = fg['urgent']
end
end
end
end
if bg_color and fg_color then
text = "<bg "..background.." color='"..bg_color.."'/> <span color='"..fg_color.."'>"..t.name.."</span> "
else
text = " <bg "..background.." />"..t.name .. " "
end
return text
end
--LAUNCHBOXEN
launchboxen = {}
function launchboxen:add(image, command)
local index = #self + 1
self[index] = imageBox("launchbox" .. index, image, "left", "true")
self[index]:mouse_add(mouse({ }, 1, function () awful.spawn(command) end))
end
launchboxen:add("/usr/share/pixmaps/firefox.png", "exec firefox")
launchboxen:add("/usr/share/icons/hicolor/32x32/apps/pidgin.png", "exec pidgin")
launchboxen:add("/usr/share/icons/bw2vista/scalable/apps/gnome-terminal.png", "exec urxvt")
--CLOCK ICON
clockicon = imageBox("clockicon", "/usr/share/icons/bw2vista/scalable/emblems/emblem-urgent.png", "right", "false")
--CLOCK TEXT
clocktext = textBox("clock", "right", "ThE tImE")
function clocktextUpdate ()
clocktext.text = "<b> " .. os.date("%a, %b %d %I:%M%p") .. "</b> "
end
awful.hooks.timer.register(10, clocktextUpdate)
---NOTEO
noteo = textBox("noteo", "left", "")
---}}}
---{{{Statusbar
statusbars = {}
for s = 1, screen.count() do
statusbars[s] = statusbar({
position = "top", name = "statusbar" .. s,
fg = fg['normal'], bg = bg['normal'],
height = mainBarHeight
})
---add widgets
local widgetlist = {
archicon,
taglist
}
for index = 1, #launchboxen do
table.insert(widgetlist, launchboxen[index])
end
joinTables(widgetlist, {
noteo,
clockicon,
clocktext
})
statusbars[s].widgets = widgetlist
statusbars[s].screen = s
end
bottombar = statusbar ({position = "bottom", height = 5, name = "bottombar"})
bottombar.widgets = {(widget({ type = "systray", name = "systray", align = "right" }))}
bottombar.screen = 1
---}}}
---{{{Keybindings
--AWESOME
keybinding({ modkey, "Control" }, "r", awesome.restart):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
--TAG CONTROL
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tagsByNumber[s], keynumber));
end
for i = 1, keynumber do
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.tag.viewonly(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
tagsByNumber[screen][i].selected = not tagsByNumber[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.movetotag(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.toggletag(tagsByNumber[screen][i])
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
keybinding({ modkey }, "Up", tagBack):add()
--CLIENT MANIPULATION
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
keybinding({ "Mod1" }, "F4", function () client.focus_get():kill() end):add()
--LAYOUT MANIPULATION
keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
---PROGRAM MANIPULATION
keybinding({ "Mod1" }, "grave", function () awful.spawn(menu) end):add()
keybinding({ "Control" }, "grave", function () awful.spawn(terminal) end):add()
keybinding({ modkey }, "grave", function ()
awful.tag.viewonly(tagsByName[mouse.screen]["terms"])
awful.spawn(terminal)
end):add()
keybinding({ "Mod4" }, "p", function () awful.spawn("exec xmms2 toggleplay") end):add()
keybinding({ "Mod4" }, "n", function () awful.spawn("exec xmms2 next") end):add()
keybinding({ "Mod4" }, "s", function () awful.spawn("exec xmms2 stop") end):add()
---}}}
---{{{Hooks
--FOCUS HOOK
function hook_focus(c)
if not awful.client.ismarked(c) then
c.border_color = border['focus']
end
c.opacity = 1.0
end
--UNFOCUS HOOK
function hook_unfocus(c)
if not awful.client.ismarked(c) then
c.border_color = border['normal']
end
c.opacity = 0.6
end
--MARKED HOOK
function hook_marked(c)
c.border_color = border_marked
end
--UNMARKED HOOK
function hook_unmarked(c)
c.border_color = border_focus
end
--MOUSEOVER HOOK
function hook_mouseover(c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= "magnifier" then
c:focus_set()
end
end
--MANAGE HOOK
function hook_manage(c)
-- Add mouse bindings
c:mouse_add(mouse({ }, 1, function (c) c:focus_set(); c:raise() end))
c:mouse_add(mouse({ modkey }, 1, function (c) c:mouse_move() end))
c:mouse_add(mouse({ modkey }, 3, function (c) c:mouse_resize() end))
-- Setup borders
c.border_width = 1
c.border_color = border['normal']
c:focus_set()
-- Client rules
clientRules(c)
-- Honor size hints
c.honorsizehints = true
end
--ARRANGE HOOK
function hook_arrange(screen)
tag = awful.tag.selected(mouse.screen)
if currentTag ~= tag then
lastTag = currentTag
currentTag = tag
end
end
--SETUP HOOKS
awful.hooks.focus.register(hook_focus)
awful.hooks.unfocus.register(hook_unfocus)
awful.hooks.marked.register(hook_marked)
awful.hooks.unmarked.register(hook_unmarked)
awful.hooks.manage.register(hook_manage)
awful.hooks.mouseover.register(hook_mouseover)
awful.hooks.arrange.register(hook_arrange)
---}}}
Version which works with -rc1
--------------------------------
---Bavardage's Awesome Config---
--------------------------------
require("awful")
--{{{ Custom Variables
terminal = "exec rxvt"
menu = "exec ~/Scripts/dmenu.sh"
modkey = "Mod4"
fonts = {normal = "augie 10"}
bg = {normal = "#444444", focus = "#a10121", urgent = "#ffff00"}
fg = {normal = "#dddddd", focus = "#dae0d2", urgent = "#a10121"}
border = bg
mainBarHeight = 30
tagnames = {"ūnus", "duo", "doc", "im", "web", "terms"}
layouts = {"tile", "tileleft", "tilebottom", "tiletop", "floating"}
defaultLayout = layouts[1]
tagRules = { ---compare the wm_class of the client
["midori"] = "web",
["firefox"] = "web", --firefox
["pidgin"] = "im",
["epdfview"] = "doc"
}
floatingRules = { --wm class again
["gimp"] = true,
["phun.bin"] = true
}
---}}}
awesome.font_set(fonts['normal'])
awesome.colors_set({ fg = fg['normal'], bg = bg['normal'] })
---{{{ Utility Variables and Functions
--VARIABLES
tagsByName = {}
tagsByNumber = {}
tagsActive = {}
tagsUrgent = {}
currentTag = nil
lastTag = nil
tempCoords = nil
--FUNCTIONS
function colourise(text, fgcolour, bgcolour) --british spelling ftw
return "<bg color=\"" .. bgcolour .. "\"/><span color=\"" .. fgcolour .. "\">" .. text .. "</span>"
end
function textBox(nameIn, alignIn, defaultText)
temp = widget({
type = "textbox", name = nameIn, align = alignIn
})
temp.text = defaultText
return temp
end
function imageBox(nameIn, pathIn, alignIn, resize)
return textBox(nameIn, alignIn, "<bg image=\"" .. pathIn .. "\" resize=\"" .. resize .. "\"/>")
end
function warpMouse()
local sel = client.focus_get()
if sel then
local c_c = sel.coords
local m_c = mouse.coords
if m_c.x < c_c.x or m_c.x >= c_c.x + c_c.width or
m_c.y < c_c.y or m_c.y >= c_c.y + c_c.height then
if table.maxn(m_c.buttons) == 0 then
mouse.coords = { x = c_c.x + 5, y = c_c.y + 5}
end
end
end
end
function clientRules(c)
local screen = mouse.screen
for class,tag in pairs(tagRules) do
print("class is " .. class)
print("c.class is " .. c.class)
if c.class:lower():find(class) then
if tagsByName[screen][tag] then
awful.client.movetotag(tagsByName[screen][tag], c)
end
end
end
for class,bool in pairs(floatingRules) do
if c.class:lower():find(class) and bool then
c.floating = true
end
end
end
function tagBack()
awful.tag.viewonly(lastTag)
end
function updateActiveTags()
newTagsActive = {}
for screen = 1, screen.count() do
for index,tag in pairs(tagsByNumber[screen]) do
for key,client in pairs(client.get()) do
if client:istagged(tag) then
newTagsActive[tag.name] = true
end
end
end
end
tagsActive = newTagsActive
end
awful.hooks.timer(2, updateActiveTags)
function setStatusText(text)
statustext.text = text
end
---}}}
---{{{ Setup Tags
for s = 1, screen.count() do
tagsByName[s] = {}
tagsByNumber[s] = {}
for tagnumber = 1, #tagnames do
tagsByName[s][tagnames[tagnumber]] = tag({name = tagnames[tagnumber], layout = defaultLayout})
tagsByNumber[s][tagnumber] = tagsByName[s][tagnames[tagnumber]]
tagsByNumber[s][tagnumber].mwfact = 0.618033988769
tagsByNumber[s][tagnumber].screen = s
end
tagsByNumber[s][1].selected = true
end
---}}}
---{{{ Widgets
--ARCHBOX
archicon = imageBox("archicon", "/home/ben/Pictures/awesome-arch-red.png", "left", "true")
archicon:mouse_add(mouse({ }, 1, function () awful.spawn("exec /home/ben/builds/PyShutdown/PowerDown.py") end ))
--TAGLIST
taglist = widget({type = "taglist", name = "taglist" })
taglist:mouse_add(
mouse({}, 1, function (object, tag) awful.tag.viewonly(tag) end)
)
--[[function taglist.label(t)
local text = ""
if t.selected then
text = colourise(t.name, fg['focus'], bg['focus'])
elseif tagsUrgent[t.name] then
text = colourise(t.name, fg['urgent'], bg['urgent'])
else
text = t.name
end
if tagsActive[t.name] then
text = colourise("<i><b>" .. text .. "</b></i>", bg['focus'], bg['normal'])
end
return " " .. text .. " "
end--]]
function taglist.label(t)
return awful.widget.taglist.label.all(t, bg['focus'], fg['focus'], bg['urgent'], fg['urgent'])
end
--LAUNCHBOXEN
launchboxen = {}
function launchboxen:add(image, command)
local index = #self + 1
self[index] = imageBox("launchbox" .. index, image, "left", "true")
self[index]:mouse_add(mouse({ }, 1, function () awful.spawn(command) end))
end
launchboxen:add("/usr/share/pixmaps/firefox.png", "exec firefox")
launchboxen:add("/usr/share/icons/hicolor/32x32/apps/pidgin.png", "exec pidgin")
launchboxen:add("/usr/share/icons/bw2vista/scalable/apps/gnome-terminal.png", "exec urxvt")
--CLOCK ICON
clockicon = imageBox("clockicon", "/usr/share/icons/bw2vista/scalable/emblems/emblem-urgent.png", "right", "false")
--CLOCK TEXT
clocktext = textBox("clock", "right", "ThE tImE")
function clocktextUpdate ()
clocktext.text = "<b> " .. os.date("%a, %b %d %I:%M%p") .. "</b> "
end
awful.hooks.timer(10, clocktextUpdate)
---NOTEO
noteo = textBox("noteo", "left", "")
---}}}
---{{{Statusbar
statusbars = {}
for s = 1, screen.count() do
statusbars[s] = statusbar({
position = "top", name = "statusbar" .. s,
fg = fg['normal'], bg = bg['normal'],
height = mainBarHeight
})
---add widgets
statusbars[s]:widget_add(archicon)
statusbars[s]:widget_add(taglist)
for index = 1, #launchboxen do
statusbars[s]:widget_add(launchboxen[index])
end
statusbars[s]:widget_add(noteo)
statusbars[s]:widget_add(clockicon)
statusbars[s]:widget_add(clocktext)
statusbars[s].screen = s
end
bottombar = statusbar ({position = "bottom", height = 5, name = "bottombar"})
bottombar:widget_add(widget({ type = "systray", name = "systray", align = "right" }))
bottombar.screen = 1
---}}}
---{{{Keybindings
--AWESOME
keybinding({ modkey, "Control" }, "r", awesome.restart):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
--TAG CONTROL
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tagsByNumber[s], keynumber));
end
for i = 1, keynumber do
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.tag.viewonly(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
tagsByNumber[screen][i].selected = not tagsByNumber[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.movetotag(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.toggletag(tagsByNumber[screen][i])
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
keybinding({ modkey }, "Up", tagBack):add()
--CLIENT MANIPULATION
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
keybinding({ "Mod1" }, "F4", function () client.focus_get():kill() end):add()
--LAYOUT MANIPULATION
keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
---PROGRAM MANIPULATION
keybinding({ "Mod1" }, "grave", function () awful.spawn(menu) end):add()
keybinding({ "Control" }, "grave", function () awful.spawn(terminal) end):add()
keybinding({ modkey }, "grave", function ()
awful.tag.viewonly(tagsByName[mouse.screen]["terms"])
awful.spawn(terminal)
end):add()
keybinding({ "Mod4" }, "p", function () awful.spawn("exec mpc toggle") end):add()
keybinding({ "Mod4" }, "n", function () awful.spawn("exec mpc next") end):add()
keybinding({ "Mod4" }, "s", function () awful.spawn("exec mpc stop") end):add()
---}}}
---{{{Hooks
--FOCUS HOOK
function hook_focus(c)
if not awful.client.ismarked(c) then
c.border_color = border['focus']
end
c.opacity = 1.0
end
--UNFOCUS HOOK
function hook_unfocus(c)
if not awful.client.ismarked(c) then
c.border_color = border['normal']
end
c.opacity = 0.6
end
--MARKED HOOK
function hook_marked(c)
c.border_color = border_marked
end
--UNMARKED HOOK
function hook_unmarked(c)
c.border_color = border_focus
end
--MOUSEOVER HOOK
function hook_mouseover(c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= "magnifier" then
c:focus_set()
end
end
--MANAGE HOOK
function hook_manage(c)
-- Add mouse bindings
c:mouse_add(mouse({ }, 1, function (c) c:focus_set(); c:raise() end))
c:mouse_add(mouse({ modkey }, 1, function (c) c:mouse_move() end))
c:mouse_add(mouse({ modkey }, 3, function (c) c:mouse_resize() end))
-- Setup borders
c.border_width = 1
c.border_color = border['normal']
c:focus_set()
-- Client rules
clientRules(c)
-- Honor size hints
c.honorsizehints = true
end
--ARRANGE HOOK
function hook_arrange(screen)
tag = awful.tag.selected(mouse.screen)
if currentTag ~= tag then
lastTag = currentTag
currentTag = tag
end
--mouse warp
--warpMouse() I don't like it
--remove urgent hints
if tagsUrgent[tag.name] then
tagsUrgent[tag.name] = false
end
end
--URGENT HOOK
function hook_urgent(c)
urgentTag = nil
urgentScreen = 1
for screen = 1, mouse.screen do
for index, tag in pairs(tagsByNumber[screen]) do
if c:istagged(tag) then
urgentTag = tag
urgentScreen = screen
end
end
end
if urgentTag ~= nil then
if awful.tag.selected(urgentScreen) ~= urgentTag then
tagsUrgent[urgentTag.name] = true
end
end
end
--SETUP HOOKS
awful.hooks.focus(hook_focus)
awful.hooks.unfocus(hook_unfocus)
awful.hooks.marked(hook_marked)
awful.hooks.unmarked(hook_unmarked)
awful.hooks.manage(hook_manage)
awful.hooks.mouseover(hook_mouseover)
awful.hooks.arrange(hook_arrange)
awful.hooks.urgent(hook_urgent)
---}}}
Older version for older versions of awesome
--------------------------------
---Bavardage's Awesome Config---
--------------------------------
require("awful")
--{{{ Custom Variables
terminal = "exec rxvt"
menu = "exec ~/Scripts/dmenu.sh"
modkey = "Mod4"
fonts = {normal = "nimbus 10"}
bg = {normal = "#444444", focus = "#a10121", urgent = "#ffff00"}
fg = {normal = "#dddddd", focus = "#dae0d2", urgent = "#a10121"}
border = bg
mainBarHeight = 30
tagnames = {"one", "two", "three", "four", "im", "web", "terms"}
layouts = {"tile", "tileleft", "floating"}
defaultLayout = layouts[1]
tagRules = { ---compare the wm_class of the client
["midori"] = "web",
["navigator"] = "web", --firefox
["pidgin"] = "im"
}
floatingRules = { --wm class again
["gimp"] = true,
["phun.bin"] = true
}
---}}}
awesome.font_set(fonts['normal'])
awesome.colors_set({ fg = fg['normal'], bg = bg['normal'] })
---{{{ Utility Variables and Functions
--VARIABLES
tagsByName = {}
tagsByNumber = {}
tagsActive = {}
tagsUrgent = {}
currentTag = nil
lastTag = nil
tempCoords = nil
--FUNCTIONS
function colourise(text, fgcolour, bgcolour) --british spelling ftw
return "<bg color=\"" .. bgcolour .. "\"/><span color=\"" .. fgcolour .. "\">" .. text .. "</span>"
end
function textBox(nameIn, alignIn, defaultText)
temp = widget({
type = "textbox", name = nameIn, align = alignIn
})
temp.text = defaultText
return temp
end
function imageBox(nameIn, pathIn, alignIn, resize)
return textBox(nameIn, alignIn, "<bg image=\"" .. pathIn .. "\" resize=\"" .. resize .. "\"/>")
end
function warpMouse()
local sel = client.focus_get()
if sel then
local c_c = sel.coords
local m_c = mouse.coords
if m_c.x < c_c.x or m_c.x >= c_c.x + c_c.width or
m_c.y < c_c.y or m_c.y >= c_c.y + c_c.height then
if table.maxn(m_c.buttons) == 0 then
mouse.coords = { x = c_c.x + 5, y = c_c.y + 5}
end
end
end
end
function clientRules(c)
local screen = mouse.screen
for class,tag in pairs(tagRules) do
if c.class:lower():find(class) then
if tagsByName[screen][tag] then
awful.client.movetotag(tagsByName[screen][tag], c)
end
end
end
for class,bool in pairs(floatingRules) do
if c.class:lower():find(class) and bool then
c.floating = true
end
end
end
function tagBack()
awful.tag.viewonly(lastTag)
end
function updateActiveTags()
newTagsActive = {}
for screen = 1, screen.count() do
for index,tag in pairs(tagsByNumber[screen]) do
for key,client in pairs(client.get()) do
if client:istagged(tag) then
newTagsActive[tag.name] = true
end
end
end
end
tagsActive = newTagsActive
end
awful.hooks.timer(2, updateActiveTags)
---}}}
---{{{ Setup Tags
for s = 1, screen.count() do
tagsByName[s] = {}
tagsByNumber[s] = {}
for tagnumber = 1, #tagnames do
tagsByName[s][tagnames[tagnumber]] = tag({name = tagnames[tagnumber], layout = defaultLayout})
tagsByNumber[s][tagnumber] = tagsByName[s][tagnames[tagnumber]]
tagsByNumber[s][tagnumber].mwfact = 0.618033988769
tagsByNumber[s][tagnumber]:add(s)
end
tagsByNumber[s][1].selected = true
end
---}}}
---{{{ Widgets
--ARCHBOX
archicon = imageBox("archicon", "/home/ben/Pictures/awesome-arch-red.png", "left", "true")
archicon:mouse_add(mouse({ }, 1, function () awful.spawn("exec /home/ben/builds/PyShutdown/PowerDown.py") end ))
--TAGLIST
taglist = widget({type = "taglist", name = "taglist" })
taglist:mouse_add(
mouse({}, 1, function (object, tag) awful.tag.viewonly(tag) end)
)
function taglist.label(t)
local text = ""
if t.selected then
text = colourise(t.name, fg['focus'], bg['focus'])
elseif tagsUrgent[t.name] then
text = colourise(t.name, fg['urgent'], bg['urgent'])
else
text = t.name
end
if tagsActive[t.name] then
text = "<b>" .. text .. "</b>"
end
return " " .. text .. " "
end
--LAUNCHBOXEN
launchboxen = {}
function launchboxen:add(image, command)
local index = #self + 1
self[index] = imageBox("launchbox" .. index, image, "left", "true")
self[index]:mouse_add(mouse({ }, 1, function () awful.spawn(command) end))
end
launchboxen:add("/usr/share/pixmaps/firefox.png", "exec firefox")
launchboxen:add("/usr/share/icons/hicolor/32x32/apps/pidgin.png", "exec pidgin")
launchboxen:add("/usr/share/icons/bw2vista/scalable/apps/gnome-terminal.png", "exec urxvt")
--CLOCK ICON
clockicon = imageBox("clockicon", "/usr/share/icons/bw2vista/scalable/emblems/emblem-urgent.png", "right", "false")
--CLOCK TEXT
clocktext = textBox("clock", "right", "ThE tImE")
function clocktextUpdate ()
clocktext.text = "<b> " .. os.date("%a, %b %d %I:%M%p") .. "</b> "
end
awful.hooks.timer(10, clocktextUpdate)
---}}}
---{{{Statusbar
statusbars = {}
for s = 1, screen.count() do
statusbars[s] = statusbar({
position = "top", name = "statusbar" .. s,
fg = fg['normal'], bg = bg['normal'],
height = mainBarHeight
})
---add widgets
statusbars[s]:widget_add(archicon)
statusbars[s]:widget_add(taglist)
for index = 1, #launchboxen do
statusbars[s]:widget_add(launchboxen[index])
end
statusbars[s]:widget_add(clockicon)
statusbars[s]:widget_add(clocktext)
statusbars[s]:add(s)
end
bottombar = statusbar ({position = "bottom", height = 5, name = "bottombar"})
bottombar:widget_add(widget({ type = "systray", name = "systray", align = "right" }))
bottombar:add(1)
---}}}
---{{{Keybindings
--AWESOME
keybinding({ modkey, "Control" }, "r", awesome.restart):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
--TAG CONTROL
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tagsByNumber[s], keynumber));
end
for i = 1, keynumber do
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.tag.viewonly(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
tagsByNumber[screen][i].selected = not tagsByNumber[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.movetotag(tagsByNumber[screen][i])
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
local screen = mouse.screen
if tagsByNumber[screen][i] then
awful.client.toggletag(tagsByNumber[screen][i])
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
keybinding({ modkey }, "Up", tagBack):add()
--CLIENT MANIPULATION
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
keybinding({ "Mod1" }, "F4", function () client.focus_get():kill() end):add()
--LAYOUT MANIPULATION
keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
---PROGRAM MANIPULATION
keybinding({ "Mod1" }, "grave", function () awful.spawn(menu) end):add()
keybinding({ "Control" }, "grave", function () awful.spawn(terminal) end):add()
keybinding({ "Mod4" }, "p", function () awful.spawn("exec mpc toggle") end):add()
keybinding({ "Mod4" }, "n", function () awful.spawn("exec mpc next") end):add()
keybinding({ "Mod4" }, "s", function () awful.spawn("exec mpc stop") end):add()
---}}}
---{{{Hooks
--FOCUS HOOK
function hook_focus(c)
if not awful.client.ismarked(c) then
c.border_color = border['focus']
end
c.opacity = 1.0
end
--UNFOCUS HOOK
function hook_unfocus(c)
if not awful.client.ismarked(c) then
c.border_color = border['normal']
end
c.opacity = 0.6
end
--MARKED HOOK
function hook_marked(c)
c.border_color = border_marked
end
--UNMARKED HOOK
function hook_unmarked(c)
c.border_color = border_focus
end
--MOUSEOVER HOOK
function hook_mouseover(c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= "magnifier" then
c:focus_set()
end
end
--MANAGE HOOK
function hook_manage(c)
-- Add mouse bindings
c:mouse_add(mouse({ }, 1, function (c) c:focus_set(); c:raise() end))
c:mouse_add(mouse({ modkey }, 1, function (c) c:mouse_move() end))
c:mouse_add(mouse({ modkey }, 3, function (c) c:mouse_resize() end))
-- Setup borders
c.border_width = 1
c.border_color = border['normal']
c:focus_set()
-- Client rules
clientRules(c)
-- Honor size hints
c.honorsizehints = true
end
--ARRANGE HOOK
function hook_arrange(screen)
tag = awful.tag.selected(mouse.screen)
if currentTag ~= tag then
lastTag = currentTag
currentTag = tag
end
--mouse warp
--warpMouse() I don't like it
--remove urgent hints
if tagsUrgent[tag.name] then
tagsUrgent[tag.name] = false
end
end
--URGENT HOOK
function hook_urgent(c)
urgentTag = nil
urgentScreen = 1
for screen = 1, mouse.screen do
for index, tag in pairs(tagsByNumber[screen]) do
if c:istagged(tag) then
urgentTag = tag
urgentScreen = screen
end
end
end
if urgentTag ~= nil then
if awful.tag.selected(urgentScreen) ~= urgentTag then
tagsUrgent[urgentTag.name] = true
end
end
end
--SETUP HOOKS
awful.hooks.focus(hook_focus)
awful.hooks.unfocus(hook_unfocus)
awful.hooks.marked(hook_marked)
awful.hooks.unmarked(hook_unmarked)
awful.hooks.manage(hook_manage)
awful.hooks.mouseover(hook_mouseover)
awful.hooks.arrange(hook_arrange)
awful.hooks.urgent(hook_urgent)
---}}}

9 comments
Comments feed for this article
Wednesday 23rd July, 2008 at 2:40 pm
Tidied version of my rc.lua for awesome-git « Ardoris
[...] My awesome3 rc.lua [...]
Sunday 10th August, 2008 at 7:07 pm
Lua: merge two tables, awesome3-rc2 config « Ardoris
[...] My awesome3 rc.lua [...]
Saturday 16th August, 2008 at 2:29 pm
ab1
hi is just updating to awesome 3 rc_3. but all work fine with a modified version of you rc.lua for awesome 3 rc_2 , expect of one:
all taglist will dont show if any aplication run. if i turn all off i see all taglist again.
Sunday 31st August, 2008 at 8:53 pm
jebavarde
hmm – I’ve been away for two weeks, so my config is probably outdated. Will upgrade at some point over the next couple of days and get a working config again.
Monday 1st September, 2008 at 7:49 pm
rc.lua updated for awesome3-rc4 « Ardoris
[...] My awesome3 rc.lua [...]
Friday 3rd October, 2008 at 8:16 pm
Awesome 3 rc.lua updated « Ardoris
[...] My awesome3 rc.lua [...]
Thursday 6th November, 2008 at 4:21 pm
Radical - Launcher for Awesome(-git) « Ardoris
[...] My awesome3 rc.lua [...]
Monday 10th November, 2008 at 12:34 am
mru
Hi,
whats the nice looking mixer application on your desktop?
Wednesday 12th November, 2008 at 7:12 pm
jebavarde
Probably you’re referring to the volume desklet. It is part of adesklets – http://adesklets.sourceforge.net/