bugunfix
This commit is contained in:
parent
ccbbfcffb3
commit
97b0e691ef
14
init.lua
14
init.lua
|
@ -18,15 +18,27 @@ local move_to = machina.move_to
|
||||||
local toggle_always_on = machina.toggle_always_on
|
local toggle_always_on = machina.toggle_always_on
|
||||||
local teleport_client = machina.teleport_client
|
local teleport_client = machina.teleport_client
|
||||||
local get_client_info = machina.get_client_info
|
local get_client_info = machina.get_client_info
|
||||||
|
local focus_by_index = machina.focus_by_index
|
||||||
|
local focus_by_number = machina.focus_by_number
|
||||||
|
|
||||||
---------------------------------------------------------- key bindings -- ;
|
---------------------------------------------------------- key bindings -- ;
|
||||||
|
|
||||||
local bindings = {
|
local bindings = {
|
||||||
awful.key({altkey}, "Tab", shuffle("backward")),
|
awful.key({altkey},"Tab", shuffle("backward")),
|
||||||
awful.key({altkey, "Shift"}, "Tab", shuffle("forward")),
|
awful.key({altkey, "Shift"}, "Tab", shuffle("forward")),
|
||||||
|
|
||||||
|
-- awful.key({modkey}, "#10", focus_by_number(1)),
|
||||||
|
-- awful.key({modkey}, "#11", focus_by_number(2)),
|
||||||
|
-- awful.key({modkey}, "#12", focus_by_number(3)),
|
||||||
|
-- awful.key({modkey}, "#13", focus_by_number(4)),
|
||||||
|
-- awful.key({modkey}, "#14", focus_by_number(5)),
|
||||||
|
|
||||||
awful.key({modkey}, "[", shuffle("backward")),
|
awful.key({modkey}, "[", shuffle("backward")),
|
||||||
awful.key({modkey}, "]", shuffle("forward")),
|
awful.key({modkey}, "]", shuffle("forward")),
|
||||||
|
--▨ move
|
||||||
|
|
||||||
|
-- awful.key({modkey}, "Tab", focus_by_index("backward")),
|
||||||
|
-- awful.key({modkey, "Shift"}, "Tab", focus_by_index("forward")),
|
||||||
|
|
||||||
awful.key({modkey}, "x", function ()
|
awful.key({modkey}, "x", function ()
|
||||||
c = client.focus or nil
|
c = client.focus or nil
|
||||||
|
|
167
methods.lua
167
methods.lua
|
@ -34,7 +34,12 @@ local function reset_client_meta(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function reset_all_clients(s)
|
||||||
|
local s = s or awful.screen.focused()
|
||||||
|
for i,c in pairs(s.clients) do
|
||||||
|
reset_client_meta(c)
|
||||||
|
end
|
||||||
|
end
|
||||||
------------------------------------------------------------- go_edge() -- ;
|
------------------------------------------------------------- go_edge() -- ;
|
||||||
|
|
||||||
local function go_edge(direction, regions, current_box)
|
local function go_edge(direction, regions, current_box)
|
||||||
|
@ -276,23 +281,36 @@ local function move_to(location)
|
||||||
end
|
end
|
||||||
|
|
||||||
useless_gap = getlowest(edges.x)
|
useless_gap = getlowest(edges.x)
|
||||||
client.focus:geometry(geoms[location](useless_gap))
|
|
||||||
|
|
||||||
|
if client.focus.floating then
|
||||||
|
client.focus:geometry(geoms[location](useless_gap))
|
||||||
|
end
|
||||||
|
|
||||||
if not client.focus.floating then
|
if not client.focus.floating then
|
||||||
|
|
||||||
|
-- todo: set actual destination region geometry
|
||||||
|
-- this is not okay and buggy
|
||||||
|
-- or at least set it up to use directional shifting
|
||||||
|
-- to match left, right, center
|
||||||
|
|
||||||
|
local tobe_geom = geoms[location](useless_gap)
|
||||||
|
tobe_geom.width = 300
|
||||||
|
tobe_geom.height = 600
|
||||||
|
|
||||||
|
local tobe = {
|
||||||
|
region=get_client_info(client.focus).active_region,
|
||||||
|
}
|
||||||
|
|
||||||
|
client.focus:geometry(tobe_geom)
|
||||||
|
|
||||||
resize_region_to_index(is.region, is.region_geom, true)
|
resize_region_to_index(is.region, is.region_geom, true)
|
||||||
|
|
||||||
local tobe = {
|
|
||||||
region=get_client_info(client.focus).active_region
|
|
||||||
}
|
|
||||||
draw_tabbar(is.region)
|
draw_tabbar(is.region)
|
||||||
|
|
||||||
gears.timer.delayed_call(function ()
|
gears.timer.delayed_call(function ()
|
||||||
client.focus.region = tobe.region
|
client.focus.region = tobe.region
|
||||||
draw_tabbar(tobe.region)
|
draw_tabbar(tobe.region)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end --| redraw tabs and update meta
|
end --| redraw tabs and update meta
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -319,9 +337,8 @@ local function get_punched_clients(region_ix, s)
|
||||||
|
|
||||||
if #region_clients == 0 then
|
if #region_clients == 0 then
|
||||||
for i, w in ipairs(s.clients) do
|
for i, w in ipairs(s.clients) do
|
||||||
if not (w.floating) then
|
if not w.floating then
|
||||||
if (w.region == region_ix)
|
if w.region == region_ix then
|
||||||
then
|
|
||||||
region_clients[#region_clients + 1] = w
|
region_clients[#region_clients + 1] = w
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -365,11 +382,11 @@ local function get_clients_in_region(region_ix, c, s)
|
||||||
math.abs(regions[active_region].x - w.x) <= 5 and
|
math.abs(regions[active_region].x - w.x) <= 5 and
|
||||||
math.abs(regions[active_region].y - w.y) <= 5
|
math.abs(regions[active_region].y - w.y) <= 5
|
||||||
)
|
)
|
||||||
or
|
-- or
|
||||||
(
|
-- (
|
||||||
regions[active_region].x ~= w.x and
|
-- regions[active_region].x ~= w.x and
|
||||||
w.region == region_ix
|
-- w.region == region_ix
|
||||||
) --|handle resizing left expanded regions
|
-- ) --|handle resizing left expanded regions
|
||||||
then
|
then
|
||||||
region_clients[#region_clients + 1] = w
|
region_clients[#region_clients + 1] = w
|
||||||
w.region = region_ix
|
w.region = region_ix
|
||||||
|
@ -660,6 +677,63 @@ end
|
||||||
|
|
||||||
---------------------------------------------------------- my_shifter() -- ;
|
---------------------------------------------------------- my_shifter() -- ;
|
||||||
|
|
||||||
|
local function focus_by_number(region_ix,s)
|
||||||
|
return function()
|
||||||
|
local s = s or awful.screen.focused()
|
||||||
|
local regions = get_regions(s)
|
||||||
|
|
||||||
|
local target_region_ix
|
||||||
|
local target_region
|
||||||
|
|
||||||
|
local swapee = get_swapee(region_ix)
|
||||||
|
--|visible client at the target region
|
||||||
|
|
||||||
|
swapee:emit_signal("request::activate", "mouse_enter",{raise = true})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function focus_by_index(direction)
|
||||||
|
return function()
|
||||||
|
|
||||||
|
if direction == "left" then direction = "backward" end
|
||||||
|
if direction == "right" then direction = "forward" end
|
||||||
|
|
||||||
|
local c = client.focus
|
||||||
|
local stuff = get_client_info()
|
||||||
|
local client_region_ix = stuff.active_region
|
||||||
|
local source_region
|
||||||
|
local target_region_ix
|
||||||
|
local target_region
|
||||||
|
|
||||||
|
c = reset_client_meta(c)
|
||||||
|
--|clean artifacts in case client was expanded.
|
||||||
|
|
||||||
|
if direction == "backward" then
|
||||||
|
if (client_region_ix + 1) > #stuff.regions then
|
||||||
|
target_region_ix = 1
|
||||||
|
else
|
||||||
|
target_region_ix = client_region_ix+1
|
||||||
|
end
|
||||||
|
end --|go next region by index,
|
||||||
|
--|if not reset to first
|
||||||
|
|
||||||
|
if direction == "forward" then
|
||||||
|
if (client_region_ix - 1) < 1 then
|
||||||
|
target_region_ix = #stuff.regions
|
||||||
|
else
|
||||||
|
target_region_ix = client_region_ix - 1
|
||||||
|
end
|
||||||
|
end --|go previous region by index,
|
||||||
|
--|if not reset to last
|
||||||
|
|
||||||
|
local swapee = get_swapee(target_region_ix)
|
||||||
|
--|visible client at the target region
|
||||||
|
|
||||||
|
swapee:emit_signal("request::activate", "mouse_enter",{raise = true})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function my_shifter(direction, swap)
|
local function my_shifter(direction, swap)
|
||||||
return function()
|
return function()
|
||||||
|
|
||||||
|
@ -851,7 +925,7 @@ function draw_tabbar(region_ix, s)
|
||||||
local s = s or awful.screen.focused()
|
local s = s or awful.screen.focused()
|
||||||
local flexlist = tabs.layout()
|
local flexlist = tabs.layout()
|
||||||
local tablist = get_tiled_clients(region_ix, s)
|
local tablist = get_tiled_clients(region_ix, s)
|
||||||
|
|
||||||
if tablelength(tablist) == 0 then
|
if tablelength(tablist) == 0 then
|
||||||
return
|
return
|
||||||
end --|this should only fire on an empty region
|
end --|this should only fire on an empty region
|
||||||
|
@ -975,6 +1049,10 @@ end
|
||||||
------------------------------------------------------ signal helpers -- ;
|
------------------------------------------------------ signal helpers -- ;
|
||||||
|
|
||||||
local function manage_signal(c)
|
local function manage_signal(c)
|
||||||
|
reset_all_clients(s)
|
||||||
|
--|reset hack, we shouldn't need this in the second write
|
||||||
|
--|up.
|
||||||
|
|
||||||
if c.data.awful_client_properties then
|
if c.data.awful_client_properties then
|
||||||
local ci = get_client_info(c)
|
local ci = get_client_info(c)
|
||||||
--|client info
|
--|client info
|
||||||
|
@ -1100,12 +1178,17 @@ end -- todo: need to update the other clients in the region here as well
|
||||||
-- tabs a lot making it harder to distinguish what is what.
|
-- tabs a lot making it harder to distinguish what is what.
|
||||||
-- client.connect_signal("property::name", name_signal)
|
-- client.connect_signal("property::name", name_signal)
|
||||||
|
|
||||||
|
----------------------------------------------------;
|
||||||
|
|
||||||
local function riseup_signal(c)
|
local function riseup_signal(c)
|
||||||
client.focus = c; c:raise()
|
client.focus = c; c:raise()
|
||||||
-- c:emit_signal("request::activate", "mouse_enter",{raise = true})
|
-- c:emit_signal("request::activate", "mouse_enter",{raise = true})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
----------------------------------------------------;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------- signals -- ;
|
--------------------------------------------------------------- signals -- ;
|
||||||
|
|
||||||
|
@ -1138,6 +1221,8 @@ module = {
|
||||||
update_global_clients = update_global_clients,
|
update_global_clients = update_global_clients,
|
||||||
get_client_info = get_client_info,
|
get_client_info = get_client_info,
|
||||||
teleport_client = teleport_client,
|
teleport_client = teleport_client,
|
||||||
|
focus_by_index = focus_by_index,
|
||||||
|
focus_by_number = focus_by_number
|
||||||
}
|
}
|
||||||
|
|
||||||
return module
|
return module
|
||||||
|
@ -1145,6 +1230,56 @@ return module
|
||||||
|
|
||||||
--[[ ------------------------------------------------- NOTES ]
|
--[[ ------------------------------------------------- NOTES ]
|
||||||
|
|
||||||
|
[0] todo: rewrite the whole thing, but plan ahead this
|
||||||
|
time.
|
||||||
|
|
||||||
|
- get regions from machi, this will give us indexes
|
||||||
|
- manage signal will mark the global index and punch
|
||||||
|
the region_id to the client.
|
||||||
|
- it will then draw tabs to the region
|
||||||
|
|
||||||
|
region_expansions:
|
||||||
|
|
||||||
|
- regions can be expanded using the maximixed trick.
|
||||||
|
- it will change the geometry of all the clients in
|
||||||
|
that region.
|
||||||
|
- redrawing the tabbar is not necessary.
|
||||||
|
- when toggling, region geometry will also change.
|
||||||
|
|
||||||
|
|
||||||
|
functions needed:
|
||||||
|
|
||||||
|
- get_region(region_id, screen)
|
||||||
|
|
||||||
|
- get_regions(screen)
|
||||||
|
|
||||||
|
- get_clients_in_region(region_id, screen): this would
|
||||||
|
need to return the ordered list of all the clients
|
||||||
|
in the region from the global client list.
|
||||||
|
|
||||||
|
there are multiple strategies that can be used:
|
||||||
|
|
||||||
|
c.region_id:
|
||||||
|
this wil flap during reload
|
||||||
|
|
||||||
|
geometric comparison: we can compare all client
|
||||||
|
geometry to regions geometry. but it will fail for
|
||||||
|
expanded/overflowing clients.
|
||||||
|
|
||||||
|
- draw_tabbar(region, screen): it will draw tabbars
|
||||||
|
for all the clients in the region.
|
||||||
|
|
||||||
|
- expand_region(direction, region, screen): it will
|
||||||
|
expand all the clients in the region. same shortcut
|
||||||
|
will reset the expansions. expansions will happen
|
||||||
|
in multiple directions, and "center".
|
||||||
|
|
||||||
|
MPV: it appears client flashing could also be an issue.
|
||||||
|
MPV for instance starts large briefly and causes an
|
||||||
|
update in the wrong region. We need a region.id lookup
|
||||||
|
only it seems. We should also consider reading awm rules
|
||||||
|
for a region id for placement.
|
||||||
|
|
||||||
[4] machi's own region expansion has issues on
|
[4] machi's own region expansion has issues on
|
||||||
awesome-reload. if we were to expand a region, and then
|
awesome-reload. if we were to expand a region, and then
|
||||||
do reload, machi-layout would insist to keep the expanded
|
do reload, machi-layout would insist to keep the expanded
|
||||||
|
|
Loading…
Reference in New Issue