Add command bypass and internal UI sessions to Wayland keyboard backend

This commit is contained in:
hjozwiak committed 2026-11-11 08:12:04 -05:00
1 parent bebde8fd5e
commit fc25f7e7e8
9 files changed
+426 -25

No files matched your search

+17 -1
View File
@@ -43,6 +43,7 @@ type Keyboard struct {
done chan struct{}
wake chan struct{}
updates chan keyboardUpdate
uiUpdates chan uiUpdate
commands chan input.CommandEvent
locks chan input.LockState
failures chan error
@@ -52,12 +53,17 @@ type Keyboard struct {
secureGeneration atomic.Uint64
enabled atomic.Bool
browse atomic.Bool
bypass atomic.Bool
nativeButton atomic.Bool
applied atomic.Bool
browseApplied atomic.Bool
bypassApplied atomic.Bool
active atomic.Bool
learn atomic.Bool
learnEcho atomic.Bool
uiSession atomic.Uint64
uiSequence atomic.Uint64
uiClose atomic.Uint64
overflow atomic.Uint64
intent input.IntentTracker
}
@@ -69,7 +75,7 @@ func New(modifiers []string, layout input.KeyboardLayout, logger *slog.Logger) *
keyboard := &Keyboard{
logger: logger,
configuration: keyboardConfiguration{layout: layout, modifiers: append([]string(nil), modifiers...)},
wake: make(chan struct{}, 1), updates: make(chan keyboardUpdate),
wake: make(chan struct{}, 1), updates: make(chan keyboardUpdate), uiUpdates: make(chan uiUpdate),
commands: make(chan input.CommandEvent, 32), locks: make(chan input.LockState, 16),
failures: make(chan error, 1), events: make(chan input.Event, 64),
}
@@ -155,6 +161,16 @@ func (keyboard *Keyboard) SetBrowseNavigation(enabled bool) {
keyboard.browse.Store(enabled)
keyboard.notify()
}
// SetCommandBypass drops every key grab except the bypass shortcut after
// held keys release. Watched keys still report monitoring and echo; the
// shared interface has no key synthesis, so reader-modifier chords other
// than the retained shortcut are swallowed rather than replayed.
func (keyboard *Keyboard) SetCommandBypass(enabled bool) {
keyboard.bypass.Store(enabled)
keyboard.notify()
}
func (keyboard *Keyboard) CommandBypassEnabled() bool { return keyboard.bypassApplied.Load() }
func (keyboard *Keyboard) SetNativeButtonFocus(focused bool) {
keyboard.nativeButton.Store(focused)
keyboard.notify()