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 action to quickly display a help overlay #3335

Closed
alexruf opened this issue Mar 23, 2023 · 14 comments
Closed

Add action to quickly display a help overlay #3335

alexruf opened this issue Mar 23, 2023 · 14 comments
Labels
enhancement New feature or request

Comments

@alexruf
Copy link

alexruf commented Mar 23, 2023

Especially new users are often struggling to find the correct shortcut. It would be helpful to have an action that can be assigned to a key binding, which temporary brings up an overlay (similar to how the command palette is shown), that shows a cheat sheet of the currently effective key bindings.

By default, this could have some default shortcut assigned, like Ctrl + Shift + ?.

@alexruf alexruf added the enhancement New feature or request label Mar 23, 2023
@goyalyashpal
Copy link
Contributor

umh, how about having different modes in the command palette itself?

inspired from vs code, where typing > in prompt toggles command mode, ? shows commands etc...

@alexruf
Copy link
Author

alexruf commented Mar 24, 2023

umh, how about having different modes in the command palette itself?

inspired from vs code, where typing > in prompt toggles command mode, ? shows commands etc...

Good idea. Didn't think of that. Would even be necessary to have different modes in the command palette, just showing the assigned shortcut for each command could also do the job.

@goyalyashpal
Copy link
Contributor

goyalyashpal commented Mar 24, 2023

just showing the assigned shortcut for each command could also do the job.

😃 here:

Another improvement for the palette could be to display hotkeys along side the results if they exist.
- @ icecreammatt at #1485 (comment)

@icecreammatt
Copy link
Sponsor

I started using Helix and Wezterm around the same time this year. A feature I love in Helix is the ability to trigger menus with hotkeys that then show all the other hotkeys for that action. Things like splitting panes, searching, copy mode could all benefit from this.

Screen Shot 2023-03-24 at 10 32 50 PM

An easy win though I think is to display the currently bound hotkey in the command pallet in search results.

wez added a commit that referenced this issue Mar 25, 2023
For items in the main set of key assignments, show the keyboard
shortcut to the right.

Some items have multiple key assignments; we show only the first
one. We'll probably want to be a bit smarter. For instance,
both linux and windows tend to occupy the Windows/Super key
assignments, so we should probably prioritize showing the Ctrl+Shift
variants on those platforms.

refs: #3335
@wez
Copy link
Owner

wez commented Mar 25, 2023

image

Just pushed a first pass at showing the key assignments in the palette. This should be available in nightly builds in ~1 hour

@icecreammatt
Copy link
Sponsor

Wow that was fast, I just compiled locally and tested thanks for such a fast turn around!

@goyalyashpal
Copy link
Contributor

goyalyashpal commented Mar 25, 2023

img
- @ wez at #3335 (comment)

hey, how about using shortcuts for "Shit" "Ctrl" "Alt" & "Opt" "Cmd" to save space?

so like: S- C- M- etc. the ones used in *nices
or like: ^- A- etc.

@wez
Copy link
Owner

wez commented Mar 25, 2023

I tried using symbols but at the default font size for the palette, and even a bit larger, they render too small to be legible.
The emacs style S/C/M symbols are short, but there isn't a representation for Cmd/Super that is shorter than Cmd/Super.

I could potentially make the rendering for these symbols configurable, so if you've configured a large enough font size that the symbols might be more useful, then you could choose that.

@goyalyashpal
Copy link
Contributor

goyalyashpal commented Mar 25, 2023

yeah, the symbol for opt key is indeed very small.. but the option for cmd seems to be quite big 🤔 : ref

how common is "Super" key (the OS key right?) in wezterm?
one rendering can be: - the windows one

😉 superset symbol: (just kidding)


P.S.:
found this awesome image for "Mac keyboard shortcuts symbol legend"

Found one more: Modifier Key

wez added a commit that referenced this issue Mar 25, 2023
added a new `ui_key_cap_rendering` option that accepts the following
values:

```lua
-- Super, Meta, Ctrl, Shift
config.ui_key_cap_rendering = 'UnixLong'

-- Super, M, C, S
config.ui_key_cap_rendering = 'Emacs'

-- Apple macOS style symbols
config.ui_key_cap_rendering = 'AppleSymbols'

-- Win, Alt, Ctrl, Shift
config.ui_key_cap_rendering = 'WindowsLong'

-- Like WindowsLong, but using a logo for the Win key
config.ui_key_cap_rendering = 'WindowsSymbols'
```

refs: #3335
@wez
Copy link
Owner

wez commented Mar 25, 2023

The commit I just pushed adds a config option to control this:

-- Super, Meta, Ctrl, Shift
config.ui_key_cap_rendering = 'UnixLong'

-- Super, M, C, S
config.ui_key_cap_rendering = 'Emacs'

-- Apple macOS style symbols
config.ui_key_cap_rendering = 'AppleSymbols'

-- Win, Alt, Ctrl, Shift
config.ui_key_cap_rendering = 'WindowsLong'

-- Like WindowsLong, but using a logo for the Win key
config.ui_key_cap_rendering = 'WindowsSymbols'

wez added a commit that referenced this issue Mar 25, 2023
On macOS prefer CMD, but on other platform prioritize shortcuts
that don't use CMD, as those tend to reserve the CMD based shortcuts
for the system.

Allow specifying how many shortcuts to show if an action has
multiple assignments.  The default is 1.

refs: #3335
@goyalyashpal
Copy link
Contributor

thanks a lot for the stable release. with command palette & shown shortcuts, i can finally use the panes, search and other features of wezterm which earlier i just couldn't remember & reinforce in memory

@goyalyashpal
Copy link
Contributor

goyalyashpal commented Mar 28, 2023

$ wezterm --config ui_key_cap_rendering='Emacs'
ERROR  wezterm > runtime error: [string "--config ui_key_cap_rendering=Emacs"]:5: Emacs evaluated as nil. Check for missing quotes or other syntax issues
stack traceback:
        [C]: in ?
        [C]: in function 'error'
        [string "--config ui_key_cap_rendering=Emacs"]:5: in main chunk; terminating
Resolved with following comment from wez

i tried combinations with appending config. as well, and also using 'AppleSymbols' instead of 'Emacs', and passing start command at the end, all showed same result

per the commit history for the release tag: 20230326-111934-3666303c, this commit ca283c1 is included in the release. so, something is wrong, either in my usage, or it's a bug i guess

@wez
Copy link
Owner

wez commented Mar 28, 2023

As the error message suggests, you need to fix the quoting on the command line, because the shell tokenizer/parser has a stage called Quote Removal that strips out any unquoted quotes.

wezterm --config "ui_key_cap_rendering='Emacs'"

@wez wez closed this as completed in 281a0ce Feb 4, 2024
Copy link
Contributor

github-actions bot commented Mar 5, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants