Toggle maximize doesn't unmaximize window on scrolling layout #14380
-
|
The toggle action for maximized windows works as expected on the dwindle layout, but it's not working on the scrolling layout. While the window maximizes correctly, toggling it a second time doesn't restore it to its original size. Am I hitting a bug here or am I just missing something? hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "toggle" })) |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
|
correct. Not implemented. Maximize is a shorthand for expel + width 1 atm |
Beta Was this translation helpful? Give feedback.
-
|
I used to have the following bind: and using scrolling layout. It maximized (and unmaximized) correctly. |
Beta Was this translation helpful? Give feedback.
-
|
Maybe the behavior could be changed like this: if the width is already 1, then restore column_width; otherwise, set the width to 1. |
Beta Was this translation helpful? Give feedback.
-
|
It would be really awesome if this feature could be added back in the future, it's a pretty major disruption of my usual workflow. I often have a bunch of smaller terminal windows in a single column and use fullscreen with mode = "maximize" to zoom into one of them whenever needed (e.g. when reading long lines). With this behavior change there seems to be no way to automatically move the window back to the same vertical position it was in before it was maximized. I have to manually move the window back into the column and then to the desired position. |
Beta Was this translation helpful? Give feedback.
-
|
I found a fairly simple and decent workaround until they fix it internally. hl.config({
scrolling = {
focus_fit_method = 1,
explicit_column_widths = "0.5,1",
},
})
bind("SUPER + F", function()
hl.dispatch(hl.dsp.layout("colresize +conf"))
hl.dispatch(hl.dsp.layout("focus r"))
hl.dispatch(hl.dsp.layout("focus l"))
end, { description = "Toggle active window to maximized (scrolling)" }) |
Beta Was this translation helpful? Give feedback.
-
|
Thanks all for the suggestions. Came across this issue myself under scrolling. I see two issues:
Thanks all, trying to make the move from niri and this is the final piece of my workflow I've not been able to replicate. |
Beta Was this translation helpful? Give feedback.
-
|
I have another (not very robust) temporary workaround, it combines some of @Chachi04 work: local had_left_neighbor = false
hl.bind(mainMod .. " + F", function()
local w = hl.get_active_window()
if w == nil then return end
local win_w = w.width or w.w or (w.size and w.size.x) or (w.size and w.size[1])
local mon = w.monitor
local mon_w = mon and (mon.width or mon.w or (mon.size and mon.size.x))
if not win_w or not mon_w then return end
local ratio = win_w / mon_w
if ratio < 0.85 then
-- About to maximize: check if there's a column to the left by trying
-- to focus left and seeing if the focused window changes.
local before = w
hl.dispatch(hl.dsp.layout("focus l"))
local after = hl.get_active_window()
had_left_neighbor = (after ~= nil and after ~= before)
-- Restore focus to original column before maximizing.
if had_left_neighbor then
hl.dispatch(hl.dsp.layout("focus r"))
end
hl.dispatch(hl.dsp.layout("colresize 1.0"))
else
-- Shrinking: only do the nudge if we had a left neighbor going in.
hl.dispatch(hl.dsp.layout("colresize 0.5"))
if had_left_neighbor then
hl.dispatch(hl.dsp.layout("focus l"))
hl.dispatch(hl.dsp.layout("focus r"))
end
had_left_neighbor = false
end
end)It compares the size of the active window to the active monitor. If the window size is less that 85% of the monitor, it will resize the column to 1.0 making it "maximized". Run the bind again and it will make the column 0.5 (half). It also checks which side of the screen it is so it always returns the window positions correctly It doesn't remember the previous size sadly but it's sufficient for me until it is fixed 🤞 |
Beta Was this translation helpful? Give feedback.
correct. Not implemented. Maximize is a shorthand for expel + width 1 atm