summaryrefslogtreecommitdiffstats
path: root/.config/awesome/rc.lua
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-10-07 15:23:23 +0200
committerGravatar Tom Willemsen2012-10-07 15:23:23 +0200
commit52abe4f88168002420813e20751d772023d96718 (patch)
treed87aeefe7ca798fd8cdb911d932a2712944f5ca3 /.config/awesome/rc.lua
parent5b8d412cf79168fc6cdd45eac3ce65934d1f7b8d (diff)
parent049a44b608aacbaf1f040183def77fd7e7243fe3 (diff)
downloaddotfiles-52abe4f88168002420813e20751d772023d96718.tar.gz
dotfiles-52abe4f88168002420813e20751d772023d96718.zip
Merge remote-tracking branch 'origin/master' into phoenix
Conflicts: .config/awesome/rc.lua
Diffstat (limited to '.config/awesome/rc.lua')
-rw-r--r--.config/awesome/rc.lua100
1 files changed, 12 insertions, 88 deletions
diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua
index 38e9a72..24ff5fe 100644
--- a/.config/awesome/rc.lua
+++ b/.config/awesome/rc.lua
@@ -4,10 +4,9 @@ require("awful.rules")
require("beautiful")
require("bowl")
require("keychain")
-require("lfs")
require("naughty")
-
-oni = { } -- Container for custom functions.
+require("ext")
+require("oni")
--- Error handling
-- Check if awesome encountered an error during startup and fell back to
@@ -33,72 +32,6 @@ do
end)
end
---- Functions
-function oni.focus_raise(direction)
- awful.client.focus.bydirection(direction)
- if client.focus then client.focus:raise() end
-end
-
--- Returns true if all pairs in table1 are present in 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
- end
- end
-
- return true
-end
-
---- Spawns cmd if no client can be found matching properties
--- If such a client can be found, pop to first tag where it is
--- visible, and give it focus
-function oni.run_or_raise(cmd, properties)
- local clients = client.get()
- local focused = awful.client.next(0)
- local findex = 0
- local matched_clients = { }
- local n = 0
-
- for i, c in pairs(clients) do
- -- make an array of matched clients
- if oni.match(properties, c) then
- n = n + 1
- matched_clients[n] = c
-
- if n == focused then
- findex = n
- end
- end
- end
-
- if n > 0 then
- local c = matched_clients[1]
-
- -- if the focused window matched switch focus to next in list
- if 0 < findex and findex < n then
- c = matched_clients[findex + 1]
- end
-
- local ctags = c:tags()
-
- if table.getn(ctags) == 0 then
- -- ctags is empty, show client on current tag
- local curtag = awful.tag.selected()
- awful.client.movetotag(curtag, c)
- else
- -- Otherwise, pop to first tag client is visible on
- awful.tag.viewonly(ctags[1])
- end
-
- -- And then focus the client
- client.focus = c
- c:raise()
- awful.screen.focus(c.screen)
- return
- end
- awful.util.spawn(cmd)
-end
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/slash/.config/awesome/themes/custom/theme.lua")
@@ -282,28 +215,19 @@ globalkeys = awful.util.table.join(
sub({ }, "b", function () oni.focus_raise("left") end),
sub({ }, "n", function () oni.focus_raise("down") end),
sub({ }, "p", function () oni.focus_raise("up") end),
- sub({ }, "e",
- function () oni.run_or_raise("emacsclient -c -a emacs",
- { class = "Emacs" }) end),
- sub({ "Shift", }, "e",
- function () awful.util.spawn("emacsclient -c -a emacs") end),
- sub({ }, "c",
- function () oni.run_or_raise("urxvt",
- { class = "URxvt" }) end),
- sub({ "Shift", }, "c",
- function () awful.util.spawn("urxvt") end),
- sub({ }, "w",
- function () oni.run_or_raise("conkeror",
- { class = "Conkeror" }) end),
- sub({ "Shift", }, "w",
- function () awful.util.spawn("conkeror") end) }),
+ sub({ }, "c", oni.ror_term),
+ sub({ "Shift", }, "c", oni.run_term),
+ sub({ }, "e", oni.ror_editor),
+ sub({ "Shift", }, "e", oni.run_editor),
+ sub({ }, "w", oni.ror_browser),
+ sub({ "Shift", }, "w", oni.run_browser) }),
awful.key({ "Control", "Mod1" }, "l",
function () awful.util.spawn("i3lock -c 000000") end),
- awful.key({ modkey, }, "Left", awful.tag.viewprev ),
- awful.key({ modkey, }, "Right", awful.tag.viewnext ),
- awful.key({ modkey, }, "Escape", awful.tag.history.restore),
+ awful.key({ modkey, }, "Left", awful.tag.viewprev ),
+ awful.key({ modkey, }, "Right", awful.tag.viewnext ),
+ awful.key({ modkey, }, "Escape", awful.tag.history.restore),
- awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end),
+ -- awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),