-
Notifications
You must be signed in to change notification settings - Fork 690
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] feat: Add "quick-terminal" option to "macos-hidden" config #5803
base: main
Are you sure you want to change the base?
[macOS] feat: Add "quick-terminal" option to "macos-hidden" config #5803
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't actually run it to test it yet but reviewing the code superficially I have some requests. I do think we should remove the notification machinery for now, thanks for that though. 😄
929d8ea
to
5b77807
Compare
5b77807
to
d7a7da6
Compare
@@ -5762,6 +5762,7 @@ pub const MacTitlebarProxyIcon = enum { | |||
pub const MacHidden = enum { | |||
never, | |||
always, | |||
@"quick-terminal", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh we need to add docs for this to the config key in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment for this new case, but maybe all the related paragraphs above need to be updated as well?
@@ -403,6 +403,10 @@ class AppDelegate: NSObject, | |||
reloadDockMenu() | |||
} | |||
|
|||
func applicationDidUpdate(_ notification: Notification) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I tested the logic of this and imo this callback gets called way too much. On initial launch it's called 4 times and when I close the window once it gets called something like a dozen or more times (I didn't count, but it was a lot).
I think we need to do something different. Maybe "any open window" isn't the right logic and we need to do some more research into how iTerm2 behaves instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's what I noticed as well :/
I saw this method from a blog post about the challenge to track managed windows...
With AppKit Notifications, you get one when a window is about to close, and when one is becoming key/main but that's it.
Maybe we could intercept (via swizzling?) when windows are about to be set to the NSApp.windows
property; or even add KVO to it (because it is not unfortunately)...
Do you think that applicationDidUpdate(_:)
may cause performance issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that applicationDidUpdate(_:) may cause performance issues?
I'm not sure if it'll practically cause issues but I'm afraid it'll cause unnecessary CPU/power usage. I'm not sure how grounded in reality that is but for a feature this minor it doesn't seem worth it.
Fixes #5784
I started with a notification for listening to Ghostty terminal windows but then I saw the remark about update windows so I implemented
applicationDidUpdate
which is called whenever a window is added/removed.Tell me if if you want me to remove the notification for Ghostty terminals!