diff options
author | Tom Willemsen | 2012-10-07 15:23:23 +0200 |
---|---|---|
committer | Tom Willemsen | 2012-10-07 15:23:23 +0200 |
commit | 52abe4f88168002420813e20751d772023d96718 (patch) | |
tree | d87aeefe7ca798fd8cdb911d932a2712944f5ca3 /.config/awesome/oni.lua | |
parent | 5b8d412cf79168fc6cdd45eac3ce65934d1f7b8d (diff) | |
parent | 049a44b608aacbaf1f040183def77fd7e7243fe3 (diff) | |
download | dotfiles-52abe4f88168002420813e20751d772023d96718.tar.gz dotfiles-52abe4f88168002420813e20751d772023d96718.zip |
Merge remote-tracking branch 'origin/master' into phoenix
Conflicts:
.config/awesome/rc.lua
Diffstat (limited to '.config/awesome/oni.lua')
-rw-r--r-- | .config/awesome/oni.lua | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/.config/awesome/oni.lua b/.config/awesome/oni.lua new file mode 100644 index 0000000..7cc5df1 --- /dev/null +++ b/.config/awesome/oni.lua @@ -0,0 +1,73 @@ +local awful = awful +local beautiful = beautiful +local client = client +local ext = require("ext") +local lfs = require("lfs") +local pairs = pairs +local string = string +local table = table +local widget = widget + +module("oni") + +local maildirfmt = "/home/slash/documents/mail/%s/inbox/new/" + +function mailcount(account) + local i = 0 + local dir = string.format(maildirfmt, account) + + for file in lfs.dir(dir) do + if file ~= "." and file ~= ".." then + i = i + 1 + end + end + + return i +end + +local function showmail(name) + awful.util.spawn("emacsclient -e '(oni:view-mail \"" .. name .. "\")'") +end + +function 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 ", mailcount(account)) + widgets.count.bg = beautiful.bg_focus + widgets.count:buttons( + awful.util.table.join( + awful.button({ }, 1, function (c) showmail(name) end))) + + return widgets +end + +function focus_raise(direction) + awful.client.focus.bydirection(direction) + if client.focus then client.focus:raise() end +end + +function ror_browser() + ext.run_or_raise("conkeror", { class = "Conkeror" }) +end + +function ror_editor() + ext.run_or_raise("emacsclient -c -a emacs", { class = "Emacs" }) +end + +function ror_term() + ext.run_or_raise("urxvt", { class = "URxvt" }) +end + +function run_browser() + awful.util.spawn("conkeror") +end + +function run_editor() + awful.util.spawn("emacsclient -c -a emacs") +end + +function run_term() + awful.util.spawn("urxvt") +end |