.config/awesome/rc.lua
This commit is contained in:
parent
c4ea2643f6
commit
fa473dd629
1 changed files with 3 additions and 75 deletions
|
@ -9,8 +9,6 @@ require("naughty")
|
|||
|
||||
oni = { } -- Container for custom functions.
|
||||
|
||||
oni.maildirfmt = "/home/slash/documents/mail/%s/inbox/new/"
|
||||
|
||||
--- Error handling
|
||||
-- Check if awesome encountered an error during startup and fell back to
|
||||
-- another config (This code will only ever execute for the fallback config)
|
||||
|
@ -41,44 +39,6 @@ function oni.focus_raise(direction)
|
|||
if client.focus then client.focus:raise() end
|
||||
end
|
||||
|
||||
function oni.mailcount(account)
|
||||
local i = 0
|
||||
local dir = string.format(oni.maildirfmt, account)
|
||||
|
||||
for file in lfs.dir(dir) do
|
||||
if file ~= "." and file ~= ".." then
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
return i
|
||||
end
|
||||
|
||||
function oni.mailcount_text()
|
||||
return string.format(" ryu: %d aet: %d gmail: %d 9f: %d --",
|
||||
oni.mailcount("ryuslash.org"),
|
||||
oni.mailcount("aethon"),
|
||||
oni.mailcount("gmail"),
|
||||
oni.mailcount("ninthfloor"))
|
||||
end
|
||||
|
||||
function oni.mailcount_widgets(label, account, name)
|
||||
widgets = {}
|
||||
widgets.label = widget({ type = "textbox" })
|
||||
widgets.label.text = string.format(" %s: ", label)
|
||||
widgets.count = widget({ type = "textbox" })
|
||||
widgets.count.text = string.format(" %d ", oni.mailcount(account))
|
||||
widgets.count.bg = beautiful.bg_focus
|
||||
widgets.count:buttons(
|
||||
awful.util.table.join(
|
||||
awful.button({ }, 1,
|
||||
function (c)
|
||||
awful.util.spawn("emacsclient -e '(oni:view-mail \"" .. name .. "\")'")
|
||||
end)))
|
||||
|
||||
return widgets
|
||||
end
|
||||
|
||||
-- Returns true if all pairs in table1 are present in table2
|
||||
function oni.match(table1, table2)
|
||||
for k, v in pairs(table1) do
|
||||
|
@ -139,7 +99,6 @@ function oni.run_or_raise(cmd, properties)
|
|||
end
|
||||
awful.util.spawn(cmd)
|
||||
end
|
||||
|
||||
-- {{{ Variable definitions
|
||||
-- Themes define colours, icons, and wallpapers
|
||||
beautiful.init("/home/slash/.config/awesome/themes/custom/theme.lua")
|
||||
|
@ -167,6 +126,7 @@ modkey = "Mod4"
|
|||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
layouts =
|
||||
{
|
||||
awful.layout.suit.magnifier,
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.left,
|
||||
awful.layout.suit.tile.bottom,
|
||||
|
@ -175,7 +135,6 @@ layouts =
|
|||
awful.layout.suit.fair.horizontal,
|
||||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
awful.layout.suit.magnifier,
|
||||
awful.layout.suit.floating
|
||||
}
|
||||
-- }}}
|
||||
|
@ -214,23 +173,6 @@ mytextclock = awful.widget.textclock({ align = "right" })
|
|||
-- Create a systray
|
||||
mysystray = widget({ type = "systray" })
|
||||
|
||||
-- Create a mailbox widget
|
||||
myryumailbox = oni.mailcount_widgets("ryu", "ryuslash.org", "ryuslash")
|
||||
myaethonmailbox = oni.mailcount_widgets("aet", "aethon", "aethon")
|
||||
mygmailmailbox = oni.mailcount_widgets("gmail", "gmail", "gmail")
|
||||
my9fmailbox = oni.mailcount_widgets("9f", "ninthfloor", "ninthfloor")
|
||||
|
||||
mymailboxtimer = timer({ timeout = 60 })
|
||||
mymailboxtimer:add_signal(
|
||||
"timeout",
|
||||
function ()
|
||||
myryumailbox.count.text = string.format(" %d ", oni.mailcount("ryuslash.org"))
|
||||
myaethonmailbox.count.text = string.format(" %d ", oni.mailcount("aethon"))
|
||||
mygmailmailbox.count.text = string.format(" %d ", oni.mailcount("gmail"))
|
||||
my9fmailbox.count.text = string.format(" %d ", oni.mailcount("ninthfloor"))
|
||||
end)
|
||||
mymailboxtimer:start()
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
mywibox = {}
|
||||
mypromptbox = {}
|
||||
|
@ -308,14 +250,6 @@ for s = 1, screen.count() do
|
|||
mylayoutbox[s],
|
||||
mytextclock,
|
||||
s == 1 and mysystray or nil,
|
||||
s == 1 and my9fmailbox.count or nil,
|
||||
s == 1 and my9fmailbox.label or nil,
|
||||
s == 1 and mygmailmailbox.count or nil,
|
||||
s == 1 and mygmailmailbox.label or nil,
|
||||
s == 1 and myaethonmailbox.count or nil,
|
||||
s == 1 and myaethonmailbox.label or nil,
|
||||
s == 1 and myryumailbox.count or nil,
|
||||
s == 1 and myryumailbox.label or nil,
|
||||
mytasklist[s],
|
||||
layout = awful.widget.layout.horizontal.rightleft
|
||||
}
|
||||
|
@ -489,15 +423,9 @@ awful.rules.rules = {
|
|||
properties = { floating = true } },
|
||||
{ rule = { class = "gimp" },
|
||||
properties = { floating = true } },
|
||||
{ rule = { class = "Emacs" },
|
||||
properties = { tag = tags[1][1] } },
|
||||
-- Set Firefox to always map on tags number 2 of screen 1.
|
||||
{ rule = { class = "Firefox" },
|
||||
properties = { tag = tags[2][1] } },
|
||||
{ rule = { class = "Conkeror" },
|
||||
properties = { tag = tags[2][1] } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { tag = tags[2][1] } },
|
||||
-- { rule = { class = "Firefox" },
|
||||
-- properties = { tag = tags[1][2] } },
|
||||
}
|
||||
-- }}}
|
||||
|
||||
|
|
Loading…
Reference in a new issue