summaryrefslogtreecommitdiffstats
path: root/.config/awesome/rc.lua
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-09-13 10:32:33 +0200
committerGravatar Tom Willemsen2012-09-13 10:32:33 +0200
commitddff03f5ecf8a06c0e57feef2f03103fa0c1b467 (patch)
tree7409d4a767e355d607e7f0d8d23bb2653a084adb /.config/awesome/rc.lua
parent5a36f207f6529b072742da9c42d95eee25b1fae0 (diff)
downloaddotfiles-ddff03f5ecf8a06c0e57feef2f03103fa0c1b467.tar.gz
dotfiles-ddff03f5ecf8a06c0e57feef2f03103fa0c1b467.zip
.config/awesome/rc.lua
Diffstat (limited to '.config/awesome/rc.lua')
-rw-r--r--.config/awesome/rc.lua32
1 files changed, 25 insertions, 7 deletions
diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua
index 099d3c5..b602eb7 100644
--- a/.config/awesome/rc.lua
+++ b/.config/awesome/rc.lua
@@ -1,15 +1,15 @@
--- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
--- Theme handling library
require("beautiful")
--- Notification library
-require("naughty")
require("bowl")
require("keychain")
+require("lfs")
+require("naughty")
+
+oni = { } -- Container for custom functions.
-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
@@ -41,8 +41,21 @@ 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
+
-- Returns true if all pairs in table1 are present in table2
-function match(table1, table2)
+function oni.match(table1, table2)
for k, v in pairs(table1) do
if table[k] ~= v and not table2[k]:find(v) then
return false
@@ -64,7 +77,7 @@ function oni.run_or_raise(cmd, properties)
for i, c in pairs(clients) do
-- make an array of matched clients
- if match(properties, c) then
+ if oni.match(properties, c) then
n = n + 1
matched_clients[n] = c
@@ -108,6 +121,11 @@ beautiful.init("/usr/share/awesome/themes/default/theme.lua")
bowl.init({ use_timers = true, timeout = 1 })
bowl.default_setup()
+keychain.init({ escapes = {
+ keychain.keystroke ({ }, "Escape"),
+ keychain.keystroke ({ "Control", }, "g")
+} })
+
-- This is used later as the default terminal and editor to run.
terminal = "urxvt"
editor = os.getenv("EDITOR") or "nano"