-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize initial size for quick terminal #2384
Comments
We have a precedent for supporting multiple units within a single config, so my preference would be something like the following:
Example valid values:
Thoughts? |
It is macOS only. |
Sounds good to me. This approach is simple enough to allow configuration on one dimension by default, while remaining flexible enough to support full customization of both axes. My only feedback would be that mixing units feels a bit unintuitive but I’m not opposed to it at all, especially since we already have existing precedents for handling mixed units. |
I agree, I'd hope people don't do it, but I don't see a reason to outright reject it. |
I should add: I imagine people will want different aligned quick terminals too. My proposal with |
Marking this as accepted, if someone wants to PR it as proposed I will accept it. I'm still open to further feedback though. |
Quick question: Should the parsing and validation of |
It should go in |
Good call on And...
Agreed on that part, I think unless it turns out to be super easy to implement multi-value, the initial implementation can be single value only, and then multi-value support later on. As for mixing units, The only other thing I'd suggest as part of this... unless I missed something, the docs don't explicitly mention that this is a macOS only feature. So I'd also suggest updating the docs somewhere to make that part explicit. |
I thought I put it for the |
We talked about this briefly on Discord in the context of a maximum quick terminal width, but for height as well being able to specify the number of display rows would be nice. |
For the initial work I suggest just doing % and pixels. Rows/columns can come later since the API around that is messier. |
Making a start on this, by defining that new dedicated The initial implementation is only 1 dimensional, but as we've said, we can make it 2 dimensional later if we want to. I'm still super new to Zig, so I've spent a lot of time figuring out how to even get this working. I'm expecting a lot of this code is not at all idiomatic. But the tests pass... so I think this part at least works. Unless this needs major changes, the remaining work is on the macOS side. I don't know when I'll have time to do any further work, so if anybody wants to pick up what I've got so far and run with it, please feel free! |
Building on d2cf51a, I added the frontend macOS stuff so I can hardcode my own use case (fullscreen). Unfortunately my naive attempts at using |
Nice! As may have been obvious... I just didn't have the time to finish what I was doing on this 😂 So remaining tasks as I see it:
|
🤝 After playing with my version more I realized it was going off the screen on the bottom. Getting the height from
|
# Description This commit introduces the ability to launch the quick terminal in the middle position.  ## Note to reviewer - The quick terminal is currently centered. Should we consider adding a top offset to better align with the screenshot in [the issue](#2494 )? Should it be configurable? - On large monitors, half the visible frame might be excessively large. To mitigate, I am planning to implement #2384 but we should probably agree on a good default maximum width/height in middle position. - I also figured out, reloading the configuration does not update the quick terminal configuration. That is also an issue I will try to fix. Resolves #2494 I agree to relicense my commit to MIT.
This commit introduce `quick-terminal-size` option which allows to define the size of the quick terminal. It also fixes an issue where the quick terminal position was not properly updated when reloading the configuration. Resolves ghostty-org#2384
This commit introduce `quick-terminal-size` option which allows to define the size of the quick terminal. It also fixes an issue where the quick terminal position was not properly updated when reloading the configuration. Resolves ghostty-org#2384
I see the PR is in flight, so maybe preaching to the choir but I would strongly appreciate some ability to dial in quick-terminal width when in top b/c I use a 49" ultrawide (LG 49WL95C-W) and the ergonomics for (cf iTerm: and center is ... okay: (but [if anyone is wondering, Safari was being weird about previewing the image uploads; that's why it gets replaced by arc between screenshot 1 and 2) |
Alas, having chosen to rebase and build first, read Swift later, I discover that even with the 2 number forms of
(and the other 2 versions) I suppose the ~problem is that [either you could still default to center OR] you need an additional config here (or a 4 number format?) to specify not only per-se width but also offset from edge |
Umm, so ... I opened #4716 as a draft PR because it does contain a partial implementation that I probably plan to continue on. (and I originally was just gonna make a gist of a patch or indeed a but then I also got a little carried away and wrote, in order, 3 more lengthy comments:
I… don't really think those are in the right place but I also don't know that they could be moved at this point and make sense (but mitchell or any other project admin types, feel free to do so anyway if you disagree) I also think I'm burned out on thinking about this for the day or at least the next several hours, so … I wanted to go ahead and point these out to potentially interested parties before I give computing a break. Cheers 😅 |
It would be great to be able to specify size in "characters", e.g. old style rows/columns. Perhaps if specified without unit, e.g. |
I don't know if it's in any way feasible (or even a good idea), but I've found it intuitive what some neovim plugins do when defining dimensions: values <= 0 are proportional (percentage of the available space) while values > 0 are absolute (meaning rows or columns. The one (or at least the most) unintuitive thing about it is that fullscreen (either by width or height) means the value needs to be set to 0. Making it so that floats would always be proportional and and ints absolute would fix that. But then it might be confusing that 30 and 30.0 might be completely different depending on the font size and the screen. |
Hi, is any of the "quick terminal height/size" feature already released? thanks |
Do I understand correctly that 100% will basically be fullscreen and will dynamically adjust to different display sizes (switching the quick terminal between the native display vs an external monitor, for example)? |
For now, a workaround I found it to set |
@lmBored I don't think that works with multiple displays (of different sizes). |
That's a good point, haven't tried it with 2 monitors yet, but resizing quick terminal manually is in pixel, so it should work in multiple displays in the sense that quick terminal size remains the same (instead of changing dynamically to scale with screen resolution) |
This comment has been minimized.
This comment has been minimized.
alas, that doesn't seem to persist across application restarts |
Fair point, I made this script to get the window_id of the quick terminal and resize it automatically with yabai. For usage, you can add something like edit: You can also add an event listener so this script only runs when a new instance of yabai is created, like edit2+3: Cleaned script, old one is ugly, and handle string returned empty first try. #!/usr/bin/env bash
LOG_FILE="/tmp/ghostty_handler.log"
function log {
echo "$(date): $1" >> "$LOG_FILE"
}
function ghostty_manage {
local window_id
log "Starting ghostty_manage"
while true; do
# Get Ghostty window ID
# window_id=$(yabai -m query --windows | jq -r '.[] | select(.app == "Ghostty" and (.title | test(":~$|^~$"))) | .id')
# Get the first matching Ghostty window ID
window_id=$(yabai -m query --windows | jq -r '[.[] | select(.app == "Ghostty" and (.title | test("^~$"))) | .id] | first')
if [[ -n "$window_id" ]]; then
log "Found Ghostty window ID: $window_id"
GHOSTTY_WIDTH=$(yabai -m query --displays | jq -r '.[0].frame.w')
GHOSTTY_HEIGHT=$(yabai -m query --displays | jq -r '.[0].frame.h / 2 + 97')
yabai -m window "$window_id" --resize abs:$GHOSTTY_WIDTH:$GHOSTTY_HEIGHT
log "Resized Ghostty window $window_id to ${GHOSTTY_WIDTH}x${GHOSTTY_HEIGHT}"
break # Exit loop once a valid window is handled
else
log "No matching Ghostty window found, retrying..."
sleep 0.5 # Prevents excessive looping
fi
done
}
# Check if Ghostty is open before running
if yabai -m query --windows | jq -e '.[] | select(.app == "Ghostty" and (.title | test(":~$|^~$"))) | .id' >/dev/null; then
ghostty_manage
else
log "Ghostty is not running, skipping script execution."
fi |
@lmBored umm, it doesn't work for me, the quick terminal does not resize at all |
You have to hover your cursor to the edge of the screen until the |
In macOS, it looks like we're setting the default sizes here:
https://github.com/ghostty-org/ghostty/blob/main/macos/Sources/Features/QuickTerminal/QuickTerminalPosition.swift#L10-L29
For example, when showing at the top of the screen, we're setting the height to be 1/4 the height of the screen.
(specifically, this is whichever screen quick terminal first loads on. there's some edge cases around quick-terminal-screen=mouse if you have monitors of varying sizes, which I'm not going to go into right now)
I couldn't figure out from https://github.com/ghostty-org/ghostty/pull/2320/files how this is implemented on other systems. Am I missing something, or is this a macOS-only feature for now?
There are two options we could go for here:
(plus the option of both)
In my case, I would want my multiplier to be 1. i.e. the quick terminal takes up the entire screen. For my specific example, I see no value in specifying a fixed height. My instinct is that most people who use quick terminal have a preference for it to fill "a bit of the screen", "a lot of the screen" or "all of the screen". I imagine pixel-precision sizing of the quick terminal would be a niche desire.
(I could of course be wildly wrong these assumptions)
So were I to implement this myself (and I'm thinking I probably will), my proposal is:
quick-terminal-size-multiplier
, with default value of 0.25height: screen.frame.height * multiplier
There are a few edge cases I'd have to consider (e.g. making sure the multiplier is > 0, and <= 1), but otherwise this feels like it would be a fairly simple thing to implement.
If you're happy with the proposed implementation, I might get a PR raised for it over the weekend.
The text was updated successfully, but these errors were encountered: