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

Allow using modifier symbols instead of their name abbreviations (same for longer key names) #205

Open
eugenesvk opened this issue Dec 8, 2022 · 13 comments · May be fixed by #216
Open

Comments

@eugenesvk
Copy link

eugenesvk commented Dec 8, 2022

Currently modifier keys are represented by this alphabet soup

S T O C    	→  left_shift	 left_control	 left_option	 left_command
R W E Q    	→ right_shift	right_control	right_option	right_command
SS TT OO CC	→       shift	      control	      option	      command
F          	→ function key
!!         	→ hyper

Especially in various combos it's getting a bit hard to read as the is no separator between a modifier and a key and the abbreviations (especially the right ones) are less than memorable (but even for the left ones tripped a few times over C as control or command)

I'd like to suggest that in addition to the single-upper-case letters you could use these unicode symbols representing these keys:

 ⇧  ⎈  ⎇  ◆	→       shift	      control	      option	      command
←⇧ ←⎈ ←⎇ ←◆	→  left_shift	 left_control	 left_option	 left_command
→⇧ →⎈ →⎇ →◆	→ right_shift	right_control	right_option	right_command
ƒ          	→ function key (or either/all of ⓕⒻ🄵🅕🅵 not to confuse ƒf)
✱          	→ hyper

...or using more traditional macOS symbols is also just fine

 ⇧  ⌃  ⌥  ⌘	→       shift	      control	      option	      command
←⇧ ←⌃ ←⌥ ←⌘	→  left_shift	 left_control	 left_option	 left_command
→⇧ →⌃ →⌥ →⌘	→ right_shift	right_control	right_option	right_command
🌐          	→ function key 

... or maybe allow both?

This would also allow you to get rid of the extra ! after :

Similarly, some of the long-named keys could be replaced with much better looking

  [:escape             	[:⎋	]]
  [:tab                	[:⭾	]]
  [:caps_lock          	[:⇪	]]
  [:spacebar           	[:␠	]] ; or ␣
  [:delete_or_backspace	[:␈	]] ; or ⌫
  [:return_or_enter    	[:⏎	]]
  [:up_arrow           	[:▲	]]
  [:down_arrow         	[:▼	]]
  [:left_arrow         	[:◀	]]
  [:right_arrow        	[:▶	]]

A larger illustration
goku_beauty

This could also help with mouse buttons, for example, this monstrosity

[{:pkey :button5 :modi {:mandatory [:left_shift :left_command]	:optional :any}} :!Od	 :term]

could become this beauty

[:‹⇧‹⌘∀﹖🖰5 :!Od :term]
@eugenesvk eugenesvk changed the title Allow using modifier symbols instead of their symbol abbreviations (same for longer key names) Allow using modifier symbols instead of their name abbreviations (same for longer key names) Dec 8, 2022
@ChristinWhite
Copy link

This would be drastically easier to read and write, particularly the modifier keys. I personally have text expansion shortcuts setup for all of the common key symbols so it's effortless to write this way.

@eugenesvk
Copy link
Author

eugenesvk commented Jan 12, 2023

On the writing side: another way is you can bind right alt as your "symbol key" in goku, so just pressing it with any modifier or backspace or enter etc would insert the symbol, so it's even faster to type (for the longer names) and more convenient to press the mod key rather than try to remember the letter representing it

On the reading side, though, you'd need to allow tabs/spaces to reach greatness: so that in a long list of keys you could place the modifiers in a column, so e.g., all command keys are in the first column, all shift keys are in the second, then it's immediately obvious from modifier position which mods are required for a key

But whitespaces might be too complicated to add (and even then might be alignment might be slightly off due to imperfect editor support of symbol width/variable tab width

As an illustration of a more complicated example with optionals (here whitespace is a variable width tab needed for vertical alignment in a text editor)
(don't like the indicators, but maybe if left is much more common you could have left modifiers without an indicator, but then have another indicator for ↔left or right?)

align

@elmart-devo
Copy link

@eugenesvk Those symbols look great. But personally, I find the arrows to introduce too much visual clutter. Why not something visually ligther, like using apostrophes(or an even more subtle symbol) to the left/right of the principal symbol? I mean, something like this:
'⌘ for left command
⌘' for right command
etc

@eugenesvk
Copy link
Author

Or maybe

‹ ›

with the benefit that you could have them on the same side if you'd like it a bit denser while maintaining vertical alignment of the modifiers?

›⌘
‹⌘
⌘›
'⌘
⌘'

›⌘
‹⌘
 ⌘›
'⌘
 ⌘'

@eugenesvk
Copy link
Author

Similarly, maybe # is too heavy and can be replaced with a more logical question mark for optionals?

!⌘
?⌘
﹖⌘
⌘?
⌘﹖

@elmart-devo
Copy link

elmart-devo commented Feb 12, 2023

If using different symbols for left and right (like you do with > and <), then yes, it can be allowed to place them in either side of the main symbol. If using the same symbol (like the apostrophe or similar), then that option is not possible. Personally, I find it easier to leave the position of the apostrophe to mean "left" or "right". There's no decoding, it's visual. While, if you can put < or > to the left, you brain has to "decode" if it's a less than or a greater than symbol. I find that slower to my eyes. But that's personal preference. I think any of the proposed options would be great.

I do agree that vertical alignment is a thing, but I was thinking of being able to use spaces when needed to maintain it, as you did in your examples.

I agree too to the question mark being used for optional. Much more common for anyone with a regex background! ;-)

@eugenesvk
Copy link
Author

if you can put < or > to the left, you brain has to "decode" if it's a less than or a greater than symbol. I find that slower to my eyes. B

Certainly, I agree that it's conceptually better to put the side indicators to their respective sides and also personally prefer it that way, the cost of extra spaces is not significant enough to me
(though I also like the extra boost from arrow-like ‹›)

I was wondering whether that could actually be something dynamic, e.g., you would put at the top of a file one line with the symbol definitions to your liking (subject to parser constraints on the allowed symbols)
shift⇧ control⎈ option⎇ command◆ left‹ right› optional﹖

@eugenesvk eugenesvk linked a pull request Mar 23, 2023 that will close this issue
@eugenesvk
Copy link
Author

eugenesvk commented Mar 23, 2023

Good news, everyone :)! I've added support for symbols in the from/to fields, see https://github.com/eugenesvk/GokuRakuJoudo/releases/tag/0.7.0 for more details, that page also has a prebuilt binary if you want to check it out and see whether it works

Also added whitespace support for proper vertical alignment in strings starting with "‘ ⇧ ⎈ d"

Don't think the dynamic part is a great idea since it might have harder to catch bugs due to duplicate partial matches that will be replaced into invalid combinations, so will leave it for now

If you're able to build locally, you can add more symbols for the left/right/optionals etc. (in addition to ') in the tables at the top of this keys_symbols file and the resulting combinations should be auto-generated

Have converted a bunch of my config to the new format and preliminary seems to work fine, but obviously more testing is needed (don't forget to backup your pre-symbol files just in case)

al-ce added a commit to al-ce/karaml that referenced this issue Apr 14, 2023
This commit lets the user choose between a left, right, or
side-ambivalent modifier using the following unicode syntax:

⌘   - command
‹⌘  - left_command
⌘›  - right_command

etc. for other mods, ⌘, ⌥, ⌃, ⇧. Also added is an alias that's valid for
hyper, ☆. e.g.

☆ | 8

would map to 'command+option+control+shift + 8'

This syntax was discussed in this issue in the GokuRakuJoudo repo:
yqrashawn/GokuRakuJoudo#205

so credit to the participants of that issue.
al-ce added a commit to al-ce/karaml that referenced this issue Apr 14, 2023
This commit lets the user choose between a left, right, or
side-ambivalent modifier using the following unicode syntax:

⌘   - command
‹⌘  - left_command
⌘›  - right_command

etc. for other mods, ⌘, ⌥, ⌃, ⇧. Also added is an alias that's valid for
hyper, ☆. e.g.

☆ | 8

would map to 'command+option+control+shift + 8'

This syntax was discussed in this issue in the GokuRakuJoudo repo:
yqrashawn/GokuRakuJoudo#205

so credit to the participants of that issue.

Addresses #2
al-ce added a commit to al-ce/karaml that referenced this issue Apr 14, 2023
This commit lets the user choose between a left, right, or
side-ambivalent modifier using the following unicode syntax:

⌘   - command
‹⌘  - left_command
⌘›  - right_command

etc. for other mods, ⌘, ⌥, ⌃, ⇧. Also added is an alias that's valid for
hyper, ☆. e.g.

☆ | 8

would map to 'command+option+control+shift + 8'

This syntax was discussed in this issue in the GokuRakuJoudo repo:
yqrashawn/GokuRakuJoudo#205

so credit to the participants of that issue.

Addresses #2
@evan-liu
Copy link

evan-liu commented May 9, 2023

Hi all, what a great discussion. Really like your ideas of using <, > for left_ right_. I am working on a different config format and thinking about this feature, however I'd like to have strong typing so it will be too hard or complicated for supporting it on all modifiers, like

  • <⌘⌥>⌃ for left_command, right_option, control.

I wonder do you have needs in your config to have both side at the same time, or is it always (or most of the time) only on one side? Will the first character for the side applying to all modifiers enough? Like:

  • <⌘⌥ for left_command, left_option
  • >⌘⌥ for right_command, right_option

@eugenesvk
Copy link
Author

(you could check it yourself with this custom version of goku https://github.com/eugenesvk/GokuRakuJoudo/releases/tag/0.7.0 that implements this design, would be nice to know what the limitations are as it works great for my config, but obviously missed something)

I wonder do you have needs in your config to have both side at the same time

Yes, I have rules like this (note that I prefer the smaller and thus much more visually pleasing/distinct ‹› instead of <>)

 {:des "  ✱A+,/. to Select until Word Start/End: ⇪A,/. ⟶ ⎇⇧←/→" :rules [
  [:‹⇧⇧›⎈›⎇›◆›comma	:‹⇧‹⎇◀ ]
  [:‹⇧⇧›⎈›⎇›◆›.    	:‹⇧‹⎇▶] ]}

or this partially translated rule

 {:des "  ◆›jkl; ⟶ ▼▲◀▶" :rules [
  [:◆›‹⎈##l        	:‹⎈◀ ] [:‹⎇◆›##l       	:‹⎇left_arrow ] [:‹◆◆›##l        	:‹◆left_arrow ]
  [:◆›‹⎈##semicolon	:‹⎈▶] [:‹⎇◆›##semicolon	:‹⎇right_arrow] [:‹◆◆›##semicolon	:‹◆right_arrow]
  [:◆›##j          	:▼ ]
  [:◆›##k          	:▲   ]
  [:◆›##l          	:◀ ]
  [:◆›##semicolon  	:▶]]}

, or is it always (or most of the time) only on one side?

Mostly only one one side besides those hyper mapped combos or the types of rules mentioned above

Will the first character for the side applying to all modifiers enough? Like:

No since then it's ambiguous, either side modifiers don't need a side indicator, so every side modifier requires side indicator

(btw, goku also has a feature request to have "Structured config files instead of one big file", one file is indeed awful to work in, so would be nice to have "modules", though there is a trick to achieve the same currently with karabiner or goku using chezmoi #153 (comment))

@evan-liu
Copy link

evan-liu commented May 9, 2023

Hi @eugenesvk, thanks for your reply and work on adding this to Goku; I would definitely use your implementation if I were still using Goku.

Sorry, I was not clear on a few things. Firstly I had a script to write Goku config in modules myself. The reason for working on another format was mainly that I am not familiar with the edn format and had to constantly look for things which were not very productive. Secondly, my tool already has the alias feature and solves my own problems. The part I was thinking of adding was the more concise way of adding sides to modifiers (which is not required by my own config because I rarely use sides on modifiers unless I am mapping the modifier key itself).

Thanks for pointing out ‹›. I was wondering about that (they look so much better). Sorry for the naive question, but how do you type them out?

Thanks for sharing your config for the need to map both sides' modifiers simultaneously. May I ask whether you have many of them or only a few and, most of the time, on the same side?

@eugenesvk
Copy link
Author

how do you type them out

With a goku mapped key combo, of course :), in a bracket mode @ space mode:

(hold)d‹⌘/⌘›.

Though I also have them maped directly in the keyboard layout to

9/0

many of them or only a few

a few

@evan-liu
Copy link

Thanks @eugenesvk, I will add ‹› to my key alias and use them for the sides. I think I will go with first character for the whole group

  • ‹⌘⌥ or l⌘⌥
  • ›⌥⇧ or r⌥⇧

As mixed sides are not common, it may be fine to be a bit more verbose, like ['‹⌘', '›⌥'].

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 a pull request may close this issue.

4 participants