Skip to content
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

macos: autohide dock if quick terminal would conflict with it #5361

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

mitchellh
Copy link
Contributor

Fixes #5328

The dock sits above the level of the quick terminal, and the quick terminal frame typical includes the dock. Hence, if the dock is visible and the quick terminal would conflict with it, then part of the terminal is obscured.

This commit makes the dock autohide if the quick terminal would conflict with it. The autohide is disabled when the quick terminal is closed.

We can't set our window level above the dock, as this would prevent things such as input methods from rendering properly in the quick terminal window.

iTerm2 (the only other macOS terminal I know of that supports a dropdown mode) frames the terminal around the dock. I think this looks less aesthetically pleasing and I prefer autohiding the dock instead.

We can introduce a setting to change this behavior if desired later.

Additionally, this commit introduces a mechanism to safely set app-global presentation options from multiple sources without stepping on each other.

Demo

CleanShot.2025-01-24.at.14.52.26.mp4

Fixes #5328

The dock sits above the level of the quick terminal, and the quick
terminal frame typical includes the dock. Hence, if the dock is visible
and the quick terminal would conflict with it, then part of the terminal
is obscured.

This commit makes the dock autohide if the quick terminal would conflict
with it. The autohide is disabled when the quick terminal is closed.

We can't set our window level above the dock, as this would prevent
things such as input methods from rendering properly in the quick
terminal window.

iTerm2 (the only other macOS terminal I know of that supports a dropdown
mode) frames the terminal around the dock. I think this looks less
aesthetically pleasing and I prefer autohiding the dock instead.

We can introduce a setting to change this behavior if desired later.

Additionally, this commit introduces a mechanism to safely set
app-global presentation options from multiple sources without stepping
on each other.
@mitchellh
Copy link
Contributor Author

Received approval from original issue reporter, going to give it a go!

@mitchellh mitchellh enabled auto-merge January 24, 2025 22:58
@mitchellh mitchellh merged commit 136d6e9 into main Jan 24, 2025
59 checks passed
@mitchellh mitchellh deleted the push-xlxpqplsuqpy branch January 24, 2025 23:03
@github-actions github-actions bot added this to the 1.1.0 milestone Jan 24, 2025
@milgrim
Copy link

milgrim commented Jan 25, 2025

Works great when a Ghostty window is active, but not when other applications are in focus:

lush-apology.mp4

mitchellh added a commit that referenced this pull request Jan 25, 2025
Related to #5361

The fix in 5361 wasn't sufficient since it only applied if our app was
in the foreground. Our quick terminal is a non-activating NSPanel to
allow it to work on any space (fullscreen included). This means that
Ghostty doesn't become the active app when the quick terminal is shown
and another app is in the foreground.

To work around this, we now hide the dock globally when the quick
terminal is shown AND the dock is in a conflicting position. We restore
this state when the quick terminal is hidden, loses focus, or Ghostty is
quit.
@mitchellh
Copy link
Contributor Author

@milgrim #5363

mitchellh added a commit that referenced this pull request Jan 25, 2025
Related to #5361

The fix in 5361 wasn't sufficient since it only applied if our app was
in the foreground. Our quick terminal is a non-activating NSPanel to
allow it to work on any space (fullscreen included). This means that
Ghostty doesn't become the active app when the quick terminal is shown
and another app is in the foreground.

To work around this, we now hide the dock globally when the quick
terminal is shown AND the dock is in a conflicting position. We restore
this state when the quick terminal is hidden, loses focus, or Ghostty is
quit.
mitchellh added a commit that referenced this pull request Jan 25, 2025
Related to #5361

The fix in 5361 wasn't sufficient since it only applied if our app was
in the foreground. Our quick terminal is a non-activating NSPanel to
allow it to work on any space (fullscreen included). This means that
Ghostty doesn't become the active app when the quick terminal is shown
and another app is in the foreground.

To work around this, we now hide the dock globally when the quick
terminal is shown AND the dock is in a conflicting position. We restore
this state when the quick terminal is hidden, loses focus, or Ghostty is
quit.
@bluekeybo
Copy link

We can introduce a setting to change this behavior if desired later.

I keep the dock on the left, and prefer it to not hide. All my windows fill the screen up to the dock. If set to position "top", the quick terminal window should start right where the dock ends, and drop from the top, without hiding it.

@dzirtusss
Copy link

Looks weird now for me as well, I keep the dock on the right. Older behavior to just cover the dock w/o hiding was nicer. IMO, if possible, better this be an option.

@mitchellh
Copy link
Contributor Author

Older behavior to just cover the dock w/o hiding was nicer. IMO, if possible, better this be an option.

Please read the background discussion on why this isn't an option. This breaks IME input (i.e. Japanese).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants