What is the difference between ISO_Level3_Shift and ISO_Level3_Latch, in, for example, the level3 config file, found (in archlinux, and many other distros, I'm sure) at /usr/share/X11/xkb/symbols.
For example, I added this entry to a custom keyboard I'm working on (for logicians, don't worry about it, ⊥ → awesome).
// make right control do level3 shift stuff
default partial modifier_keys
xkb_symbols "rctrl_switch" {
key <RCTL> {
type[Group1]="ONE_LEVEL",
symbols[Group1] = [ ISO_Level3_Shift ]
};
include "level3(modifier_mapping)"
};
It works as expected (holding down right control gives me access to level 3 symbols,e.g., mostly unicode code points I have for a us-intl layout variant), but I'm wondering why some of the entries use ISO_Level3_Latch, and what that even means.
A shift-style modifier works in such a way that you have to hold it while pressing the other key for the key to be modified. That's how the regular capital shift key works on usual keyboards.
A latch-style modifier does the same, but contrary to a shift-style modifier, if it's released before another key is pressed, that modifier is latched, which means the next key you'll press will be modified. In addition, if pressed while latched, the modifier is locked until the modifier key is pressed again.
Example using the regular shift that goes to capital letters. Consider the following order of keystrokes :
- Press a
- Release a
- Press & release space
- Press shift
- Press a
- Release a
- Press a
- Release a
- Release shift
- Press & release space
- Press shift
- Release shift
- Press a
- Press a
- Press & release space
- Press shift
- Release shift
- Press shift
- Release shift
- Press a
- Press a
- Press a
- Press shift
- Release shift
- Press a
If shift is set to shift-style you'll get the following output :
a AA aa aaaa
If shift is set to latch-style you'll get the following output :
a AA Aa AAAa
Because after the press-release cycle before the third group, shift is latched, and that latch is consumed when you hit the a key. In the fourth group, pressing the latch again while latched sends you in lock mode.
Related
Is there any way to navigate the search editor (whole workspace search) using only cursor keys in vscode ? I'm talking about the whole workspace search and not just the find/replace search.
The new search editor thankfully has ported over most of the shortcut commands you have grown to know, but for brevity, this answer will include only the default keybinds with respective command id.
The when expression most commonly associated with these keybinds, should you want to alter them, are :
inSearchEditor
hasSearchResult
searchInputBoxFocus
Searching
Context Lines
Toggle context lines : toggleSearchEditorContextLines ALT + L
Will show n lines before or after search result, for context
Reduce context line quantity : decreaseSearchEditorContextLines ALT + -
Increase context line quantity : increaseSearchEditorContextLines ALT + =
Query Details
Toggle Query Details : workbench.action.search.toggleQueryDetails
This will toggle the include/exclude file input boxes
Settings
Toggle Match Case : toggleSearchCaseSensitive ALT + C
Toggle Regex : toggleSearchEditorRegex ALT + R
Toggle Word Match : toggleSearchEditorWholeWord ALT + W
Navigation
Luckily, because the search editor is effectively an 'editor', you can continue to use all the keybinds that you are used to. So, in order to jump straight to the editor, you can use whatever your keybind is to jump to an editor group, default is: CTRL + 1 (commandId: workbench.action.focusFirstEditorGroup)
Navigating matches
Go to next match : search.action.focusNextSearchResult F4
Go to previous match : search.action.focusPreviousSearchResult SHIFT + F4
Select all matches : selectAllSearchEditorMatches CTRL + SHIFT + L
Results
Deleting result block : workbench.action.searchEditor.deleteResultBlock CTRL + SHIFT + BACKSPACE
This deletes a block of results from the editor
For example, in the picture below, if my cursor is anywhere in the 'convert.js' result block the entire convert.js matches would be removed. You can undo this with CTRL + Z
Go To Definition (effectively go to file)
You can peek with ALT + F12 when your cursor is anywhere on the file name
You can assign a keyboard shortcut to follow links for the commandId: editor.action.openLink for when your cursor is on the file name
You can go directly to the file & line number of the search result using F12 while your cursor is anywhere on that result
Navigate Back to Input Box
Focus Search Input Box From Results: search.action.focusQueryEditorWidget ESCAPE
Searching within Search Editor
As noted, the search editor is effectively an editor, so you can resume using CTRL + F (find) or CTRL + H (find/replace) to narrow down results even more, and the keybinds set for those are maintained as used elsewhere.
Miscellaneous
Search again: rerunSearchEditorSearch CTRL + SHIFT + R
Perhaps you deleted too many result blocks
Otherwise, while your cursor is actively in the editor (results), you have the freedom to use most of your keybinds per normal, including collapsing/folding, jumping, copying, moving to editor groups etc
The standard layout on an a macbook pro is not quite efficient if one wants to do a lot of programming. I want to change that with some small tweaks.
One of those would be: Change Caps Lock to be a key like cmd and ctrl. For example if I want to write '{' I want to press 'Caps + a'.
Is that possible?
I Want to get keystate for some key like shift. If I press "a" with shift to write "A" then by g++ program on linux how can I ensure that shift is also pressed while I press key "a".
Thanks in advance.
See the answer for this question: What is Equivalent to getch() & getche() in Linux?
It will give you the correct keycodes, i.e. 'a' if you press 'a' with shift depressed, 'A' if you press it with shift pressed, etc. Getting the state of the shift key alone is a different matter though, I'm not sure if there's an easy way to do that.
When I'm programming I often use copy and paste, which requires me to grab the mouse, highlight the text, and press CTRL + C (I'm using Windows BTW). Is there any hotkey or solution out there for a keyboard short cut that I could press and have it start copying each character I type? It would be such a godsend to get rid of that whole highlighting mess!
You can probably develop a quick application that does that in VB (via global hotkey listener). But for me, I am a keyboard shortcut nerd, and I use CTRL + Shift + ← /→ to navigate the caret through "words" (sometimes that means every non-alphanumeric token, but it varies on the IDE you're using) that I want to copy--It's much faster than Shift + ← /→. I also use this combination frequently: End, Shift + Home, CTRL + C, which is a quick way to select and copy the whole line.
I can see where you're coming from with the "toggling copy", but I think using the full extent of the keyboard, while primitive, is the best and most practical.
Shift + ← and Shift + → will select text forward and backup.
Most editors have a lot more (Ctrl - Shift + ← for selecting to next word boundary for instance) but depends on the application.
Depending on how long your code is, you can always do Shift + End, then CTRL + C to copy the line, providing that you're at the end of the line. Shift + Home would select the preceding line if you're at the beginning of the line, etc.
I'm looking for a way to add one more "layout" to my keyboard. I'm already using a layout that uses altgr for local alphabet letters. What I'd like to add is a mirrored righthand-side keyboard that's activated with the caps-lock (one described in http://xkcd.com/mirrorboard.xkb)
Unfortunately ISO_LEVEL3_SHIFT is already taken by local alphabet. (AFAIK) If I use mode_shift to change groups I cannot use more than 2 levels in a group anymore. Is there a way to create different groups for both altgr and mode_shift?
For each keycode definition you can have up to eight keysyms. These are organized pairwise into four groups. There is a family of keysyms ISO_Next_Group, ISO_Prev_Group, ISO_First_Group, and ISO_Last_Group that, when pressed, cycle the keysym output by striking the key among the keysym groups. These keys are how you attain multiple layouts.
As an example, assuming ISO_Next_Group has been bound to a keycode and assigned to a modifier, then for this definition:
keycode 53 = x X Greek_xi Greek_XI multiply U2297 U24E7 U24CD
pressing my keyboard key with the label “X” on types out “x”. After pressing the ISO_Next_Group key, I get “ξ”. Pressing it again, I get “×”. Pressing it again, “ⓧ”. Finally, pressing it a fourth time gets things back to normal.
Having spend several days (because Xkb¹ has horrible documentation; finally found an okay guide here), you can create a symbol definition file with entries like this:
key <SPCE> {
// Level I II III IV
[ space, space, U2395, U2592 ], // Group 1
[ U2423, emspace, U2420, hairspace ] // Group 2
};
key <RALT> {
[ Mode_switch, Mode_switch ]
};
key <RCTL> {
[ ISO_Level3_Shift, ISO_Level3_Shift ]
};
The brackets enclose a single group. Normally, the first group is active. The group can be temporarily incremented by one with ISO_Group_Shift, a.k.a. Mode_switch. Within a group, the symbols emitted are defined in increasing levels. Level I is with a bare keypress. Shift adds one to the current level. ISO_Level3_Shift sets the level to III.
The example above maps seven symbols to the space bar plus various shift keys such that:
space ⟨ ⟩ U+0020 SPACE
Shift+space ⟨ ⟩ U+0020 SPACE
R. Alt+space ⟨␣⟩ U+2423 OPEN BOX
R. Alt+Shift+space ⟨ ⟩ U+2003 EM SPACE
R. Ctl+space ⟨⎕⟩ U+2395 APL FUNCTIONAL SYMBOL QUAD
R. Ctl+Shift+space ⟨▒⟩ U+2592 MEDIUM SHADE
R. Alt+R. Ctl.+space ⟨␠⟩ U+2420 SYMBOL FOR SPACE
R. Alt+R. Ctl.+Shift+space ⟨ ⟩ U+200A HAIR SPACE
There is also a key ISO_Level5_Shift for level V. So you can have at least six symbols for one group. With the mode shift key this implies that you can configure your keyboard to type out approximately 1,200 distinct symbols, but at that point holding down so many modifiers will likely deaden a few keys.
P.S. The names of all the named symbols are stored in /usr/include/X11/keysymdef.h.
¹ Turns out that xmodmap(1) is buggy and deprecated.