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 #2205

Closed
lucymhdavies opened this issue Sep 6, 2024 · 9 comments · Fixed by #2338
Closed

Add an equivalent to iTerm's "show/hide all windows" hotkey #2205

lucymhdavies opened this issue Sep 6, 2024 · 9 comments · Fixed by #2338
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor.

Comments

@lucymhdavies
Copy link
Contributor

One of the features I find incredibly useful is its "show/hide all windows with a system-wide hotkey" feature https://iterm2.com/documentation-hotkey.html

This allows me to have a main termainal window, which is hidden most of the time, but then with the press of a button is visible and overlayed above the rest of my windows.

The rest of this kind of workflow is already achievable, thanks to macos-non-native-fullscreen = visible-menu

Original Discord thread: https://discord.com/channels/1005603569187160125/1281689303516319978

@jcollie
Copy link
Collaborator

jcollie commented Sep 6, 2024

Showing/hiding all of Ghostty's windows should be fairly easy if Ghostty is the app that has the keyboard focus. If not, you'd need to arrange for a global keybind of some kind. Since that's already implemented in iTerm2 it shouldn't be too hard to inspect iTerm2 and see how they did that for macOS. However for Linux/GTK it's going to be a more difficult problem as each desktop environment is going to have a different way to configure that (if they allow it at all). Probably on Linux/GTK we'd just need to implement a DBus signal of some kind and leave the rest up to individuals/packagers to set up.

@mitchellh
Copy link
Contributor

System wide keys on macOS require accessibility permissions. Until we have a better way in the UX to explain this to users I’d rather not. I’m happy to have a keybind if focused though.

@lucymhdavies
Copy link
Contributor Author

lucymhdavies commented Sep 6, 2024

That's a very good point, yeah 🤔

If the window is focused, then standard system "minimize" keyboard shortcuts (e.g. cmd-m or cmd-h on macOS) work pretty well, without the need for Ghostty to handle this itself.

(and if the window is hidden... it's not really likely to be focussed)

So probably worth parking this until we have a better UX for this kind of thing :)

@mitchellh
Copy link
Contributor

Yeah, I agree. I missed in the original request that this was specifically a global hotkey. I'm going to close this for now since it's pretty much "unplanned" pending a lot of exploratory work on the accessibility features we want to have. Feel free to reopen in some time if we reach a point where this isn't a few hops away. 😄

@mitchellh
Copy link
Contributor

mitchellh commented Sep 25, 2024

Note I ended up doing #2299 which introduces the new global: prefix on key binds to allow system global keybindings and handles some of the accessibility UX questions (though, not as cleanly as I'd like long term). This makes this issue very relevant.

I'm going to reopen this because it'd be fairly trivial to add a new keybinding now (after #2299 is merged) to do this.

It would have to be macOS only unless someone figures out a way to make our global: system work on Linux. :)

@mitchellh mitchellh reopened this Sep 25, 2024
@mitchellh mitchellh added enhancement contributor friendly A well-scoped, approachable issue for someone looking to contributor. labels Sep 25, 2024
@lucymhdavies
Copy link
Contributor Author

#2320 was my use-case here. I didn't realise just how highly requested this was.

So seeing what that looks like in https://twitter.com/mitchellh/status/1840449807095394391?s=46
and experimenting with it myself...
yeah, this is basically what I wanted! :D

So unless anybody else is interested in "show/hide all windows" for other reasons I've not considered, then I'm fine with this issue being closed again.

There are a few limitations, most of which you point out in the PR, but I'm assuming these will be coming in future:

  • No tabs in the quick terminal (fixable with a custom tab bar)
  • No fullscreen in the quick terminal (fixable, may do it before merge unsure yet)
  • No window save state or restore on app restart (fixable but I'm not sure it makes sense for this feature yet)
    • personally, having quick-terminal default to full-screen, or remember that I set it to full screen last time, would be nice. Probably something I'd want to set in the config file, at which point restoring the state of the window may not be needed.

It'd also be nice to be able to add some transparency on the quick terminal.

As far as I can see, there aren't any GH issues for these yet, so I'll create some, but obviously feel free to close if there are some duplicates I've missed :)

@mitchellh
Copy link
Contributor

So unless anybody else is interested in "show/hide all windows" for other reasons I've not considered, then I'm fine with this issue being closed again.

Got it, thanks! Yeah no one else has requested this so I'll go ahead and close this in lieu of your other issues.

@godbout
Copy link

godbout commented Dec 28, 2024

System wide keys on macOS require accessibility permissions. Until we have a better way in the UX to explain this to users I’d rather not. I’m happy to have a keybind if focused though.

not sure if it has been specified somewhere else but this is not true. macOS event taps require the macOS Accessibility. global monitors don't. there's probably even more hardcore ways with Carbon keys etc. (most probably what https://github.com/sindresorhus/KeyboardShortcuts is using). if you needed the AX for system wide events then no app could be on the Mac App Store because sandboxing doesn't allow the AX Framework to be used 😂️

edit: ok. seems it may have been answered. read the whole thread and it didn't speak to me but once i commented it kinda did. 😴️ my bad.

@godbout
Copy link

godbout commented Dec 28, 2024

System wide keys on macOS require accessibility permissions.

ok so i followed #2299 and yeah, there are ways to not required the macOS AX Permissions for a global hotkey, which may be better if one day you wanna end up with having Ghostty on the Mac App Store! cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants