tty: AltGr+F1..F6 by default, and AltGr+-/+ to step
The sweet spot was available the whole time and I ruled it out by writing
"AltGr+anything" when the true statement is "AltGr+*letter*".
A Polish layout wants AltGr with a letter -- ą ć ę ł ń ó ś ź ż. AltGr with a
function key produces nothing on any layout, no window manager binds it, and
no application asks for it. It is the one combination the host, applications
and the keyboard layout all leave alone, and the previous three commits talked
themselves out of it on a technicality that was mine, not the hardware's.
Verified rather than argued, with QEMU sendkey and screendump hashes:
AltGr+F2 -> tty2
AltGr+F1 -> back, pixel-identical to the start
AltGr+a -> reaches zsh, so ą still types
That distinction is only expressible because Right Alt became its own modifier
bit two commits ago. Sharing ALT is harmless for typing -- neither is used to
look up a character -- and made this impossible to say.
Also added, since it was asked for in the same breath: minus and equals step
to the previous and next terminal, on whatever the chord's modifiers are. They
skip terminals that are not in use -- the same `opened` count VT_GETSTATE
reports -- because six terminals with two shells on them means four blank
screens in between, and cycling past those is worse than not having the key.
AltGr+= -> tty2, again -> wraps to tty1 (only two in use)
AltGr+- -> tty2
chvt -c still moves all of it, and `chvt` reports both halves.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
This commit is contained in:
parent
7c0f7c7d01
commit
65906639da
8 changed files with 118 additions and 31 deletions
|
|
@ -65,12 +65,28 @@
|
|||
// There is no combination that is free for everyone on every host, and the
|
||||
// guest cannot find out what its host grabs -- the keystroke simply never
|
||||
// arrives, which is indistinguishable from a chord nobody pressed. So the
|
||||
// kernel ships a default and lets it be changed: VT_SETCHORD, and `chvt
|
||||
// --chord` in userspace. Setting it to no modifiers disables the chord
|
||||
// entirely and leaves `chvt N` as the only way to switch, which is a
|
||||
// legitimate choice on a machine whose host takes everything.
|
||||
// kernel ships a default and lets it be changed: VT_SETCHORD, and `chvt -c`
|
||||
// in userspace. Setting it to no modifiers disables the chord entirely and
|
||||
// leaves `chvt N` as the only way to switch, which is a legitimate choice on
|
||||
// a machine whose host takes everything.
|
||||
//
|
||||
// The default is AltGr+F1..F6, and the "AltGr wants it" line above needs
|
||||
// reading carefully: what a Polish layout wants is AltGr+*letter*. AltGr with
|
||||
// a function key produces nothing on any layout, no window manager binds it,
|
||||
// and no application asks for it. Right Alt being a separate modifier bit
|
||||
// here is what makes the distinction expressible at all -- it used to share
|
||||
// ALT, which is harmless for typing and useless for this.
|
||||
#define KEY_VT_SWITCH 0x120
|
||||
|
||||
// Previous / next terminal, on the same modifiers as the chord above. The
|
||||
// minus and equals keys, which sit together and read as - and + -- a relative
|
||||
// move for when you have two terminals and do not care which number they are.
|
||||
#define KEY_VT_PREV 0x130
|
||||
#define KEY_VT_NEXT 0x131
|
||||
|
||||
#define SCAN_MINUS 0x0C // - / _
|
||||
#define SCAN_EQUALS 0x0D // = / +
|
||||
|
||||
#define SCAN_F1 0x3B // F1..F6 are scancodes 0x3B..0x40
|
||||
#define SCAN_1 0x02 // 1..6 are scancodes 0x02..0x07
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ void vt_resize(void); // a scanout arrived; re-measure
|
|||
struct vt *vt_get(int i); // 0-based, clamped, never null
|
||||
struct vt *vt_current(void);
|
||||
int vt_switch(int i); // 0-based; repaints. -1 if out of range
|
||||
int vt_cycle(int dir); // -1 previous, +1 next, in-use only
|
||||
|
||||
// Output, per terminal. Drawing happens only if `v` is the active one.
|
||||
void vt_feed(struct vt *v, int c); // one output byte, through the parser
|
||||
|
|
|
|||
Loading…
Reference in a new issue