Skip to content

Commit

Permalink
Update awesome config for awesome 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Wei Dai committed Mar 23, 2013
1 parent 8131e6a commit a90834c
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 55 deletions.
14 changes: 10 additions & 4 deletions .config/awesome/lucius/theme.lua
@@ -1,8 +1,10 @@
-- Lucius theme

local awful = require("awful")

theme = {}
theme.confdir = awful.util.getdir("config") .. "/lucius/"
theme.wallpaper_cmd = { "awsetbg " .. theme.confdir .. "lucius-background.png" }
theme.wallpaper = theme.confdir .. "lucius-background.png"

theme.font = "sans 8"

Expand All @@ -12,16 +14,20 @@ theme.fg_urgent = "#FF8787"
theme.bg_normal = "#1C1C1C"
theme.bg_focus = "#444444"
theme.bg_urgent = "#870000"
theme.bg_systray = theme.bg_normal

theme.border_width = "1"
theme.border_width = 1
theme.border_normal = "#8A8A8A"
theme.border_focus = "#005F87"
theme.border_marked = "#D78700"

theme.titlebar_bg_focus = theme.bg_normal
theme.titlebar_bg_normal = theme.bg_normal

theme.mouse_finder_color = "#D78700"

theme.menu_height = "15"
theme.menu_width = "100"
theme.menu_height = 15
theme.menu_width = 100

theme.taglist_squares_sel = theme.confdir .. "taglist/squarefz.png"
theme.taglist_squares_unsel = theme.confdir .. "taglist/squarez.png"
Expand Down
118 changes: 67 additions & 51 deletions .config/awesome/rc.lua
@@ -1,13 +1,16 @@
-- Standard awesome library
require("awful")
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
require("awful.rules")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
require("beautiful")
local beautiful = require("beautiful")
-- Notification library
require("naughty")
local naughty = require("naughty")
-- Widget Lib
require("vicious")
local vicious = require("vicious")
-- Load local settings
if awful.util.file_readable(awful.util.getdir("config") .. "/local.lua") then
require("local")
Expand All @@ -25,7 +28,7 @@ end
-- Handle runtime errors after startup
do
local in_error = false
awesome.add_signal("debug::error", function (err)
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
Expand Down Expand Up @@ -55,7 +58,7 @@ editor_cmd = terminal .. " -e " .. editor
modkey = "Mod4"

-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
local layouts =
{
awful.layout.suit.tile,
awful.layout.suit.floating,
Expand All @@ -72,6 +75,14 @@ layouts =
}
-- }}}

-- {{{ Wallpaper
if beautiful.wallpaper then
for s = 1, screen.count() do
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
end
end
-- }}}

-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
Expand All @@ -83,31 +94,29 @@ end

-- {{{ Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" })
mytextclock = awful.widget.textclock()

-- Create a systray
mysystray = widget({ type = "systray" })
mysystray = wibox.widget.systray()

-- Layout helpers
spacer = widget({ type = "textbox", name = "spacer" })
seperator = widget({ type = "textbox", name = "seperator" })
spacer.text = " "
seperator.text = " | "
seperator = wibox.widget.textbox()
seperator:set_text(" | ")

-- Mem widget
memwidget = widget({ type = "textbox" })
memwidget = wibox.widget.textbox()
vicious.register(memwidget, vicious.widgets.mem, "Mem: $1% ($2MB/$3MB)", 13)

-- Cpu widget
cpuwidget = widget({ type = "textbox" })
cpuwidget = wibox.widget.textbox()
vicious.register(cpuwidget, vicious.widgets.cpu, "CPU: $1%")

-- Thermal widget
thermalwidget = widget({ type = "textbox" })
thermalwidget = wibox.widget.textbox()
vicious.register(thermalwidget, vicious.widgets.thermal, "Temp: $1C", 19, "thermal_zone0")

-- Battery widget
batwidget = widget({ type = "textbox" })
batwidget = wibox.widget.textbox()
vicious.register(batwidget, vicious.widgets.bat, function (widget, args)
if args[2] == 0 then return ""
else
Expand All @@ -125,15 +134,18 @@ mytaglist.buttons = awful.util.table.join(
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
-- Without this, the following
-- :isvisible() makes no sense
c.minimized = false
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
Expand Down Expand Up @@ -162,7 +174,7 @@ mytasklist.buttons = awful.util.table.join(

for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
mypromptbox[s] = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
Expand All @@ -172,32 +184,40 @@ for s = 1, screen.count() do
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)

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

-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", height = "20", screen = s })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
{
mytaglist[s],
mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright
},
mylayoutbox[s],
mytextclock,
s == 1 and mysystray or nil,
seperator, memwidget,
seperator, cpuwidget,
seperator, thermalwidget,
seperator, batwidget,
mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft
}

-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(mytaglist[s])
left_layout:add(mypromptbox[s])

-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
right_layout:add(batwidget)
right_layout:add(seperator)
right_layout:add(thermalwidget)
right_layout:add(seperator)
right_layout:add(cpuwidget)
right_layout:add(seperator)
right_layout:add(memwidget)
right_layout:add(seperator)
if s == 1 then right_layout:add(mysystray) end
right_layout:add(mytextclock)
right_layout:add(mylayoutbox[s])

-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_middle(mytasklist[s])
layout:set_right(right_layout)

mywibox[s]:set_widget(layout)
end
-- }}}

Expand Down Expand Up @@ -284,7 +304,6 @@ clientkeys = awful.util.table.join(
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "n",
function (c)
Expand All @@ -302,7 +321,7 @@ clientkeys = awful.util.table.join(
-- 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));
keynumber = math.min(9, math.max(#tags[s], keynumber))
end

-- Bind all key numbers to tags.
Expand Down Expand Up @@ -353,7 +372,7 @@ awful.rules.rules = {
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
focus = awful.client.focus.filter,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "MPlayer" },
Expand Down Expand Up @@ -385,12 +404,9 @@ awful.rules.rules = {

-- {{{ Signals
-- Signal function to execute when a new client appears.
client.add_signal("manage", function (c, startup)
-- Add a titlebar
-- awful.titlebar.add(c, { modkey = modkey })

client.connect_signal("manage", function (c, startup)
-- Enable sloppy focus
c:add_signal("mouse::enter", function(c)
c:connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
Expand All @@ -410,6 +426,6 @@ client.add_signal("manage", function (c, startup)
end
end)

client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}

0 comments on commit a90834c

Please sign in to comment.