cleanup
This commit is contained in:
parent
201c71e004
commit
028d866eb5
7 changed files with 63 additions and 2554 deletions
70
rc.lua
70
rc.lua
|
@ -2,14 +2,64 @@
|
|||
require("awful")
|
||||
require("awful.autofocus")
|
||||
require("awful.rules")
|
||||
-- Theme handling library
|
||||
require("beautiful")
|
||||
-- Notification library
|
||||
require("naughty")
|
||||
require("teardrop")
|
||||
require("obvious.battery")
|
||||
require("obvious.popup_run_prompt")
|
||||
require("vicious")
|
||||
--- 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
|
||||
-- @param cmd the command to execute
|
||||
-- @param properties a table of properties to match against clients. Possible entries: any properties of the client object
|
||||
function runraise(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 match(properties, c) then
|
||||
n = n + 1
|
||||
matched_clients[n] = c
|
||||
if c == 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()
|
||||
return
|
||||
end
|
||||
awful.util.spawn(cmd)
|
||||
end
|
||||
|
||||
-- Returns true if all pairs in table1 are present in table2
|
||||
function match (table1, table2)
|
||||
for k, v in pairs(table1) do
|
||||
if table2[k] ~= v and not table2[k]:find(v) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- {{{ Variable definitions
|
||||
-- Themes define colours, icons, and wallpapers
|
||||
|
@ -225,11 +275,17 @@ globalkeys = awful.util.table.join(
|
|||
--}}}
|
||||
-- Standard program
|
||||
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
|
||||
awful.key({ modkey, }, "f", function () awful.util.spawn("firefox") end),
|
||||
awful.key({ modkey, }, "t", function () awful.util.spawn("thunderbird") end),
|
||||
awful.key({ modkey, }, "p", function () awful.util.spawn("pidgin") end),
|
||||
awful.key({ modkey, }, "s", function () awful.util.spawn("sunbird") end),
|
||||
awful.key({ modkey, }, "g", function () awful.util.spawn("gmpc") end),
|
||||
-- awful.key({ modkey, }, "f", function () awful.util.spawn("firefox") end),
|
||||
-- awful.key({ modkey, }, "t", function () awful.util.spawn("thunderbird") end),
|
||||
-- awful.key({ modkey, }, "p", function () awful.util.spawn("pidgin") end),
|
||||
-- awful.key({ modkey, }, "s", function () awful.util.spawn("sunbird") end),
|
||||
-- awful.key({ modkey, }, "g", function () awful.util.spawn("gmpc") end),
|
||||
awful.key({ modkey, }, "f", function () runraise("firefox", { class = "Firefox" }) end),
|
||||
awful.key({ modkey, }, "t", function () runraise("thunderbird", { class = "Thunderbird" }) end),
|
||||
awful.key({ modkey, }, "p", function () runraise("pidgin", { class = "Pidgin" }) end),
|
||||
awful.key({ modkey, }, "s", function () runraised("sunbird", { class = "Sunbirdi-bin" }) end),
|
||||
awful.key({ modkey, }, "g", function () runraise("gmpc", { class = "Gmpc" }) end),
|
||||
awful.key({ }, "XF86Mail", function () awful.util.spawn("xset dpms force off") end),
|
||||
awful.key({ }, "XF86Mail", function () awful.util.spawn("xset dpms force off") end),
|
||||
awful.key({ modkey }, "XF86Mail", function () awful.util.spawn("urslock") end),
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue