expansions
This commit is contained in:
parent
63be63f5fd
commit
ad27f4a46f
|
@ -66,6 +66,7 @@ end
|
||||||
geoms.clients = {
|
geoms.clients = {
|
||||||
Subl=geoms.p1080,
|
Subl=geoms.p1080,
|
||||||
Byobu=geoms.p720,
|
Byobu=geoms.p720,
|
||||||
|
Krom=geoms.crt43,
|
||||||
}
|
}
|
||||||
|
|
||||||
return geoms
|
return geoms
|
13
helpers.lua
13
helpers.lua
|
@ -83,17 +83,6 @@ local function get_client_ix(id, ids)
|
||||||
end
|
end
|
||||||
end --|finds out where id is located inside ids.
|
end --|finds out where id is located inside ids.
|
||||||
|
|
||||||
local function clear_tabbar(c, position)
|
|
||||||
if not c then return end
|
|
||||||
|
|
||||||
position = position or "bottom"
|
|
||||||
local titlebar = awful.titlebar(c, {size=3, position=position})
|
|
||||||
awful.titlebar(c, {size=0, position="left"})
|
|
||||||
awful.titlebar(c, {size=0, position="right"})
|
|
||||||
titlebar:setup{
|
|
||||||
layout=wibox.layout.flex.horizontal, nil
|
|
||||||
}
|
|
||||||
end --|clears bottom tabbar
|
|
||||||
|
|
||||||
-------------------------------------------------------------- exports -- ;
|
-------------------------------------------------------------- exports -- ;
|
||||||
|
|
||||||
|
@ -104,7 +93,7 @@ return {
|
||||||
getlowest = getlowest,
|
getlowest = getlowest,
|
||||||
get_client_ix = get_client_ix,
|
get_client_ix = get_client_ix,
|
||||||
reload = reload,
|
reload = reload,
|
||||||
clear_tabbar = clear_tabbar
|
-- clear_tabbar = clear_tabbar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
13
init.lua
13
init.lua
|
@ -19,12 +19,16 @@ local toggle_always_on = machina.toggle_always_on
|
||||||
---------------------------------------------------------- key bindings -- ;
|
---------------------------------------------------------- key bindings -- ;
|
||||||
|
|
||||||
local bindings = {
|
local bindings = {
|
||||||
awful.key({modkey}, "[", my_shifter("backward")),
|
awful.key({modkey}, "[", shuffle("backward")),
|
||||||
awful.key({modkey}, "]", my_shifter("forward")),
|
awful.key({modkey}, "]", shuffle("forward")),
|
||||||
|
--▨ shuffle
|
||||||
|
|
||||||
|
awful.key({modkey, "Shift"}, "[", my_shifter("backward")),
|
||||||
|
awful.key({modkey, "Shift"}, "]", my_shifter("forward")),
|
||||||
--▨ move
|
--▨ move
|
||||||
|
|
||||||
awful.key({modkey, "Shift"}, "[", my_shifter("backward", "swap")),
|
awful.key({modkey, "Control"}, "[", my_shifter("backward", "swap")),
|
||||||
awful.key({modkey, "Shift"}, "]", my_shifter("forward", "swap")),
|
awful.key({modkey, "Control"}, "]", my_shifter("forward", "swap")),
|
||||||
--▨ swap
|
--▨ swap
|
||||||
|
|
||||||
awful.key({modkey}, ";", shuffle("backward")),
|
awful.key({modkey}, ";", shuffle("backward")),
|
||||||
|
@ -70,6 +74,7 @@ local bindings = {
|
||||||
awful.key({modkey, "Shift"}, "End", toggle_always_on),
|
awful.key({modkey, "Shift"}, "End", toggle_always_on),
|
||||||
awful.key({modkey, "Shift"}, "Home", move_to("center")),
|
awful.key({modkey, "Shift"}, "Home", move_to("center")),
|
||||||
|
|
||||||
|
-- awful.key({mondkey}, "u", )
|
||||||
awful.key({modkey,}, "o", function ()
|
awful.key({modkey,}, "o", function ()
|
||||||
c = client.focus
|
c = client.focus
|
||||||
if not c then return true end
|
if not c then return true end
|
||||||
|
|
149
methods.lua
149
methods.lua
|
@ -25,6 +25,25 @@ function update_global_clients(c)
|
||||||
global_client_table[c.window] = c
|
global_client_table[c.window] = c
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function log(m,context)
|
||||||
|
naughty.notify({text=inspect(m) .. " :" .. context })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function clear_tabbar(c, position)
|
||||||
|
-- log(position, " clear_tab_bar_invoked ")
|
||||||
|
|
||||||
|
if not c then return end
|
||||||
|
|
||||||
|
position = position or "bottom"
|
||||||
|
local titlebar = awful.titlebar(c, {size=3, position=position})
|
||||||
|
awful.titlebar(c, {size=0, position="left"})
|
||||||
|
awful.titlebar(c, {size=0, position="right"})
|
||||||
|
titlebar:setup{
|
||||||
|
layout=wibox.layout.flex.horizontal, nil
|
||||||
|
}
|
||||||
|
end --|clears bottom tabbar
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------- go_edge() -- ;
|
------------------------------------------------------------- go_edge() -- ;
|
||||||
|
|
||||||
local function go_edge(direction, regions, current_box)
|
local function go_edge(direction, regions, current_box)
|
||||||
|
@ -88,6 +107,7 @@ local function get_regions()
|
||||||
|
|
||||||
if layout.machi_get_instance_data then
|
if layout.machi_get_instance_data then
|
||||||
machi_fn = layout.machi_get_instance_data
|
machi_fn = layout.machi_get_instance_data
|
||||||
|
machi_geom = layout.machi_set_geometry
|
||||||
machi_data = {machi_fn(screen[focused_screen], selected_tag)}
|
machi_data = {machi_fn(screen[focused_screen], selected_tag)}
|
||||||
machi_regions = machi_data[3]
|
machi_regions = machi_data[3]
|
||||||
|
|
||||||
|
@ -218,6 +238,43 @@ end
|
||||||
|
|
||||||
------------------------------------------------------ region_tablist() -- ;
|
------------------------------------------------------ region_tablist() -- ;
|
||||||
|
|
||||||
|
local function test_tablist(region_ix, c)
|
||||||
|
local focused_screen = awful.screen.focused()
|
||||||
|
local workarea = awful.screen.focused().workarea
|
||||||
|
local selected_tag = awful.screen.focused().selected_tag
|
||||||
|
local tablist = {}
|
||||||
|
local active_region = region_ix or nil
|
||||||
|
local source_client = c or client.focus or nil
|
||||||
|
local regions = get_regions()
|
||||||
|
|
||||||
|
all_client = get_global_clients()
|
||||||
|
|
||||||
|
if not active_region then
|
||||||
|
for i, a in ipairs(regions) do
|
||||||
|
if a.x <= source_client.x and source_client.x < a.x + a.width and
|
||||||
|
a.y <= source_client.y and source_client.y < a.y + a.height
|
||||||
|
then
|
||||||
|
active_region = i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end --|if no region index provided, find the region of the
|
||||||
|
--|focused_client.
|
||||||
|
|
||||||
|
|
||||||
|
region_clients = {}
|
||||||
|
for i, cc in pairs(all_client) do
|
||||||
|
if cc.region == active_region and regions[active_region].x == cc.x
|
||||||
|
and regions[active_region].y == cc.y
|
||||||
|
then
|
||||||
|
region_clients[#region_clients + 1] = cc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return region_clients
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function region_tablist(region_ix, c)
|
local function region_tablist(region_ix, c)
|
||||||
local focused_screen = awful.screen.focused()
|
local focused_screen = awful.screen.focused()
|
||||||
local workarea = awful.screen.focused().workarea
|
local workarea = awful.screen.focused().workarea
|
||||||
|
@ -281,6 +338,7 @@ local function expand_horizontal(direction)
|
||||||
c.maximized_horizontal = false
|
c.maximized_horizontal = false
|
||||||
c.maximized_vertical = false
|
c.maximized_vertical = false
|
||||||
draw_tabbar(c.region)
|
draw_tabbar(c.region)
|
||||||
|
resize_region(c.region, c:geometry(), true)
|
||||||
return
|
return
|
||||||
end --|reset toggle when sending same shortcut
|
end --|reset toggle when sending same shortcut
|
||||||
--|consequitively
|
--|consequitively
|
||||||
|
@ -294,19 +352,33 @@ local function expand_horizontal(direction)
|
||||||
if direction == "right" then
|
if direction == "right" then
|
||||||
tobe = {
|
tobe = {
|
||||||
x=c.x,
|
x=c.x,
|
||||||
width=math.abs(stuff.regions[target].x + stuff.regions[target].width - c.x - 5),
|
width=math.abs(stuff.regions[target].x + stuff.regions[target].width - c.x - 4),
|
||||||
height=c.height,
|
height=c.height,
|
||||||
y=c.y
|
y=c.y
|
||||||
}
|
}
|
||||||
|
|
||||||
c.direction = direction
|
c.direction = direction
|
||||||
c.maximized_horizontal = true
|
c.maximized_horizontal = true
|
||||||
c.maximixed_vertical = false
|
c.maximixed_vertical = false
|
||||||
|
|
||||||
gears.timer.delayed_call(function ()
|
-- if not c.floating then
|
||||||
client.focus:geometry(tobe)
|
-- awful.layout.get(focused_screen).machi_zort(c, tobe)
|
||||||
|
-- instance_data = awful.layout.get(
|
||||||
|
-- awful.screen.focused())
|
||||||
|
-- .machi_get_instance_data(awful.screen.focused(), awful.screen.selected_tag)
|
||||||
|
-- naughty.notify({text=inspect(instance_data)})
|
||||||
|
|
||||||
|
-- instance_data[c] = {
|
||||||
|
-- lu=0, rd=0
|
||||||
|
-- }
|
||||||
|
-- end
|
||||||
|
|
||||||
|
gears.timer.delayed_call(function (c)
|
||||||
|
c:geometry(tobe)
|
||||||
draw_tabbar(c.region)
|
draw_tabbar(c.region)
|
||||||
clear_tabbar(c)
|
resize_region(c.region, tobe, {horizontal=true,vertical=false,direction=direction})
|
||||||
end)
|
-- clear_tabbar(c)
|
||||||
|
end,c)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -322,11 +394,11 @@ local function expand_horizontal(direction)
|
||||||
c.maximized_horizontal = true
|
c.maximized_horizontal = true
|
||||||
c.maximixed_vertical = false
|
c.maximixed_vertical = false
|
||||||
|
|
||||||
gears.timer.delayed_call(function ()
|
gears.timer.delayed_call(function (c)
|
||||||
client.focus:geometry(tobe)
|
client.focus:geometry(tobe)
|
||||||
draw_tabbar(c.region)
|
draw_tabbar(c.region)
|
||||||
clear_tabbar(c)
|
clear_tabbar(c)
|
||||||
end)
|
end,c)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -349,16 +421,18 @@ local function expand_horizontal(direction)
|
||||||
|
|
||||||
if fixedchoice then
|
if fixedchoice then
|
||||||
c.direction = "center"
|
c.direction = "center"
|
||||||
|
c.maximized_horizontal = true
|
||||||
geom = fixedchoice()
|
geom = fixedchoice()
|
||||||
end
|
end
|
||||||
|
|
||||||
gears.timer.delayed_call(function ()
|
c:geometry(geom)
|
||||||
client.focus:geometry(geom)
|
awful.placement.centered(c)
|
||||||
awful.placement.centered(client.focus)
|
|
||||||
client.focus:raise()
|
gears.timer.delayed_call(function (c)
|
||||||
draw_tabbar(c.region)
|
c:raise()
|
||||||
|
client.emit_signal("tabbar_draw", c.region)
|
||||||
clear_tabbar(c)
|
clear_tabbar(c)
|
||||||
end) --|give it time in case maximize_horizontal is
|
end,c) --|give it time in case maximize_horizontal is
|
||||||
--|adjusted before centering
|
--|adjusted before centering
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -421,7 +495,7 @@ local function expand_vertical()
|
||||||
c.maximized_vertical = true
|
c.maximized_vertical = true
|
||||||
|
|
||||||
gears.timer.delayed_call(function ()
|
gears.timer.delayed_call(function ()
|
||||||
client.focus:geometry(tobe)
|
client.focus:geometry(tobe)
|
||||||
client.focus:raise()
|
client.focus:raise()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -434,6 +508,7 @@ local function shuffle(direction)
|
||||||
return function()
|
return function()
|
||||||
local tablist = get_tiled_clients()
|
local tablist = get_tiled_clients()
|
||||||
--|this is the ordered list
|
--|this is the ordered list
|
||||||
|
|
||||||
|
|
||||||
if not #tablist then return end
|
if not #tablist then return end
|
||||||
--▨ flow control
|
--▨ flow control
|
||||||
|
@ -500,6 +575,14 @@ end
|
||||||
|
|
||||||
---------------------------------------------------------- my_shifter() -- ;
|
---------------------------------------------------------- my_shifter() -- ;
|
||||||
|
|
||||||
|
local function reset_client_meta(c)
|
||||||
|
c.maximized = false
|
||||||
|
c.maximized_horizontal = false
|
||||||
|
c.maximized_vertical = false
|
||||||
|
c.direction = nil
|
||||||
|
return c
|
||||||
|
end
|
||||||
|
|
||||||
local function my_shifter(direction, swap)
|
local function my_shifter(direction, swap)
|
||||||
return function()
|
return function()
|
||||||
|
|
||||||
|
@ -513,6 +596,9 @@ local function my_shifter(direction, swap)
|
||||||
local target_region_ix
|
local target_region_ix
|
||||||
local target_region
|
local target_region
|
||||||
|
|
||||||
|
c = reset_client_meta(c)
|
||||||
|
--|clean artifacts in case client was expanded.
|
||||||
|
|
||||||
if direction == "backward" then
|
if direction == "backward" then
|
||||||
if (client_region_ix + 1) > #stuff.regions then
|
if (client_region_ix + 1) > #stuff.regions then
|
||||||
target_region_ix = 1
|
target_region_ix = 1
|
||||||
|
@ -547,6 +633,9 @@ local function my_shifter(direction, swap)
|
||||||
c:geometry(target_region)
|
c:geometry(target_region)
|
||||||
--|relocate client
|
--|relocate client
|
||||||
|
|
||||||
|
c.region = target_region_ix
|
||||||
|
--|update client property
|
||||||
|
|
||||||
if not swap then c:raise() end
|
if not swap then c:raise() end
|
||||||
--|raise
|
--|raise
|
||||||
|
|
||||||
|
@ -556,9 +645,11 @@ local function my_shifter(direction, swap)
|
||||||
end --|perform swap
|
end --|perform swap
|
||||||
|
|
||||||
draw_tabbar(target_region_ix)
|
draw_tabbar(target_region_ix)
|
||||||
|
resize_region(target_region_ix, target_region, true)
|
||||||
--|update tabs in target region
|
--|update tabs in target region
|
||||||
|
|
||||||
draw_tabbar(client_region_ix)
|
draw_tabbar(client_region_ix)
|
||||||
|
resize_region(client_region_ix, source_region, true)
|
||||||
--|update tabs in source region
|
--|update tabs in source region
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -597,7 +688,6 @@ local function shift_by_direction(direction, swap)
|
||||||
target_region_ix = go_edge(try, stuff.regions, client.focus:geometry())
|
target_region_ix = go_edge(try, stuff.regions, client.focus:geometry())
|
||||||
end --|go the beginning or the end if there is no
|
end --|go the beginning or the end if there is no
|
||||||
--|candidate
|
--|candidate
|
||||||
|
|
||||||
|
|
||||||
source_region = stuff.regions[client_region_ix]
|
source_region = stuff.regions[client_region_ix]
|
||||||
target_region = stuff.regions[target_region_ix]
|
target_region = stuff.regions[target_region_ix]
|
||||||
|
@ -608,6 +698,9 @@ local function shift_by_direction(direction, swap)
|
||||||
c:geometry(target_region)
|
c:geometry(target_region)
|
||||||
--|relocate client
|
--|relocate client
|
||||||
|
|
||||||
|
c.region = target_region_ix
|
||||||
|
--|update client property
|
||||||
|
|
||||||
if not swap then c:raise() end
|
if not swap then c:raise() end
|
||||||
--|raise
|
--|raise
|
||||||
|
|
||||||
|
@ -617,9 +710,11 @@ local function shift_by_direction(direction, swap)
|
||||||
end --|perform swap
|
end --|perform swap
|
||||||
|
|
||||||
draw_tabbar(target_region_ix)
|
draw_tabbar(target_region_ix)
|
||||||
|
resize_region(target_region_ix, target_region, true)
|
||||||
--|update tabs in target region
|
--|update tabs in target region
|
||||||
|
|
||||||
draw_tabbar(client_region_ix)
|
draw_tabbar(client_region_ix)
|
||||||
|
resize_region(client_region_ix, source_region, true)
|
||||||
--|update tabs in source region
|
--|update tabs in source region
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -627,8 +722,7 @@ end
|
||||||
----------------------------------------------------- get_tiled_clients -- ;
|
----------------------------------------------------- get_tiled_clients -- ;
|
||||||
|
|
||||||
function get_tiled_clients(region_ix)
|
function get_tiled_clients(region_ix)
|
||||||
local tablist = region_tablist(region_ix)
|
local tablist = test_tablist(region_ix)
|
||||||
|
|
||||||
local all_clients = get_global_clients()
|
local all_clients = get_global_clients()
|
||||||
local tiled_clients = {}
|
local tiled_clients = {}
|
||||||
local myorder = {}
|
local myorder = {}
|
||||||
|
@ -648,7 +742,7 @@ function get_tiled_clients(region_ix)
|
||||||
|
|
||||||
return tiled_clients
|
return tiled_clients
|
||||||
end
|
end
|
||||||
--[[+
|
--[[+]
|
||||||
global_client_index stores the ordered list of all clients
|
global_client_index stores the ordered list of all clients
|
||||||
available and it is used as a blueprint to keep the order
|
available and it is used as a blueprint to keep the order
|
||||||
of our tablist intact, without this, tabbars would go out
|
of our tablist intact, without this, tabbars would go out
|
||||||
|
@ -677,6 +771,7 @@ function draw_tabbar(region_ix)
|
||||||
local buttons = gears.table.join(awful.button({}, 1, function() end))
|
local buttons = gears.table.join(awful.button({}, 1, function() end))
|
||||||
wid_temp = tabs.create(cc, (cc == c), buttons, c_ix)
|
wid_temp = tabs.create(cc, (cc == c), buttons, c_ix)
|
||||||
flexlist:add(wid_temp)
|
flexlist:add(wid_temp)
|
||||||
|
flexlist.max_widget_size = 120
|
||||||
end
|
end
|
||||||
|
|
||||||
local titlebar = awful.titlebar(c, {
|
local titlebar = awful.titlebar(c, {
|
||||||
|
@ -692,6 +787,19 @@ function draw_tabbar(region_ix)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function resize_region(region_ix, geom, reset)
|
||||||
|
local tablist = get_tiled_clients(region_ix)
|
||||||
|
for c_ix, c in ipairs(tablist) do
|
||||||
|
if reset == true then
|
||||||
|
reset_client_meta(c)
|
||||||
|
else
|
||||||
|
c.maximized_horizontal = reset.horizontal
|
||||||
|
c.maximized_vertical = reset.vertical
|
||||||
|
c.direction = reset.direction
|
||||||
|
end
|
||||||
|
c:geometry(geom)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
------------------------------------------------------ signal helpers -- ;
|
------------------------------------------------------ signal helpers -- ;
|
||||||
|
|
||||||
|
@ -754,6 +862,7 @@ local function floating_signal(c)
|
||||||
end --|window became tiled
|
end --|window became tiled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------- signals -- ;
|
--------------------------------------------------------------- signals -- ;
|
||||||
|
|
||||||
client.connect_signal("property::minimized", function(c)
|
client.connect_signal("property::minimized", function(c)
|
||||||
|
@ -762,7 +871,6 @@ client.connect_signal("property::minimized", function(c)
|
||||||
end)
|
end)
|
||||||
--[[+] manage minimized and not minimized ]]
|
--[[+] manage minimized and not minimized ]]
|
||||||
|
|
||||||
|
|
||||||
client.connect_signal("property::floating", floating_signal)
|
client.connect_signal("property::floating", floating_signal)
|
||||||
--[[+]
|
--[[+]
|
||||||
when windows switch between float and tiled we must
|
when windows switch between float and tiled we must
|
||||||
|
@ -771,6 +879,9 @@ client.connect_signal("property::floating", floating_signal)
|
||||||
clients become tiled to give awm enough time to draw the
|
clients become tiled to give awm enough time to draw the
|
||||||
widgets properly.]]
|
widgets properly.]]
|
||||||
|
|
||||||
|
client.connect_signal("tabbar_draw", draw_tabbar)
|
||||||
|
--[[+] experimental signalling ]]
|
||||||
|
|
||||||
client.connect_signal("unmanage", unmanage_signal)
|
client.connect_signal("unmanage", unmanage_signal)
|
||||||
--[[+]
|
--[[+]
|
||||||
when removing a tiled client we must update the tabbars
|
when removing a tiled client we must update the tabbars
|
||||||
|
|
1
tabs.lua
1
tabs.lua
|
@ -30,6 +30,7 @@ local function create(c, focused_bool, buttons, idx)
|
||||||
end
|
end
|
||||||
|
|
||||||
local text_temp = wibox.widget.textbox()
|
local text_temp = wibox.widget.textbox()
|
||||||
|
|
||||||
text_temp.align = "center"
|
text_temp.align = "center"
|
||||||
text_temp.valign = "center"
|
text_temp.valign = "center"
|
||||||
text_temp.wrap = "word"
|
text_temp.wrap = "word"
|
||||||
|
|
Loading…
Reference in New Issue