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

Show feedback for key presses #2

Closed
farzadmf opened this issue Feb 16, 2022 · 9 comments
Closed

Show feedback for key presses #2

farzadmf opened this issue Feb 16, 2022 · 9 comments
Labels
enhancement New feature or request

Comments

@farzadmf
Copy link

Hi,

I really like the idea of the plugin. I think it would be nice to have some kind of feedback when we press keys in the "modal mode".

For example, in vim, when you press keys, you'd see them in the status bar, and since this plugin generally uses a sequential combination of keys, it would be helpful to see what keys you have pressed.

Also, that would somehow imply a way to "cancel" you current sequence (maybe by pressing ESC or something)

Also, another suggestions to be able to press ESC to get out of the "modal" mode (in addition to the M-m combination)

As a bonus, it would be nice to have those as configurable options that we can enable/disable/change

Of course, all these are just suggestions; feel free to ignore 🙂

@whame whame added the enhancement New feature or request label Feb 16, 2022
@whame
Copy link
Owner

whame commented Feb 16, 2022

Thank you very much for your feedback! Some very interesting points there.

I really like the idea of the plugin. I think it would be nice to have some kind of feedback when we press keys in the "modal mode".

For example, in vim, when you press keys, you'd see them in the status bar, and since this plugin generally uses a sequential combination of keys, it would be helpful to see what keys you have pressed.

This would be very nice to have (I would like that too!). However, I believe this is very hard to implement. tmux status bar is not designed to be "dynamic". I'm not even sure how one could "intercept" the keys and update the status bar during a command sequence. If you (or someone else) have an idea, please tell.

Also, that would somehow imply a way to "cancel" you current sequence (maybe by pressing ESC or something)

Actually, any "invalid" key cancels the sequence (default in tmux). For example, if you hit w s to start splitting the window and then hit q (or ESC) the command would cancel (q is "reserved" as "quit"). Maybe we need to update the README with this information...

Also, another suggestions to be able to press ESC to get out of the "modal" mode (in addition to the M-m combination)

Hm there was someone else on Reddit that I believe suggested this as well. I told them to create an issue here on GitHub, but they haven't done it. Could you please create a separate issue (labeled with "enhancement") for this? That way we can track the progress of that feature easier. Thank you!

@farzadmf
Copy link
Author

farzadmf commented Feb 16, 2022

Thank you very much for your feedback! Some very interesting points there.

Glad that you liked it

believe this is very hard to implement. tmux status bar is not designed to be "dynamic".

Just throwing out something here (probably stupid): can't we use the same mechanism that shows that = equal sign when the mode changes?

Actually, any "invalid" key cancels the sequence

Good to know, I guess this goes hand in hand with the feedback part; if there was a way to provide feedback, then we would clearly see that "OK, now the combination is reset"

Could you please create a separate issue

Will do in a bit -> UPDATE: created #3 (I don't think I'm able to add a label, am I?)


Also, I'm not going to close it in case anyone (we or someone else) comes up with an idea about a method to have a "realtime feedback" for key combinations, if that's OK with you

@whame
Copy link
Owner

whame commented Feb 16, 2022

Just throwing out something here (probably stupid): can't we use the same mechanism that shows that = equal sign when the mode changes?

That design works since we just track two "states" here: normal and command ("modal") mode (see https://github.com/whame/tmux-modal/blob/master/tmux-modal.tmux#L577 for some rather complex code for such a "simple" feature). For arbitrary key presses that would be extremely complex (maybe not even possible).

I believe one probably has to hack the tmux source code a bit to be able to easily "hook" in to the key press processing mechanism. As far as I know, there is no such thing today (or?).

Good to know, I guess this goes hand in hand with the feedback part; if there was a way to provide feedback, then we would clearly see that "OK, now the combination is reset"

I agree.

Also, I'm not going to close it in case anyone (we or someone else) comes up with an idea about a method to have a "realtime feedback" for key combinations, if that's OK with you

Yeah, that's fine.

@whame whame changed the title Feedback for key presses and some other suggestions Show feedback for key presses Feb 16, 2022
@farzadmf
Copy link
Author

Hey @whame , not sure if you know about it or if it's useful at all (trying blindly to find "something" 😝 )

From here, I see there's tmux refersh-client -S to refresh the status bar.

As I said, I have no idea if it's useful; just mentioning it

@whame
Copy link
Owner

whame commented Feb 16, 2022 via email

@dnguyenzd
Copy link

dnguyenzd commented Oct 12, 2022

somewhat related but hopefully simpler to implement: it would be great addition if it can show different icon/character in status for what "mode" we are in, e.g. window, window resize, cmd

I think each mode at the moment has its own key table?

A thing to consider is that too many icons/characters can hurt user experience too (users can't remember all of them), so maybe only the primary modes

@whame
Copy link
Owner

whame commented Oct 13, 2022

That's a good suggestion! Indeed, the different modes do have their own key table. This might be easier to implement. Something like:

[=]    # for "root" command key table
[w]    # for window key table
[wr]   # for window resize key table
[s]    # for session key table
[g]    # for goto key table

etc.

or we can have icons, but that would probably be too difficult to remember. I like the idea of distraction free visualization. This will certainly be an option that will be off by default.

whame added a commit that referenced this issue Nov 27, 2022
Check `client_key_table` against the key tables and use corresponding
"icon" to show the command sequence in status bar.

This implements the idea in GitHub issue #2.
@whame
Copy link
Owner

whame commented Nov 27, 2022

This has now been implemented in master (thank you @dnguyenzd for the simpler idea!). Please try it out with:

set -g @modal-show-cmd-keys on

in .tmux.conf.

Thanks for the suggestion!

@whame whame closed this as completed Nov 27, 2022
@dnguyenzd
Copy link

awesome, thanks a lot, it's working well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants