.config/awesome/rc.lua
This commit is contained in:
parent
5a36f207f6
commit
ddff03f5ec
1 changed files with 25 additions and 7 deletions
|
@ -1,15 +1,15 @@
|
||||||
-- Standard awesome library
|
|
||||||
require("awful")
|
require("awful")
|
||||||
require("awful.autofocus")
|
require("awful.autofocus")
|
||||||
require("awful.rules")
|
require("awful.rules")
|
||||||
-- Theme handling library
|
|
||||||
require("beautiful")
|
require("beautiful")
|
||||||
-- Notification library
|
|
||||||
require("naughty")
|
|
||||||
require("bowl")
|
require("bowl")
|
||||||
require("keychain")
|
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
|
-- {{{ Error handling
|
||||||
-- Check if awesome encountered an error during startup and fell back to
|
-- 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
|
if client.focus then client.focus:raise() end
|
||||||
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
|
-- 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
|
for k, v in pairs(table1) do
|
||||||
if table[k] ~= v and not table2[k]:find(v) then
|
if table[k] ~= v and not table2[k]:find(v) then
|
||||||
return false
|
return false
|
||||||
|
@ -64,7 +77,7 @@ function oni.run_or_raise(cmd, properties)
|
||||||
|
|
||||||
for i, c in pairs(clients) do
|
for i, c in pairs(clients) do
|
||||||
-- make an array of matched clients
|
-- make an array of matched clients
|
||||||
if match(properties, c) then
|
if oni.match(properties, c) then
|
||||||
n = n + 1
|
n = n + 1
|
||||||
matched_clients[n] = c
|
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.init({ use_timers = true, timeout = 1 })
|
||||||
bowl.default_setup()
|
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.
|
-- This is used later as the default terminal and editor to run.
|
||||||
terminal = "urxvt"
|
terminal = "urxvt"
|
||||||
editor = os.getenv("EDITOR") or "nano"
|
editor = os.getenv("EDITOR") or "nano"
|
||||||
|
|
Loading…
Reference in a new issue