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

Add an equivalent to iTerm's "show/hide all windows" hotkey (Fix for: #2205) #2338

Merged
merged 6 commits into from
Oct 2, 2024

Conversation

rolandpeelen
Copy link
Collaborator

First time contributor, so if I'm violating something, please let me know.

This feature should fix: #2205 (and is coincidentally basically the only thing holding me back from daily driving Ghostty).

The pr adds an action called toggle_visibility, which essentially hides and shows all Ghostty windows with a global key (and from the menubar).

@rolandpeelen rolandpeelen changed the title Add 'toggle_visibility' to be used with global_hotkeys Add an equivalent to iTerm's "show/hide all windows" hotkey (Fix for: #2205) Sep 30, 2024
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Some minor requests...

macos/Sources/Ghostty/Ghostty.App.swift Outdated Show resolved Hide resolved
macos/Sources/App/macOS/AppDelegate.swift Outdated Show resolved Hide resolved
src/apprt/action.zig Outdated Show resolved Hide resolved
@rolandpeelen
Copy link
Collaborator Author

Looks great! Some minor requests...

Amazing. I'm not a MacOS / Zig dev - so flying semi-blind here. Appreciate the feedback. I dropped the initial commit adding the NSInputMonitoringUsageDescription - It seems most of these descriptions were moved to the XCode side of things, but I could not find an equivalent there. I'm also not sure if it's needed. If you know where to put it please let me know.

@rolandpeelen rolandpeelen requested a review from mitchellh October 1, 2024 08:01
Roland Peelen added 5 commits October 2, 2024 10:33
This also slightly changes the code, as the duplication of the for loop
was making it harder to read now. I think technically slightly less
efficient, but this is hardly a hot code path, so should be fine imo.
@mitchellh
Copy link
Contributor

Looks great, once CI passes I'll merge. Thanks!

@mitchellh mitchellh merged commit 991cbce into ghostty-org:main Oct 2, 2024
16 of 17 checks passed
@rolandpeelen
Copy link
Collaborator Author

Looks great, once CI passes I'll merge. Thanks!

Thank you for all the hard work building this. Been daily'ing this branch, and it's been really great!

@@ -572,14 +574,16 @@ class AppDelegate: NSObject,

/// Toggles visibility of all Ghosty Terminal windows. When hidden, activates Ghostty as the frontmost application
@IBAction func toggleVisibility(_ sender: Any) {
for controller in NSApp.windows.compactMap({ $0.windowController as? BaseTerminalController }) {
// We only care about terminal windows.
for window in NSApp.windows.filter({ $0.windowController is BaseTerminalController }) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mitchellh -- this code change breaks things for me when using this in conjunction with fullscreen. See video: https://www.tella.tv/video/my-video-38vn

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.

Add an equivalent to iTerm's "show/hide all windows" hotkey
2 participants