Open valpackett opened 3 years ago
I would also like this feature.
On st
I used the anysize patch to center the content of the terminal window on my tiling wm.
Currently I am using:
local center_content = function(window, pane)
local win_dim = window:get_dimensions()
local tab_dim = pane:tab():get_size()
local overrides = window:get_config_overrides() or {}
local padding_left = (win_dim.pixel_width - tab_dim.pixel_width) / 2
local padding_top = (win_dim.pixel_height - tab_dim.pixel_height) / 2
local new_padding = {
left = padding_left,
right = 0,
top = padding_top,
bottom = 0,
}
if overrides.window_padding and new_padding.left == overrides.window_padding.left then
return
end
overrides.window_padding = new_padding
window:set_config_overrides(overrides)
end
wezterm.on('window-resized', center_content)
wezterm.on('window-config-reloaded', center_content)
This is interesting. How would a use the above in my 3 pane setup (below) to add padding to my top right (terminal) split? Currently it's a bit far to the left and looks a bit out of place against my centred Neovim main pane and auto-sized Bottom right split
-- Startup using 3 panes, lvim, wezterm and btm
wezterm.on("gui-startup", function(cmd)
local tab, pane, window = mux.spawn_window(cmd or {
args = { "/opt/homebrew/bin/fish", "-c", "/Users/Karim/.local/bin/lvim" },
})
window:gui_window():toggle_fullscreen()
-- Create a right side pane
local right_pane = pane:split { direction = "Right", size = 0.4 }
-- Split right pane into two, with new pane on bottom
local bottom_pane = right_pane:split { direction = "Bottom", size = 0.9, args = { "/opt/homebrew/bin/btm" } }
-- Activate primary left pane
pane:activate()
end)
I really would like an option to "center" the terminal inside whatever padding you had set. Right now all the excess padding goes to the right and bottom. The idea way for this to work is you set your padding and then any extra padding is divided equally between opposite sides.
FWIW, if you enable https://wezfurlong.org/wezterm/config/lua/config/use_resize_increments.html you will be less likely to have any excess padding. This works best under X11 and macOS, but has no effect on Windows.
FWIW, if you enable https://wezfurlong.org/wezterm/config/lua/config/use_resize_increments.html you will be less likely to have any excess padding. This works best under X11 and macOS, but has no effect on Windows.
Thank you for this! Unfortunately, I usually work in a fullscreen terminal window, so this is not a 100% solution for me.
I would like to note that on MacOS use_resize_increments
interacts a bit weirdly with Raycast's "Maximize". It would appear that Raycast sets the window as large as possible, but this ends up being scaled back to some increment that fits an exact number of cells, which often leaves a small strip of the background peeking through along the bottom. This looks like intended behavior, but is annoying nonetheless.
Is your feature request related to a problem? Please describe.
Unlike #291 I just want to be able to center the content in the window to avoid ugly asymmetrical padding on the bottom and right sides of the window. Or even align it to be horizontally centered but vertically always sticking to the bottom edge.
(BTW even if/when there would be snap-to-character-grid resizing, there would still be fullscreen/maximized mode…)
Describe the solution you'd like
It is sort of possible to achieve with scripting…
…but only with hardcoded cell size. So, I guess there should be a Lua call for getting character grid cell dimensions!
Describe alternatives you've considered
Or make this just a built-in mode (flag) to avoid having stuff in configs.