Julow / Unexpected-Keyboard

A lightweight virtual keyboard for developers.
GNU General Public License v3.0
1.43k stars 186 forks source link

[Feature Request] Is it possible to have custom modifier keys? or at least something like the AltGr key? #515

Open YeaminSarder opened 9 months ago

YeaminSarder commented 9 months ago

Hi, I am trying to make a keyboard layout for the toki pona language. I need to assign 137+ character keys for this language. It quickly gets cluttered if i try to put all 137 chars at once. It would be helpful if i could use the shift key to switch some characters temporarily, or the AltGr key to temporarily switch some layouts. It generally helps if I could somehow define custom modifier keys. Thanks.

Julow commented 9 months ago

It's possible to change the shift key behavior for just a layout:

<keyboard>
  <modmap>
    <shift a="a" b="b"/>
  </modmap>
  ...
</keyboard>

However, only shift can be changed like that.

If your intent is to add the new layout to the app, it's better to change the Fn modifier in the code: https://github.com/Julow/Unexpected-Keyboard/blob/master/srcs/juloo.keyboard2/KeyModifier.java#L188 or to add new modifiers.

YeaminSarder commented 9 months ago

ah. that helps. it would be really nice if the following worked. I am not used to app building, but I am learning.

<keyboard>
  <modmap>
    <shift a="a" b="b"/>
    <custom_modkey a="1" b="2" c="3"/>
  </modmap>
  <row>
    <key key0="shift" key1="custom_modkey"/>
  </row>
</keyboard>
Julow commented 9 months ago

I'm not in favor of per-layout custom modifiers at all. Modifiers are easier to maintain in the code and are used by several layouts at the same time. Maybe adding cases to the Fn modifier is the best fit ?

nathgit commented 9 months ago

What are you thinking of? You can't use sitelen pona, if that's what you're thinking of, because it's not available in unicode, but you could use the emoji or hanzi (chinese characters) layouts. Is that what you want? for example "toki pona li pona tawa mi" would be "言好哩好去找" or "🗣️👍▶️👍↪️👈➖". Those 2 layouts are it as far as a "custom" layout that I'm aware of. The hanzi system can already be used with any keyboard that supports a cangjie layout (which doesn't require you to know the Chinese pronunciation).

"sitelen pona" la, sina ken ala kepeken e ni tan ni: nasin "unicode" li jo ala e ni. “画好”喇,你能不用把这从这:道“Unicode”哩有不把这。 🖼️👍🔼👉💪❌🔧⏩👇↩️👇➗🛣️unicode▶️👜❌⏩👇➖

https://sites.google.com/view/sitelenemoji/tools/toki-pona/transliterate

is a sitelen emoji transliterator.

YeaminSarder commented 9 months ago

It's in UCSUR. sitelen pona ucsur guide.

It requires you to install special font files. But I also like the sitelen emoji as I can use it everywhere.