Replies: 2 comments 2 replies
-
I have also been trying to do this, and unsuccessfully tried a number of things before stumbling upon this discussion. Using the snippet above, I am seeing slightly different behavior: it panics in the event handler when calling wezterm 20240818_002147_24542037 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Have you seen this discussion about centering the window on startup? #5501 wezterm.on("gui-startup", function(cmd)
local screen = wezterm.gui.screens().main
local ratio = 0.7
local width, height = screen.width * ratio, screen.height * ratio
local tab, pane, window = wezterm.mux.spawn_window(cmd or {
position = { x = (screen.width - width) / 2, y = (screen.height - height) / 2 },
})
-- window:gui_window():maximize()
window:gui_window():set_inner_size(width, height)
end) You may be able to start with this and modify to your needs. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What Operating System(s) are you running on?
Linux X11, Linux Wayland, macOS
Which Wayland compositor or X11 Window manager(s) are you using?
Mutter
WezTerm version
20240203-110809-5046fc22
Ask your question!
I'm trying to have WezTerm dynamically resize only at startup based on the size of the monitor it's active on. I know about
config.initial_rows
andconfig.initial_cols
, and I know about `gui_window:set_inner_size(), but I'm having trouble setting these dynamically when WezTerm starts.To start, I'm getting the active screen like this:
If I do this in wezterm.lua outside of a callback, WezTerm hangs as soon as I save and I can't open it anymore, so I don't think I can use it to calculate values for
initial_cols
andinitial_rows
. This makes sense to me, since there wouldn't necessarily be a screen or even a GUI at this point, but I wanted to try it anyway just in case.What I tried, and expect to work, is using the
gui-attached
event. I have this inwezterm.lua
right at the end of my config:Yes, I know this will have undesirable effects if I have multiple WezTerm windows open, but that's incredibly rare for me and I don't see how to get just "this window".
With the callback above, WezTerm does start but doesn't resize. There has to be something I'm missing here, am I calling the wrong function, or is there another event I should be using?
Beta Was this translation helpful? Give feedback.
All reactions