refactor
This commit is contained in:
parent
05896c56dd
commit
ed77efd2f5
89
init.lua
89
init.lua
|
@ -5,9 +5,9 @@ local awful = require("awful")
|
||||||
local modkey = "Mod4"
|
local modkey = "Mod4"
|
||||||
|
|
||||||
local function tablelength(T)
|
local function tablelength(T)
|
||||||
local count = 0
|
local count = 0
|
||||||
for _ in pairs(T) do count = count + 1 end
|
for _ in pairs(T) do count = count + 1 end
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------> methods -- ;
|
--------------------------------------------------------------> methods -- ;
|
||||||
|
@ -59,41 +59,68 @@ end
|
||||||
|
|
||||||
local keys = gears.table.join(
|
local keys = gears.table.join(
|
||||||
awful.key({modkey}, "p", function ()
|
awful.key({modkey}, "p", function ()
|
||||||
local tablist = region_tablist()
|
local tablist = region_tablist()
|
||||||
local next_client = nil
|
local next_client = nil
|
||||||
|
|
||||||
if not tablist then return false end
|
if not tablist then return false end
|
||||||
--+ flow control
|
--+ flow control
|
||||||
|
|
||||||
for _, cc in ipairs(tablist) do
|
for _, cc in ipairs(tablist) do
|
||||||
if (cc.window == client.focus.window) then
|
if (cc.window == client.focus.window) then
|
||||||
if tablist[_+1] then
|
if tablist[_+1] then
|
||||||
client.focus:lower()
|
client.focus:lower()
|
||||||
next_client = tablist[_+1]
|
next_client = tablist[_+1]
|
||||||
next_client:emit_signal("request::activate", "mouse_enter",{raise = true})
|
next_client:emit_signal("request::activate", "mouse_enter",{raise = true})
|
||||||
break
|
break
|
||||||
--+ activate next client
|
--+ activate next client
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end),
|
end),
|
||||||
--+ shortcut: shuffle down
|
--+ shortcut: shuffle down
|
||||||
|
|
||||||
awful.key({modkey}, "o", function ()
|
awful.key({modkey}, "o", function ()
|
||||||
local tablist = region_tablist()
|
local tablist = region_tablist()
|
||||||
local prev_client = nil
|
local prev_client = nil
|
||||||
|
|
||||||
if not tablist then return false end
|
if not tablist then return false end
|
||||||
--+ flow control
|
--+ flow control
|
||||||
|
|
||||||
|
for i = #tablist, 1, -1 do
|
||||||
|
prev_client = tablist[i]
|
||||||
|
prev_client:emit_signal("request::activate", "mouse_enter",{raise = true})
|
||||||
|
break
|
||||||
|
--+ activate previous client
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
--+ shortcut: shuffle up
|
||||||
|
|
||||||
|
awful.key({ modkey, }, "Page_Up", function ()
|
||||||
|
client.focus:geometry({width=800,height=800}) awful.placement.top_right(client.focus)
|
||||||
|
end),
|
||||||
|
--+ shortcut: align top-right
|
||||||
|
|
||||||
|
awful.key({ modkey, }, "Page_Down", function ()
|
||||||
|
client.focus:geometry({width=800,height=800}) awful.placement.bottom_right(client.focus)
|
||||||
|
end),
|
||||||
|
--+ shortcut: align bottom-right
|
||||||
|
|
||||||
|
awful.key({ modkey, }, "Home", function ()
|
||||||
|
if not client.focus.floating then client.focus.floating = true end
|
||||||
|
awful.placement.centered(client.focus)
|
||||||
|
end),
|
||||||
|
--+ shortcut: align center as float
|
||||||
|
|
||||||
|
awful.key({ modkey, }, "Insert", function ()
|
||||||
|
awful.placement.top_left(client.focus)
|
||||||
|
end),
|
||||||
|
--+ shortcut: align top-left
|
||||||
|
|
||||||
|
awful.key({ modkey, }, "Delete", function ()
|
||||||
|
awful.placement.bottom_left(client.focus)
|
||||||
|
end)
|
||||||
|
--+ shortcut: align bottom-left
|
||||||
|
|
||||||
for i = #tablist, 1, -1 do
|
|
||||||
prev_client = tablist[i]
|
|
||||||
prev_client:emit_signal("request::activate", "mouse_enter",{raise = true})
|
|
||||||
break
|
|
||||||
--+ activate previous client
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
--+ shortcut: shuffle down
|
|
||||||
)
|
)
|
||||||
|
|
||||||
--------------------------------------------------------------> exports -- ;
|
--------------------------------------------------------------> exports -- ;
|
||||||
|
|
Loading…
Reference in New Issue