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: Key Sequence UI #2418

Merged
merged 3 commits into from
Oct 9, 2024
Merged

macOS: Key Sequence UI #2418

merged 3 commits into from
Oct 9, 2024

Conversation

mitchellh
Copy link
Contributor

@mitchellh mitchellh commented Oct 9, 2024

Related to #2127 (doesn't fix since we still need a GTK UI)

This implements a UI for #2121. The most important part of this PR is the core cross-platform plumbing to get access to sequenced keybind information, not the UI itself. I think the UI itself could definitely use some love and improvement, and I'm happy for anyone to take that on. I think importantly, this gets us from no UI at all to some UI for key sequences.

This is macOS only. GTK shouldn't be hard to follow but would love any ideas (or even contributions) from our resident GTK experts, such as @jcollie @tristan957 etc.

Demo

The "pending key sequence" only shows up while a pending key sequence is active. Once a key sequence is complete (either through successfully executed an action or typing a key that isn't part of the sequence) then it disappears.

image

@@ -411,6 +411,7 @@ pub fn performAction(
.size_limit,
.cell_size,
.secure_input,
.key_sequence,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the action that needs to be implemented for GTK to support this.

@tristan957
Copy link
Collaborator

tristan957 commented Oct 9, 2024

Seems like this could be the beginning of a status bar element for ghostty. You could just keep the bar there permanently and the pending key could be one of the "widgets." Anyway, happy to provide an impl after the PR merges. But a GtkRevealer with a GtkBox containing a GtkLabel will probably be enough to match what you are doing with the mac impl. On libadwaita you would probably apply the .toolbar class.

On libadwaita, we might actually want to use https://gnome.pages.gitlab.gnome.org/libpanel/class.Statusbar.html. Could be a good excuse to bring in libpanel as a dependency. In the future, I see splits being created as panels in the libadwaita side of things.

@mitchellh
Copy link
Contributor Author

Sounds great. Note the GTK design doesn't need to match the macOS design at all. I'd rather do whatever looks best and most idiomatic for the platform. (I don't think this looks best or most idiomatic for macOS at all, but my lack of design skills are showing. 😄 )

@mitchellh mitchellh merged commit 3e55c47 into main Oct 9, 2024
32 of 34 checks passed
@mitchellh mitchellh deleted the apprt-key-seq branch October 9, 2024 16:31
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.

2 participants