Repository navigation
Add bar input picker and searchable XKB variants - #11681
MadMatt341 wants to merge 1 commit into
Conversation
Automated AI review
Outcome: Selection by sysfs Bluetooth and remapper keyboards are dropped
Suggested change: identify each such interface by name and let the user choose. Reproducer: Bluetooth keyboard (fails at 16b1317)Bluetooth keyboard dropped when a Bluetooth mouse is connectedLinux sets the input device Save the file below as OMARCHY_PATH=$(git rev-parse --show-toplevel) PYTHONPATH=$(git rev-parse --show-toplevel)/shell/plugins/bar/widgets/keyboard python3 -B -m unittest -v test_repro_bluetooth"""A Bluetooth keyboard is dropped when a Bluetooth mouse is connected.
Linux reports the local Bluetooth adapter address as `phys` for every
Bluetooth HID input device (net/bluetooth/hidp/core.c, and BlueZ
src/shared/uhid.c for BLE), so a keyboard and a mouse on the same adapter
share one `phys` value with no `/inputN` suffix.
"""
from pathlib import Path
import tempfile
import unittest
from backend.devices import metadata, resolve
from test_backend import keyboard
def bitmap(bits):
value = sum(1 << bit for bit in bits)
words = []
while value:
words.append('%x' % (value & (2 ** 64 - 1)))
value >>= 64
return ' '.join(reversed(words)) or '0'
def input_device(root, event, name, phys, keys, rel=()):
base = Path(root) / event / 'device'
(base / 'capabilities').mkdir(parents=True)
(base / 'name').write_text(name + '\n')
(base / 'phys').write_text(phys + '\n')
(base / 'capabilities/key').write_text(bitmap(keys) + '\n')
(base / 'capabilities/rel').write_text(bitmap(rel) + '\n')
KEYBOARD_KEYS = list(range(1, 89))
MOUSE_KEYS, MOUSE_REL = [272, 273, 274], [0, 1, 8]
class BluetoothKeyboardTests(unittest.TestCase):
def groups(self, keyboard_phys, mouse_phys):
with tempfile.TemporaryDirectory() as folder:
input_device(folder, 'event5', 'Keychron K2', keyboard_phys, KEYBOARD_KEYS)
if mouse_phys:
input_device(folder, 'event6', 'MX Master 3', mouse_phys, MOUSE_KEYS, MOUSE_REL)
records = metadata(Path(folder))
return resolve({'keyboards': [keyboard('keychron-k2')]}, records)
def test_bluetooth_keyboard_next_to_a_bluetooth_mouse_is_offered(self):
adapter = 'aa:bb:cc:dd:ee:ff'
groups, excluded = self.groups(adapter, adapter)
self.assertEqual([group['names'] for group in groups], [['keychron-k2']], f'excluded: {excluded}')
def test_control_bluetooth_keyboard_alone(self):
groups, _ = self.groups('aa:bb:cc:dd:ee:ff', None)
self.assertEqual([group['names'] for group in groups], [['keychron-k2']])
def test_control_usb_keyboard_and_usb_mouse(self):
groups, _ = self.groups('usb-0000:00:14.0-2/input0', 'usb-0000:00:14.0-3/input0')
self.assertEqual([group['names'] for group in groups], [['keychron-k2']])
if __name__ == '__main__':
unittest.main()Actual output at the PR head (checkout copied to /tmp/omarchy, OMARCHY_PATH set to it): Reproducer: remapper keyboard (fails at 16b1317)Typing keyboards with an empty sysfs
|
|
Big feature PR (layout picker + edit flows). Currently CONFLICTING — please rebase. A few asks before review: (1) how this interacts with the T2 phantom keyboard case (#6833), (2) overlap with the smaller #14928 layout-switch command, (3) whether the large media/docs payload can land separately so the QML/Lua core is easier to review. |
16b1317 to
8e596e8
Compare
[Medium impact] The current change appears safe to merge, with no outstanding findings. SummaryThe PR adds an on-demand input picker to the existing keyboard indicator.
No new actionable issues were found. All four previous findings are addressed.
|
8e596e8 to
c3755fb
Compare
Right-click the keyboard indicator to choose a configured layout or Fcitx input method. Edit layouts… opens the existing keyboard setup picker, now searchable across installed XKB layouts and variants such as
us:intl. The indicator remains available with one layout; left-click also opens the picker in that case.The implementation extends the existing shared input reader and keyboard save path. Runtime selection leaves saved order unchanged, and editing retains the current override checks, Fcitx alignment and rollback. Layouts compile before saving; the Latin-leading protection also checks non-Latin variants. There is no additional per-device profile store, Lua loader, pending-state promotion or recovery journal. A picker cannot outlive an abruptly terminated reader. Shared editing refuses an active community-plugin loader and directs its owner to the cleanup procedure first.
Validation:
input.lua, left-click/Super+I cycling, persistence across reboot, ownership refusal, and shell restart without an orphan picker. The actual Super+Shift+F file-manager binding worked while Russian was active after a Russian-leading selection retained US first.This is a source-update check on an existing VM installation. Real multi-keyboard hardware and live composition-engine workflows remain outside this evidence. Contracts and focused test commands are in
docs/keyboard-layout-picker.md.