Wie kann ich meine ISO_Level5_Shift-Pfeiltasten in Java Swing-GUIs verwenden?

1134
Owen

Ich habe ein Tastaturlayout, das ISO_Level5_ShiftPfeiltasten bereitstellt. Aus meiner Layoutsymboldatei:

key <AC06> { type[Group1]="EIGHT_LEVEL", [ d, D, ampersand, U2227, Home, Home, Greek_delta, Greek_DELTA ]}; key <AC07> { type[Group1]="EIGHT_LEVEL", [ h, H, parenright, U27E9, Left, Left, Greek_eta, Greek_ETA, U210F ]}; key <AC08> { type[Group1]="EIGHT_LEVEL", [ t, T, parenleft, U27E8, Down, Down, Greek_tau, Greek_TAU ]}; key <AC09> { type[Group1]="EIGHT_LEVEL", [ n, N, slash, U2115, Right, Right, Greek_nu, Greek_NU ]}; key <AC10> { type[Group1]="EIGHT_LEVEL", [ s, S, underscore, U2237, End, End, Greek_sigma, Greek_SIGMA ]}; 

Diese funktionieren in den meisten Programmen (Firefox, Eclipse, Vim, ...). Leider funktionieren sie in keiner Java-Swing-Benutzeroberfläche, die ich jemals verwendet habe. Insbesondere funktionieren sie nicht in IntelliJ IDEA, und genau das hat mich besonders gestört.

Gibt es etwas, das ich in meinem Layout, in Java-bezogenen Umgebungsvariablen oder in der IDEA-Konfiguration ändern könnte, um dieses Problem zu beheben?

1

3 Antworten auf die Frage

6
Owen

OK, ich habe eine Lösung gefunden. Es ist nicht wirklich ideal, aber es bekommt das gewünschte Verhalten.

Zuerst habe ich den vollständigen Status meiner Tastaturkonfiguration mit Dump gesichert

$ xkbcomp $DISPLAY - > now.xkb 

Dann habe ich die Zeilen gefunden

interpret Overlay1_Enable+AnyOfOrNone(all) { action= LockControls(controls=Overlay1); }; 

und änderte es in

interpret Overlay1_Enable+AnyOfOrNone(all) { action= SetControls(controls=Overlay1); }; 

which prevents the modifier from being "sticky" ie it only applies while you are holding the key down.

Then I took the key that used to be my ISO_Level5_Shift:

key <TAB> { type= "ONE_LEVEL", symbols[Group1]= [ ISO_Level5_Shift ] }; 

and changed it to Overlay1_Enable:

key <TAB> { type= "ONE_LEVEL", symbols[Group1]= [ Overlay1_Enable ] }; 

Then for every key where I wanted the change to take effect, I added an overlay definition:

key <AD07> { type= "EIGHT_LEVEL", overlay1= <PGUP>, symbols[Group1]= [ g, G, asterisk, G, Prior, G, Greek_gamma, Greek_GAMMA ] }; 

Then a re-applied the whole thing with

$ xkbcomp now.xkb $DISPLAY 

Useful documentation:

0

Ich hatte auch ein Problem damit, hier ist meine Lösung, die Caps-Lock-Taste als Overlay-Schalter verwendet, um emacs / vim wie Navigation zu aktivieren. Hoffentlich hilft es jedem, der etwas Ähnliches zu tun hat.

// Emacs like keys with CAPS as overlay switch.  // Using ISO_Level3_Shift or ISO_Level5_Shift would also make // most applications work and would have been more flexible, // however they don't work in Java Swing apps (e.g. IntelliJ IDEA) // but using overlay works  // To enable, save this file as /usr/share/X11/xkb/symbols/emacs and run: // // setxkbmap -option '' "emacs" // // However it may not persist and can get reset back to the default by other things. // Alternatively, insert the following into /usr/share/X11/xkb/rules/evdev.xml // ... // <layoutList> // ... // <layout> // <configItem> // <name>emacs</name> // <shortDescription>en</shortDescription> // <description>English (US, Emacs)</description> // <languageList> // <iso639Id>eng</iso639Id> // </languageList> // </configItem> // </layout> // ... // </layoutList> // ... // Then you should be able to choose 'English (US, Emacs)' in a keyboard preference // GUI such as fcitx and have it persist.  default partial alphanumeric_keys xkb_symbols "basic" {  // Base keyboard functionality, using 'us' here // See definitions in /usr/share/X11/xkb/symbols // e.g. 'include "us(intl)"' where 'intl' is defined inside the 'us' file include "us"  // Press Shift_L + Shift_R together as an alternative way to toggle Caps_Lock, // then turn CAPS key to enable overlay1 mode when and only when holding down. include "shift(both_capslock)" key <CAPS> ;  // Emacs like navigation keys when holding down <CAPS> // e.g. caps + n to go down key <AB05> ; // b key <AC04> ; // f key <AD10> ; // p key <AB06> ; // n key <AC01> ; // a key <AD03> ; // e key <AC05> ; // g  // Emacs like editing keys when holding down <CAPS> // Redo/Undo only work with applications that understand the them key <AB10> ; // / key <UNDO> {[Undo, Redo]}; // Shift + / -> Redo key <AC03> ; // d  // VIM like navigation keys when holding down <CAPS> key <AC06> ; // h key <AC09> ; // l key <AC08> ; // k key <AC07> ; // j  }; 
0
drets

Insbesondere funktionieren sie nicht in IntelliJ IDEA, und genau das hat mich besonders gestört.

Es gibt eine Problemumgehung, um die gewünschten Schlüssel auf der IntelliJ IDEA-Seite abzubilden.

  1. Gehen Sie zu Einstellungen ⇒ Keymap.
  2. Suchen Sie nach einer Taste, die nicht funktioniert, wenn Sie die Tastenkombination "Iso Level Shift" drücken (sagen Sie die Taste "Up").
  3. Wählen Sie "Tastenkombination hinzufügen".
  4. Drücken Sie die Tastenkombination "Iso Level Shift", die in IntelliJ nicht als "Up" -Taste funktioniert.
  5. Sich bewerben.

Voilà, die Tastenkombination "Iso Level Shift" verhält sich auch in IntelliJ IDEA als "Up" -Taste .