2021-06-10 16:28:28 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
---------------------------------------------------------- dependencies -- ;
|
2021-06-28 03:23:53 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
local capi = {root=root}
|
2021-06-10 16:28:28 +02:00
|
|
|
local gears = require("gears")
|
2021-06-27 07:48:46 +02:00
|
|
|
local naughty = require("naughty")
|
|
|
|
local inspect = require('inspect')
|
2021-06-10 16:28:28 +02:00
|
|
|
local awful = require("awful")
|
|
|
|
local modkey = "Mod4"
|
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
local machina = require('awesomewm-machina.methods')
|
2021-06-10 16:28:28 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
local compare = machina.compare
|
|
|
|
local region_tablist = machina.region_tablist
|
|
|
|
local focus_by_direction = machina.focus_by_direction
|
|
|
|
local get_active_regions = machina.get_active_regions
|
|
|
|
local shift_by_direction = machina.shift_by_direction
|
|
|
|
local expand_horizontal = machina.expand_horizontal
|
|
|
|
local geoms = machina.geoms
|
|
|
|
local shuffle = machina.shuffle
|
|
|
|
local my_shifter = machina.my_shifter
|
|
|
|
local expand_vertical = machina.expand_vertical
|
2021-06-10 16:28:28 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
---------------------------------------------------------- key bindings -- ;
|
2021-06-10 16:28:28 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
local bindings = {
|
2021-06-28 03:23:53 +02:00
|
|
|
awful.key({modkey}, ";", shuffle("backward")),
|
|
|
|
awful.key({modkey}, "'", shuffle("forward")),
|
2021-06-28 05:53:14 +02:00
|
|
|
--▨ shuffle decks
|
2021-06-28 03:23:53 +02:00
|
|
|
|
2021-06-27 08:15:25 +02:00
|
|
|
awful.key({modkey, "Shift"}, "j", shift_by_direction("left")),
|
|
|
|
awful.key({modkey, "Shift"}, "l", shift_by_direction("right")),
|
2021-06-28 02:24:49 +02:00
|
|
|
awful.key({modkey, "Shift"}, "k", shift_by_direction("down")),
|
|
|
|
awful.key({modkey, "Shift"}, "i", shift_by_direction("up")),
|
2021-06-28 05:53:14 +02:00
|
|
|
--▨ move (directional)
|
2021-06-10 16:44:01 +02:00
|
|
|
|
2021-06-28 02:24:49 +02:00
|
|
|
awful.key({modkey}, "[", my_shifter("backward")),
|
|
|
|
awful.key({modkey}, "]", my_shifter("forward")),
|
2021-06-28 05:53:14 +02:00
|
|
|
--▨ move (clock)
|
2021-06-11 04:29:09 +02:00
|
|
|
|
2021-06-28 05:53:14 +02:00
|
|
|
awful.key({modkey, "Shift" }, "[", shift_by_direction("left", true)),
|
|
|
|
awful.key({modkey, "Shift" }, "]", shift_by_direction("right", true)),
|
|
|
|
awful.key({modkey, "Control"}, "[", shift_by_direction("down", true)),
|
|
|
|
awful.key({modkey, "Control"}, "]", shift_by_direction("up", true)),
|
|
|
|
--▨ swap (directional)
|
2021-06-10 16:44:01 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
awful.key({modkey}, "Insert", expand_horizontal("left")),
|
|
|
|
awful.key({modkey}, "Page_Up", expand_horizontal("right")),
|
|
|
|
awful.key({modkey}, "Home", expand_horizontal("center")),
|
2021-06-28 05:53:14 +02:00
|
|
|
awful.key({modkey}, "Page_Down", expand_vertical),
|
2021-06-11 04:29:09 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
awful.key({modkey}, "End", function()
|
|
|
|
client.focus.maximized_vertical = false
|
|
|
|
client.focus.maximized_horizontal = false
|
|
|
|
awful.client.floating.toggle()
|
2021-06-28 05:53:14 +02:00
|
|
|
end), --|toggle floating status
|
|
|
|
--▨ expand
|
2021-06-11 01:14:42 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
awful.key({modkey}, "Left", focus_by_direction("left")),
|
|
|
|
awful.key({modkey}, "j", focus_by_direction("left")),
|
2021-06-10 20:41:12 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
awful.key({modkey}, "Down", focus_by_direction("down")),
|
|
|
|
awful.key({modkey}, "k", focus_by_direction("down")),
|
2021-06-11 04:29:09 +02:00
|
|
|
|
2021-06-27 08:15:25 +02:00
|
|
|
awful.key({modkey}, "Right", focus_by_direction("right")),
|
2021-06-27 07:48:46 +02:00
|
|
|
awful.key({modkey}, "l", focus_by_direction("right")),
|
2021-06-11 01:14:42 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
awful.key({modkey}, "Up", focus_by_direction("up")),
|
|
|
|
awful.key({modkey}, "i", focus_by_direction("up"))
|
2021-06-28 05:53:14 +02:00
|
|
|
--▨ focus
|
2021-06-27 07:48:46 +02:00
|
|
|
}
|
2021-06-11 07:28:10 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
--------------------------------------------------------------- signals -- ;
|
2021-06-11 07:28:10 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
client.connect_signal("request::activate", function(c)
|
|
|
|
c.hidden = false
|
|
|
|
c:raise()
|
|
|
|
client.focus = c
|
2021-06-28 03:23:53 +02:00
|
|
|
end) --|this is needed to ensure floating stuff becomes
|
|
|
|
--|visible when invoked through run_or_raise
|
2021-06-11 07:28:10 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
client.connect_signal("focus", function(c)
|
|
|
|
if not c.floating then
|
|
|
|
for _, tc in ipairs(screen[awful.screen.focused()].all_clients) do
|
|
|
|
if tc.floating then
|
|
|
|
tc.hidden = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
2021-06-11 07:28:10 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
if c.floating then
|
|
|
|
for _, tc in ipairs(screen[awful.screen.focused()].all_clients) do
|
|
|
|
if tc.floating and not tc.role then
|
|
|
|
tc.hidden = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
2021-06-28 03:23:53 +02:00
|
|
|
end) --|hide all floating windows when the user switches to a
|
|
|
|
--|tiled client. this is handy when you have a floating
|
|
|
|
--|browser open.
|
2021-06-11 07:28:10 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
--------------------------------------------------------------- exports -- ;
|
2021-06-10 16:28:28 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
module = {
|
2021-06-27 08:15:25 +02:00
|
|
|
bindings = bindings
|
|
|
|
}
|
2021-06-10 16:28:28 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
local function new(arg)
|
|
|
|
capi.root.keys(awful.util.table.join(capi.root.keys(), table.unpack(bindings)))
|
|
|
|
return module
|
|
|
|
end
|
2021-06-10 16:28:28 +02:00
|
|
|
|
2021-06-27 07:48:46 +02:00
|
|
|
return setmetatable(module, { __call = function(_,...) return new({...}) end })
|
2021-06-11 07:28:10 +02:00
|
|
|
|
|
|
|
|
2021-06-28 05:53:14 +02:00
|
|
|
-- return module
|
|
|
|
----------------╮
|
|
|
|
--▨ FOCUS ▨
|
|
|
|
----------------╯
|