One keyboard and mouse for a Mac and a Windows PC over the local network, in either direction.
Beamer 1.5.6
Toby Kalkman4da3b1181316
diff --git a/VERSION b/VERSIONindex 9075be4..eac1e0a 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.5.5+1.5.6diff --git a/assets/mac-crossing-dark.png b/assets/mac-crossing-dark.pngindex f26688b..9700c5f 100644Binary files a/assets/mac-crossing-dark.png and b/assets/mac-crossing-dark.png differdiff --git a/assets/mac-crossing-light.png b/assets/mac-crossing-light.pngindex 1caa0a2..7a3b9dd 100644Binary files a/assets/mac-crossing-light.png and b/assets/mac-crossing-light.png differdiff --git a/assets/windows-crossing-dark.png b/assets/windows-crossing-dark.pngindex 6e2158a..98a9000 100644Binary files a/assets/windows-crossing-dark.png and b/assets/windows-crossing-dark.png differdiff --git a/assets/windows-crossing-light.png b/assets/windows-crossing-light.pngindex 52b7857..b51c6bf 100644Binary files a/assets/windows-crossing-light.png and b/assets/windows-crossing-light.png differdiff --git a/core/i18n.py b/core/i18n.pyindex 15e6617..9aabd3b 100644--- a/core/i18n.py+++ b/core/i18n.py@@ -11,7 +11,7 @@ they go into a template as a ``{field}`` instead, so a machine called "Home" isCatalogues are ``locales/<code>.po`` beside VERSION, read with the standard library only. TheEnglish catalogue is the template (``locales/beamer.pot``) that ``tools/i18n_extract.py`` writes;a language is one more ``.po`` file and one line in ``LANGUAGES``. The US spelling of English-stays where it was, in core.locale, applied at the widgets' text setters.+is applied to these authored templates before typed values are interpolated."""from __future__ import annotations@@ -26,6 +26,8 @@ import structimport sysfrom pathlib import Path+from core.locale import americanise+# Code -> the language's own name for itself, shown in the Language choice whatever the current# language is, so a person who cannot read the current one can still find theirs.@@ -49,7 +51,7 @@ def N_(message: str) -> str:def tr(message: str) -> str:- return _translations.gettext(message)+ return americanise(_translations.gettext(message))def matches_translation(text: str, *templates: str) -> bool:@@ -62,11 +64,11 @@ def matches_translation(text: str, *templates: str) -> bool:def trn(singular: str, plural: str, n: int) -> str:- return _translations.ngettext(singular, plural, n)+ return americanise(_translations.ngettext(singular, plural, n))def trc(context: str, message: str) -> str:- return _translations.pgettext(context, message)+ return americanise(_translations.pgettext(context, message))def joined(items) -> str:diff --git a/core/locale.py b/core/locale.pyindex c45a49a..c749a81 100644--- a/core/locale.py+++ b/core/locale.py@@ -68,7 +68,7 @@ def is_us_region() -> bool:def americanise(text: str) -> str:- """Convert British spellings in text intended for display on a US system, when Beamer is in English."""+ """Convert authored English templates for a US region, preserving format fields."""from core import i18nif not isinstance(text, str) or not i18n.is_source() or not is_us_region():@@ -83,4 +83,7 @@ def americanise(text: str) -> str:return target.capitalize()return target- return _WORD_PATTERN.sub(replace, text)+ # Field identifiers are code, and their values have not been inserted yet.+ parts = re.split(r"(\{[^{}]*\})", text)+ return "".join(part if part.startswith("{") else _WORD_PATTERN.sub(replace, part)+ for part in parts)diff --git a/core/tests/test_i18n.py b/core/tests/test_i18n.pyindex d0d1794..b4256ae 100644--- a/core/tests/test_i18n.py+++ b/core/tests/test_i18n.py@@ -123,6 +123,29 @@ class I18nTests(unittest.TestCase):i18n.install("ru")self.assertEqual(locale.americanise("Colour"), "Colour")+ def test_us_templates_preserve_interpolated_data_and_field_names(self):+ with mock.patch.object(locale, "is_us_region", return_value=True):+ i18n.install("en")+ fields = {"colour": "Colourful", "address": "colour.example", "n": 2}+ self.assertEqual(i18n.tr("Favourite {colour}: {address}").format(**fields),+ "Favorite Colourful: colour.example")+ self.assertEqual(i18n.trc("menu", "Centre {colour}").format(**fields),+ "Center Colourful")+ self.assertEqual(i18n.trn("{n} colour for {colour}", "{n} colours for {colour}", 2).format(**fields),+ "2 colors for Colourful")+ self.assertEqual(i18n.joined(["Colourful", "Favourite centre"]),+ "Colourful and Favourite centre")++ def test_us_region_does_not_rewrite_italian_or_pseudo_templates(self):+ for code in ("it", "qps"):+ with self.subTest(code=code), \+ mock.patch.dict(os.environ, {"BEAMER_LANGUAGE": code}), \+ mock.patch.object(locale, "is_us_region", return_value=True):+ i18n.install("auto")+ expected = i18n.load(code).gettext("Favourite {name}")+ self.assertEqual(i18n.tr("Favourite {name}").format(name="Colourful"),+ expected.format(name="Colourful"))+if __name__ == "__main__":unittest.main()diff --git a/core/ways.py b/core/ways.pyindex bbad4cb..84f697e 100644--- a/core/ways.py+++ b/core/ways.py@@ -1527,6 +1527,16 @@ def _sendable(entry: dict) -> bool:return bool(entry.get("id")) and entry.get("in_use", True) is True and entry.get("send") is True and entry.get("port") != 0+def shortcut_detail(key: str, mode: str) -> str:+ if mode == "next":+ template = tr("{key}, next in order")+ elif mode == "ticked":+ template = tr("{key}, next among ticked")+ else:+ template = tr("{key}, to where input last went")+ return template.format(key=key)++def shortcut_peer(peers: list, last: Optional[str], ready: Callable[[str], bool]) -> Optional[str]:"""The machine the shortcut, the Send button and the tray send this machine's input to: the oneit was last on while that one can take it, else the first in the list that can, else the one itdiff --git a/flatpak/uk.co.kalkman.beamer.metainfo.xml b/flatpak/uk.co.kalkman.beamer.metainfo.xmlindex 3151b8e..31aed91 100644--- a/flatpak/uk.co.kalkman.beamer.metainfo.xml+++ b/flatpak/uk.co.kalkman.beamer.metainfo.xml@@ -43,7 +43,10 @@</screenshots><content_rating type="oars-1.1"/><releases>- <release version="1.5.5" date="2026-10-14">+ <release version="1.5.6" date="2026-10-19">+ <description><p>Carries the 1.5.5 audit fixes: Korean Han/Yeong and Hanja key repeat on X11, typed machine names on US-English systems, the Crossing shortcut tile subtitle, and the single-display map frame.</p></description>+ </release>+ <release version="1.5.5" date="2026-10-15"><description><p>Adds layout profiles, shake to come home, resizable machine tiles on the Crossing map, and an Italian translation.</p></description></release><release version="1.5.4" date="2026-10-14">diff --git a/locales/beamer.pot b/locales/beamer.potindex b4bdb87..0483dde 100644--- a/locales/beamer.pot+++ b/locales/beamer.pot@@ -1081,6 +1081,11 @@ msgstr ""msgid "Whole edge"msgstr ""+#: core/ways.py+#, python-brace-format+msgid "{key}, next in order"+msgstr ""+#: core/ways.py#, python-brace-formatmsgid "the {parts} of the {edge} edge"@@ -1129,6 +1134,16 @@ msgstr ""msgid "{name} no longer has this pairing, so it has no way in. Remove {name} here and pair the two again."msgstr ""+#: core/ways.py+#, python-brace-format+msgid "{key}, next among ticked"+msgstr ""++#: core/ways.py+#, python-brace-format+msgid "{key}, to where input last went"+msgstr ""+#: core/ways.py#, python-brace-formatmsgctxt "ways alternatives"@@ -2420,11 +2435,6 @@ msgstr ""msgid "Plays {name}"msgstr ""-#: mac_app/kvm_bridge_app.py win_app/kvm_bridge_win.py-#, python-brace-format-msgid "{key}, to where input last went"-msgstr ""-#: mac_app/kvm_bridge_app.pymsgid "On a PC, Command arrives as Control, so Command-C copies there too, and Control arrives as the Windows key. Between two Macs every key arrives as itself."msgstr ""diff --git a/locales/it.po b/locales/it.poindex 9f14085..5ee9c4a 100644--- a/locales/it.po+++ b/locales/it.po@@ -1083,6 +1083,11 @@ msgstr "Bordo intero o i terzi che scegli"msgid "Whole edge"msgstr "Bordo intero"+#: core/ways.py+#, python-brace-format+msgid "{key}, next in order"+msgstr "{key}, prossimo in ordine"+#: core/ways.py#, python-brace-formatmsgid "the {parts} of the {edge} edge"@@ -1131,6 +1136,16 @@ msgstr "{name} non ha una via di ritorno verso questo computer: nessuno dei suoimsgid "{name} no longer has this pairing, so it has no way in. Remove {name} here and pair the two again."msgstr "{name} non ha più questo abbinamento, quindi non ha una via d'ingresso. Rimuovi {name} qui e abbina di nuovo i due computer."+#: core/ways.py+#, python-brace-format+msgid "{key}, next among ticked"+msgstr "{key}, prossimo spuntato"++#: core/ways.py+#, python-brace-format+msgid "{key}, to where input last went"+msgstr "{key}, dove è andato l'input l'ultima volta"+#: core/ways.py#, python-brace-formatmsgctxt "ways alternatives"@@ -2469,11 +2484,6 @@ msgstr ""msgid "Plays {name}"msgstr "Riproduce {name}"-#: mac_app/kvm_bridge_app.py win_app/kvm_bridge_win.py-#, python-brace-format-msgid "{key}, to where input last went"-msgstr "{key}, dove è andato l'input l'ultima volta"-#: mac_app/kvm_bridge_app.pymsgid "On a PC, Command arrives as Control, so Command-C copies there too, and Control arrives as the Windows key. Between two Macs every key arrives as itself."msgstr "Su un PC, Comando arriva come Ctrl, quindi Comando-C copia anche lì, e Ctrl arriva come tasto Windows. Tra due Mac ogni tasto arriva com'è."diff --git a/mac_app/kvm_bridge_app.py b/mac_app/kvm_bridge_app.pyindex bb2e03f..c5165c5 100644--- a/mac_app/kvm_bridge_app.py+++ b/mac_app/kvm_bridge_app.py@@ -33,7 +33,6 @@ from frame_clock import FrameClock, set_divisorimport dock_visibilityfrom core import crash_logfrom core import effects-from core.locale import americanisefrom core.i18n import matches_translation, LANGUAGES, N_, tr, trc, installimport effects_overlayimport gestures@@ -893,7 +892,7 @@ def install_main_menu(control_window):key equivalent of the Quit item in the application menu — so with no main menu the app couldnot be quit from the keyboard, and Cmd+C/V/A in the token field did nothing either."""def item(menu, title, action, key, modifiers=None, target=None):- entry = menu.addItemWithTitle_action_keyEquivalent_(americanise(title), action, key)+ entry = menu.addItemWithTitle_action_keyEquivalent_(title, action, key)if modifiers is not None:entry.setKeyEquivalentModifierMask_(modifiers)if target is not None:@@ -1682,12 +1681,8 @@ class ControlWindow(AppKit.NSObject):contact = (core_ways._rect_contact(layout[own], layout[self.chosen_peer])if own in layout and self.chosen_peer in layout else None)side = contact[0] if contact and contact[0] != "corner" else None- # Among the chosen machine's ways the shortcut is the one that is not that machine's: it is- # this Mac's, and goes where input last went.- several = len(self.settings_store.current()["peers"]) > 1- self.method_boxes["shortcut"].set_detail(- tr("{key}, to where input last went").format(key=widgets.key_title(self.key_recorder.value))- if several else widgets.key_title(self.key_recorder.value))+ self.method_boxes["shortcut"].set_detail(core_ways.shortcut_detail(+ widgets.key_title(self.key_recorder.value), self.shortcut_goes_to.value or "last"))self.ignored_recorder.set_trigger_code(KEY_NAME_TO_CODE.get(self.key_recorder.value))hold = self.style_select.value == "hold"motion.set_hidden(self.double_tap_head, hold)@@ -4969,11 +4964,11 @@ class _LaunchWatch(AppKit.NSObject):def _tray_item(title, **kwargs):- return rumps.MenuItem(americanise(title), **kwargs)+ return rumps.MenuItem(title, **kwargs)def _set_tray_title(item, title):- item.title = americanise(title)+ item.title = title# What a click on the Dock icon does while no window is open. With the menu bar item switched offdiff --git a/mac_app/notices.py b/mac_app/notices.pyindex f1b7283..e6eebf0 100644--- a/mac_app/notices.py+++ b/mac_app/notices.py@@ -2,7 +2,6 @@import secrets-from core.locale import americanisedef user_notifications():@@ -71,7 +70,6 @@ class Notices:framework = self._module()centre = framework.UNUserNotificationCenter.currentNotificationCenter()content = framework.UNMutableNotificationContent.alloc().init()- title, body = americanise(title), americanise(body)content.setTitle_(title)content.setBody_(body)content.setSound_(framework.UNNotificationSound.defaultSound())diff --git a/mac_app/tests/test_notices_mac.py b/mac_app/tests/test_notices_mac.pyindex 64b19b0..dc35394 100644--- a/mac_app/tests/test_notices_mac.py+++ b/mac_app/tests/test_notices_mac.py@@ -15,7 +15,7 @@ import rumpsimport noticesfrom kvm_bridge_app import TrayApp, _set_tray_title, _tray_item-from core import locale+from core import i18n, localefrom core import peerlist@@ -132,7 +132,7 @@ class NoticesTest(unittest.TestCase):def test_us_notice_text_uses_american_spelling(self):with mock.patch.object(locale, "is_us_region", return_value=True):- self.assertTrue(self.notices.post("Cancelled", "Colourful behaviour is a favourite."))+ self.assertTrue(self.notices.post(i18n.tr("Cancelled"), i18n.tr("Colourful behaviour is a favourite.")))notice = self.framework.center.added[0].contentself.assertEqual((notice.title, notice.body),("Canceled", "Colorful behavior is a favorite."))@@ -172,9 +172,9 @@ class _FakeTrayApp:class TrayNoticeTest(unittest.TestCase):def test_tray_menu_titles_use_american_spelling(self):with mock.patch.object(locale, "is_us_region", return_value=True):- item = _tray_item("Minimise", callback=None)+ item = _tray_item(i18n.tr("Minimise"), callback=None)self.assertEqual(item.title, "Minimize")- _set_tray_title(item, "Initialising")+ _set_tray_title(item, i18n.tr("Initialising"))self.assertEqual(item.title, "Initializing")def test_the_tray_app_posts_through_the_notices_not_rumps_with_addresses_hidden_as_set(self):diff --git a/mac_app/tests/test_shortcut_subtitle.py b/mac_app/tests/test_shortcut_subtitle.pynew file mode 100644index 0000000..a96c4e4--- /dev/null+++ b/mac_app/tests/test_shortcut_subtitle.py@@ -0,0 +1,24 @@+"""The mounted Shortcut tile follows its destination choice and saved value."""++from test_crossing_page_machines import BEE, SEA, Page, token+from settings_store import config_to_raw+++class ShortcutSubtitle(Page):+ def test_destination_choices_refresh_the_mounted_tile_and_reload(self):+ window = self.build([(BEE, token(100), "Bee", {"side": "right"}),+ (SEA, token(150), "Sea", {"side": "left"})])+ window.key_recorder.value = "alt_r"+ window.style_select.value = "double_tap"+ tile = window.method_boxes["shortcut"]+ for mode, ending in (("next", "next in order"), ("ticked", "next among ticked"),+ ("last", "to where input last went")):+ with self.subTest(mode=mode):+ window.shortcut_goes_to._choose(mode)+ self.assertEqual(tile.detail.view.stringValue(), f"Right Option, {ending}")+ window._apply_settings()+ self.assertEqual(self.store.current()["crossing"]["shortcut_goes_to"], mode)+ self.assertIsNotNone(tile.view.superview())+ self.assertFalse(tile.detail.view.isHidden())+ window._load_shared(config_to_raw(self.store.load()))+ self.assertEqual(tile.detail.view.stringValue(), f"Right Option, {ending}")diff --git a/mac_app/tests/test_widgets.py b/mac_app/tests/test_widgets.pyindex 03858b1..9332e44 100644--- a/mac_app/tests/test_widgets.py+++ b/mac_app/tests/test_widgets.py@@ -84,18 +84,30 @@ class WidthTests(unittest.TestCase):self.assertEqual(figure.view.attributedStringValue().string(), '120 px')self.assertEqual(figure.view.accessibilityLabel(), '120 px')- def test_us_region_changes_rendered_text_and_accessibility_without_changing_source(self):- from core import locale+ def test_authored_us_text_reaches_rendered_text_and_accessibility(self):+ from core import i18n, localewith mock.patch.object(locale, "is_us_region", return_value=True):- label = widgets.Label("Colourful behaviour")- button = widgets.Button("Minimise", None, None)+ label = widgets.Label(i18n.tr("Colourful behaviour"))+ button = widgets.Button(i18n.tr("Minimise"), None, None)self.assertEqual(label.view.stringValue(), "Colorful behavior")self.assertEqual(label.view.accessibilityLabel(), "Colorful behavior")- self.assertEqual(label.text, "Colourful behaviour")+ self.assertEqual(label.text, "Colorful behavior")self.assertEqual(button.view.title(), "Minimize")- self.assertEqual(button.title, "Minimise")+ self.assertEqual(button.title, "Minimize")++ def test_us_region_preserves_direct_and_interpolated_user_data(self):+ from core import i18n, locale++ with mock.patch.object(locale, "is_us_region", return_value=True):+ for value in ("Colourful", "Favourite centre", "colour.example"):+ with self.subTest(value=value):+ label = widgets.Label(value)+ self.assertEqual(label.view.stringValue(), value)+ self.assertEqual(label.view.accessibilityLabel(), value)+ label.set(i18n.tr("Favourite: {name}").format(name=value))+ self.assertEqual(label.view.stringValue(), "Favorite: " + value)def test_nonwrapping_label_updates_full_text_metadata(self):label = widgets.Label("Short name")diff --git a/mac_app/widgets.py b/mac_app/widgets.pyindex 19ccb6b..59da4dc 100644--- a/mac_app/widgets.py+++ b/mac_app/widgets.py@@ -20,7 +20,6 @@ import media_keysimport motionimport themefrom core.i18n import N_, tr-from core.locale import americanisefrom ignored_titles import is_modifier_release, recorded_entryfrom key_codes import KEY_NAME_TO_CODE, PRINTABLE_KEY_FALLBACKS, SPECIAL_KEY_NAMES, key_cap, key_titlefrom core import ways as core_ways@@ -269,7 +268,7 @@ class Label:self._render()def _render(self):- text = americanise(self.text)+ text = self.textself.view.setAttributedStringValue_(attributed(text, self.size, self.weight, self.ink, self.mono, self.tracking,self.upper, self.align, self.wrap@@ -451,9 +450,9 @@ class Figure:self._render()def _render(self):- text = americanise(self.text + (" " + self.unit if self.unit else ""))+ text = self.text + (" " + self.unit if self.unit else "")string = AppKit.NSMutableAttributedString.alloc().initWithAttributedString_(- attributed(americanise(self.text), self.size, ink=self.ink, mono=True, tracking=self.tracking)+ attributed(self.text, self.size, ink=self.ink, mono=True, tracking=self.tracking))if self.unit:string.appendAttributedString_(attributed(" " + self.unit, self.unit_size, ink="ink_3", mono=True))@@ -779,7 +778,7 @@ class Button:# disables to the same quiet outline instead.fill, stroke, ink = "panel", "rule", "ink_3"text_size = theme.TYPE["small"] if self.scale == "small" else theme.TYPE["button"]- title = attributed(americanise(self.title), text_size, 600, ink, align=AppKit.NSTextAlignmentCenter, wrap=True)+ title = attributed(self.title, text_size, 600, ink, align=AppKit.NSTextAlignmentCenter, wrap=True)self.view.setAttributedTitle_(title)paint(self.view, fill, stroke)# Width comes from the rendered title, not a measured pixel, so a longer word or adiff --git a/win_app/capture_x11.py b/win_app/capture_x11.pyindex 5b09fb2..2091c25 100644--- a/win_app/capture_x11.py+++ b/win_app/capture_x11.py@@ -495,6 +495,7 @@ class Hooks:# after-last is None while it is held.self._spans: Dict[int, collections.deque] = {}self._names_down: Dict[int, str] = {}+ self._ime_repeat_handled: Dict[int, bool] = {}# Keys and buttons this machine was given through XTest after a grab kept them from it,# held until their own release arrives, whichever way it comes.self._played_keys: set = set()@@ -773,16 +774,17 @@ class Hooks:elif evtype == XI_RAW_MOTION:self._motion(sourceid, raw)elif kind == "key":- _, down, detail, sourceid, _flags, mods, group, _master, _sequence = event+ _, down, detail, sourceid, flags, mods, group, _master, _sequence = eventif self.drop_injected and sourceid in self._xtest:return- self._key(detail, down, mods, group, True)+ self._key(detail, down, mods, group, True, repeat=bool(flags & XI_KEY_REPEAT))elif kind == "hierarchy":self._read_devices()elif kind == "mapping" and event[1] == MAPPING_POINTER:self._buttons = self._connection.pointer_mapping()- def _key(self, keycode: int, down: bool, mods: Optional[int], group: Optional[int], swallowed: bool) -> None:+ def _key(self, keycode: int, down: bool, mods: Optional[int], group: Optional[int], swallowed: bool,+ repeat: bool = False) -> None:code = keycode - KEYCODE_OFFSETname = self._names_down.get(code) if down else self._names_down.pop(code, None)if name is None:@@ -796,7 +798,19 @@ class Hooks:returnif down:self._names_down[code] = name- answer = self._on_key(name, down, code, keytable.EVDEV_US.get(code))+ # A repeat follows the first press's local/remote decision; only a remotely handled IME+ # tap is swallowed here, leaving an ignored key's existing replay path untouched.+ if (+ down and repeat and name in ("hangul", "hanja")+ and self._ime_repeat_handled.get(code) is True+ ):+ answer = True+ else:+ answer = self._on_key(name, down, code, keytable.EVDEV_US.get(code))+ if down and not repeat and name in ("hangul", "hanja"):+ self._ime_repeat_handled[code] = answer+ if not down:+ self._ime_repeat_handled.pop(code, None)if not down and keycode in self._played_keys:self._play_key(keycode, False) # its press was played here, whatever is answered nowelif answer is False and swallowed:diff --git a/win_app/diagram.py b/win_app/diagram.pyindex af02d06..203a68a 100644--- a/win_app/diagram.py+++ b/win_app/diagram.py@@ -967,7 +967,8 @@ class AtlasCanvas(QWidget):painter.setPen(QPen(_colour(line), 2.0 if outlined else 1.0))painter.setBrush(_colour(fill))painter.drawRoundedRect(rect, tokens.RADIUS["button"], tokens.RADIUS["button"])- if tile.get("displays"):+ displays = tile.get("displays") or {}+ if isinstance(displays, dict) and len(displays) > 1:for screen in ways._display_frames(tile):screen_rect = self.display_rect(peer, screen["display"]).adjusted(2, 2, -2, -2)painter.setPen(QPen(_colour("edge"), 1.0))@@ -1066,13 +1067,29 @@ class AtlasCanvas(QWidget):stretches = ways.third_stretches(contact, screen)breaks = [before[3] for before, after in zip(stretches, stretches[1:])if before[1] == after[1] and abs(before[3] - after[2]) < 1e-6]+ lit_group = Nonefor stretch in stretches:if stretch[0] in lit_thirds:- for lit in ways.crossing_stretches(contact, screen, [stretch[0]]):- self._paint_contact(painter, own, own_rect, lit, alpha=seam_alpha,- breaks=breaks, screen=screen)+ if (lit_group and lit_group[1] == stretch[1]+ and abs(lit_group[3] - stretch[2]) < 1e-6):+ lit_group = (lit_group[0], lit_group[1], lit_group[2], stretch[3])+ else:+ if lit_group:+ self._paint_contact(painter, own, own_rect,+ (lit_group[1], lit_group[2], lit_group[3]),+ alpha=seam_alpha, breaks=breaks, screen=screen)+ lit_group = stretchelse:+ if lit_group:+ self._paint_contact(painter, own, own_rect,+ (lit_group[1], lit_group[2], lit_group[3]),+ alpha=seam_alpha, breaks=breaks, screen=screen)+ lit_group = Noneself._paint_third_track(painter, own, own_rect, stretch, breaks, screen)+ if lit_group:+ self._paint_contact(painter, own, own_rect,+ (lit_group[1], lit_group[2], lit_group[3]),+ alpha=seam_alpha, breaks=breaks, screen=screen)# The seam is the edge's own mark: a machine reached only by its corner shows the# corner bracket and no seam.elif (held.get("state") in ("edge", "part", "corner")diff --git a/win_app/kvm_bridge_win.py b/win_app/kvm_bridge_win.pyindex 49f1357..22905e3 100644--- a/win_app/kvm_bridge_win.py+++ b/win_app/kvm_bridge_win.py@@ -521,7 +521,6 @@ class WindowsApplication(QWidget):def __init__(self, config_path: Path, start_after_first_paint: bool = False) -> None:super().__init__()- widgets.install_text_localisation()self.config_path = config_pathself._status_lock = threading.RLock()self._status = ServerState.STOPPED@@ -2987,7 +2986,7 @@ class WindowsApplication(QWidget):self.shortcut_tile.setChecked("shortcut" in config.crossing_methods)finally:self.shortcut_tile.blockSignals(False)- self.shortcut_tile.set_detail(tr("{key}, to where input last went").format(key=key))+ self.shortcut_tile.set_detail(ways.shortcut_detail(key, config.shortcut_goes_to))self.shortcut_target_choice.set_value(config.shortcut_goes_to)self._crossing_text(self.shortcut_target_note, pages_win.shortcut_destination_note(config.shortcut_goes_to, config.trigger_style == "hold"))@@ -3301,7 +3300,7 @@ class WindowsApplication(QWidget):def _shortcut_module(self, current: Config) -> QWidget:module = widgets.Module(tr("Shortcut"))key = TRIGGER_KEYS.get(current.trigger_key, current.trigger_key)- self.shortcut_tile = widgets.WayTile(tr("Shortcut"), tr("{key}, to where input last went").format(key=key))+ self.shortcut_tile = widgets.WayTile(tr("Shortcut"), ways.shortcut_detail(key, current.shortcut_goes_to))self.shortcut_tile.setChecked("shortcut" in current.crossing_methods)self.shortcut_tile.toggled.connect(lambda on: self._ways_changed("shortcut", on))module.body.addWidget(self.shortcut_tile)diff --git a/win_app/tests/test_atlas_canvas.py b/win_app/tests/test_atlas_canvas.pyindex 92ec0a0..d0d2a67 100644--- a/win_app/tests/test_atlas_canvas.py+++ b/win_app/tests/test_atlas_canvas.py@@ -76,7 +76,7 @@ class AtlasCanvasTests(unittest.TestCase):self.assertEqual(canvas.states["home"]["detail"], "Studio PC")- def test_this_pc_name_is_painted_over_its_display_boxes(self):+ def test_this_pc_name_is_painted_in_a_single_display_tile(self):from PySide6.QtCore import Qtfrom PySide6.QtGui import QColor, QImage@@ -102,6 +102,44 @@ class AtlasCanvasTests(unittest.TestCase):for x in range(max(0, int(rect.left()) + 20), min(image.width(), int(rect.right()) - 20)))self.assertTrue(visible_ink)+ def test_internal_display_frames_are_drawn_only_for_multiple_displays(self):+ from unittest.mock import patch+ from PySide6.QtCore import Qt, QRectF+ from PySide6.QtGui import QImage++ import diagram+ from diagram import AtlasCanvas++ canvas = AtlasCanvas()+ self.addCleanup(canvas.deleteLater)+ canvas.resize(480, 268)+ image = QImage(canvas.size(), QImage.Format.Format_ARGB32)+ image.fill(Qt.GlobalColor.transparent)+ rounded_rects = []+ original = diagram.QPainter++ class RecordingPainter(original):+ def drawRoundedRect(self, *args):+ rounded_rects.append(QRectF(args[0]))+ return super().drawRoundedRect(*args)++ def internal_frames(displays):+ rounded_rects.clear()+ canvas.set_tiles({"home": {"x": 0, "y": 0, "w": 160, "h": 100, "displays": displays}},+ {"home": "This PC"}, {"home": {"state": "this"}}, "home", own_id="home")+ with patch.object(diagram, "QPainter", RecordingPainter):+ canvas.render(image)+ tile = canvas.tile_rect("home")+ return [rect for rect in rounded_rects+ if rect.left() >= tile.left() + 1 and rect.top() >= tile.top() + 1+ and rect.right() <= tile.right() - 1 and rect.bottom() <= tile.bottom() - 1]++ one = {"main": {"x": 0, "y": 0, "w": 1728, "h": 1117}}+ two = {"left": {"x": 0, "y": 0, "w": 1728, "h": 1117},+ "right": {"x": 1728, "y": 0, "w": 1728, "h": 1117}}+ self.assertEqual(internal_frames(one), [])+ self.assertEqual(len(internal_frames(two)), 2)+def _wrapping_canvas(self, **states):from PySide6.QtCore import Qtfrom PySide6.QtGui import QImagediff --git a/win_app/tests/test_capture_x11.py b/win_app/tests/test_capture_x11.pyindex d8d1b88..2fdd715 100644--- a/win_app/tests/test_capture_x11.py+++ b/win_app/tests/test_capture_x11.py@@ -15,6 +15,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))sys.path.append(str(Path(__file__).resolve().parent.parent.parent))import capture_x11 # noqa: E402+import sender # noqa: E402from capture_x11 import Device # noqa: E402from core.return_edge import Rect, ReturnEdge # noqa: E402@@ -289,6 +290,54 @@ class CharacterTest(unittest.TestCase):class KeyTest(Harness):+ def make_sender(self, messages, ignored=()):+ class Owner:+ away = True+ on = b"synthetic-peer"++ def input(self, message):+ messages.append(message)+ return []++ link_sender = sender.LinkSender.__new__(sender.LinkSender)+ link_sender._owner = Owner()+ link_sender.links = type("Links", (), {"live": lambda _self, _peer: True})()+ link_sender._ignore_gate = sender.ignored.Gate(ignored)+ link_sender._input_method_tap_releases = set()+ link_sender._lock = threading.RLock()+ link_sender._queue = lambda _actions: None+ link_sender._report = lambda _actions: None+ self.hooks._on_key = link_sender.on_key++ def test_flagged_ime_repeat_makes_one_sender_tap_but_a_later_press_still_taps(self):+ for keycode, name in ((130, "hangul"), (131, "hanja")):+ with self.subTest(name=name):+ messages = []+ self.make_sender(messages)++ self.feed(key(True, keycode), key(True, keycode, flags=capture_x11.XI_KEY_REPEAT),+ key(False, keycode), key(True, keycode), key(False, keycode))++ self.assertEqual(messages, [+ {"type": "keydown", "data": {"key": name}},+ {"type": "keyup", "data": {"key": name}},+ {"type": "keydown", "data": {"key": name}},+ {"type": "keyup", "data": {"key": name}},+ ])++ def test_flagged_ime_repeat_still_replays_a_locally_ignored_press(self):+ messages = []+ self.make_sender(messages, ("key:122",))++ self.feed(key(True, 130), key(True, 130, flags=capture_x11.XI_KEY_REPEAT), key(False, 130))++ self.assertEqual(messages, [])+ self.assertEqual([call for call in self.connection.calls if call[0] == "fake_key"], [+ ("fake_key", 130, True, ()),+ ("fake_key", 130, True, ()),+ ("fake_key", 130, False, ()),+ ])+def test_a_named_key_outside_a_grab_from_a_raw_event(self):self.feed(raw(capture_x11.XI_RAW_KEY_PRESS, 105, sourceid=8), raw(capture_x11.XI_RAW_KEY_RELEASE, 105, sourceid=8))self.assertEqual(self.seen.keys, [("cmd_r", True, 97, None), ("cmd_r", False, 97, None)])diff --git a/win_app/tests/test_global_shortcut.py b/win_app/tests/test_global_shortcut.pyindex 53a3e45..4d774e1 100644--- a/win_app/tests/test_global_shortcut.py+++ b/win_app/tests/test_global_shortcut.py@@ -78,6 +78,19 @@ class GlobalShortcutTests(unittest.TestCase):window._record_trigger("key", kvm.TRIGGER_VKS["alt_r"])self.assertEqual(window.shortcut_tile.accessibleDescription(), "Right Alt, to where input last went")+ def test_destination_choices_refresh_visible_and_accessible_detail(self):+ for mode, ending in (("next", "next in order"), ("ticked", "next among ticked"),+ ("last", "to where input last went")):+ with self.subTest(mode=mode):+ self.window.shortcut_target_choice._buttons[mode].click()+ expected = f"Right Ctrl, {ending}"+ self.assertEqual(self.window.shortcut_tile.detail.text(), expected)+ self.assertEqual(self.window.shortcut_tile.accessibleDescription(), expected)+ self._close_window()+ self._open_window()+ self.assertEqual(self.window.shortcut_target_choice.value, mode)+ self.assertEqual(self.window.shortcut_tile.detail.text(), expected)+if __name__ == "__main__":unittest.main()diff --git a/win_app/tests/test_locale_text.py b/win_app/tests/test_locale_text.pyindex 5a26d21..9ccfc55 100644--- a/win_app/tests/test_locale_text.py+++ b/win_app/tests/test_locale_text.py@@ -9,7 +9,7 @@ sys.path.append(str(Path(__file__).resolve().parents[2]))from PySide6.QtWidgets import QApplication, QMenu, QSystemTrayIconimport widgets-from core import locale+from core import i18n, localeclass VisibleTextTests(unittest.TestCase):@@ -17,7 +17,7 @@ class VisibleTextTests(unittest.TestCase):def setUpClass(cls):cls.app = QApplication.instance() or QApplication([])- def test_us_spelling_applies_at_widget_menu_tooltip_and_action_setters(self):+ def test_authored_us_spelling_reaches_widgets_menus_tooltips_and_notices(self):notices = []def capture(_tray, title, body, *_args):@@ -25,14 +25,15 @@ class VisibleTextTests(unittest.TestCase):with mock.patch.object(locale, "is_us_region", return_value=True):with mock.patch.object(QSystemTrayIcon, "showMessage", capture):- widgets.install_text_localisation()- label = widgets.label("Colourful behaviour", "note")- label.setText("Favourite centre")- label.setToolTip("Organising a colourful favourite")+ label = widgets.label(i18n.tr("Colourful behaviour"), "note")+ self.assertEqual(label.text(), "Colorful behavior")+ label.setText(i18n.tr("Favourite centre"))+ label.setToolTip(i18n.tr("Organising a colourful favourite"))menu = QMenu()- action = menu.addAction("Minimise")- action.setText("Initialising cancelled")- QSystemTrayIcon().showMessage("Initialising", "Cancelled colourful behaviour")+ action = menu.addAction(i18n.tr("Minimise"))+ self.assertEqual(action.text(), "Minimize")+ action.setText(i18n.tr("Initialising cancelled"))+ QSystemTrayIcon().showMessage(i18n.tr("Initialising"), i18n.tr("Cancelled colourful behaviour"))self.assertEqual(label.text(), "Favorite center")self.assertEqual(label.toolTip(), "Organizing a colorful favorite")diff --git a/win_app/tests/test_map_ticks.py b/win_app/tests/test_map_ticks.pyindex 0d2ed3a..4989aae 100644--- a/win_app/tests/test_map_ticks.py+++ b/win_app/tests/test_map_ticks.py@@ -77,10 +77,13 @@ class MapTicks(unittest.TestCase):self.assertAlmostEqual((seen_end + seen_start) / 2, point, delta=0.01)self.assertAlmostEqual(seen_start - seen_end, diagram.THIRD_GAP, delta=0.01)- def test_breaks_are_centred_on_the_thirds_of_the_shared_stretch(self):+ def test_all_lit_thirds_share_one_continuous_seam(self):canvas = self.canvas()own = canvas.tile_rect(OWN)- self.assert_breaks(canvas, [own.left() + own.width() / 3, own.left() + 2 * own.width() / 3])+ pieces = self.bottom_pieces(canvas)+ self.assertEqual([path[4] for path in pieces], [4.0])+ self.assertAlmostEqual(pieces[0][1].x(), own.left() + 2)+ self.assertAlmostEqual(pieces[0][2].x(), own.right() - 2)def test_an_unlit_third_breaks_the_same_way_as_a_lit_one(self):canvas = self.canvas(desk={"thirds": ["start", "end"], "lit": ["start", "end"]})@@ -88,13 +91,38 @@ class MapTicks(unittest.TestCase):self.assertEqual([path[4] for path in self.bottom_pieces(canvas)], [4.0, 2.0, 4.0])self.assert_breaks(canvas, [own.left() + own.width() / 3, own.left() + 2 * own.width() / 3])- def test_partial_contact_breaks_at_this_pcs_own_third_boundaries(self):+ def test_partial_contact_keeps_one_continuous_seam_across_lit_thirds(self):canvas = self.canvas({OWN: ROW[OWN], DESK: {"x": 40, "y": 100, "w": 80, "h": 100}})own = canvas.tile_rect(OWN)- self.assert_breaks(canvas, [own.left() + own.width() / 3, own.left() + 2 * own.width() / 3])pieces = self.bottom_pieces(canvas)+ self.assertEqual([path[4] for path in pieces], [4.0])self.assertAlmostEqual(pieces[0][1].x(), own.left() + 40 * canvas._scale + 2)- self.assertAlmostEqual(pieces[-1][2].x(), own.left() + 120 * canvas._scale - 2)+ self.assertAlmostEqual(pieces[0][2].x(), own.left() + 120 * canvas._scale - 2)++ def test_adjacent_lit_thirds_join_and_keep_the_lit_unlit_divider(self):+ from PySide6.QtCore import QPointF++ contacts = (ROW, {**ROW, DESK: {"x": 40, "y": 100, "w": 80, "h": 100}})+ for tiles in contacts:+ with self.subTest(contact=tiles[DESK]["x"]):+ canvas = self.canvas(tiles, desk={"thirds": ["start", "middle"], "lit": ["start", "middle"]})+ own = canvas.tile_rect(OWN)+ lit, track = [path for path in self.bottom_pieces(canvas) if path[4] == 4.0], \+ [path for path in self.bottom_pieces(canvas) if path[4] == 2.0]+ self.assertEqual(len(lit), 1)+ self.assertEqual(len(track), 1)+ first_boundary = own.left() + own.width() / 3+ lit_unlit_boundary = own.left() + 2 * own.width() / 3+ self.assertLess(lit[0][1].x(), first_boundary)+ self.assertGreater(lit[0][2].x(), first_boundary)+ self.assertAlmostEqual(lit[0][2].x(), lit_unlit_boundary - 3)+ self.assertAlmostEqual(track[0][1].x(), lit_unlit_boundary + 2)+ painted_gap = (track[0][1].x() - track[0][4] / 2) - (lit[0][2].x() + lit[0][4] / 2)+ self.assertAlmostEqual(painted_gap, 2.0)++ for x, third in ((46, "start"), (80, "middle"), (113, "end")):+ point = QPointF(own.left() + (x - ROW[OWN]["x"]) * canvas._scale, own.bottom())+ self.assertEqual(canvas._third_at(point), (DESK, third))def test_nothing_for_the_thirds_is_drawn_outside_the_seam_band(self):from PySide6.QtCore import QPointF@@ -295,12 +323,18 @@ class MapTicks(unittest.TestCase):self.assertLessEqual(two.x() + width / 2,own.left() + (external["x"] + external["w"]) * canvas._scale + 1e-9)- def test_with_displays_the_breaks_are_at_that_displays_thirds_inside_the_contact(self):+ def test_with_displays_adjacent_lit_thirds_stay_continuous_inside_the_contact(self):from PySide6.QtCore import QPointFcanvas = self.canvas(WITH_DISPLAYS)own, external = canvas.tile_rect(OWN), self.external()- self.assert_breaks(canvas, [own.left() + (external["x"] + 2 * external["w"] / 3) * canvas._scale])+ pieces = self.bottom_pieces(canvas)+ self.assertEqual(len(pieces), 1)+ contact = canvas._side_contacts(DESK)[0][1]+ self.assertAlmostEqual(pieces[0][1].x(),+ own.left() + (contact[1] - WITH_DISPLAYS[OWN]["x"]) * canvas._scale + 2)+ self.assertAlmostEqual(pieces[0][2].x(),+ own.left() + (contact[2] - WITH_DISPLAYS[OWN]["x"]) * canvas._scale - 2)y = own.top() + 80 * canvas._scale + 4end = own.left() + (external["x"] + 0.9 * external["w"]) * canvas._scaleself.assertEqual(canvas._third_at(QPointF(end, y)), (DESK, "end"))@@ -351,7 +385,16 @@ class MapTicks(unittest.TestCase):with self.subTest(lit=lit):canvas = self.canvas(tiles, desk={"thirds": lit, "lit": lit})own = canvas.tile_rect(OWN)- self.assert_breaks(canvas, [own.left() + own.width() / 3, own.left() + 2 * own.width() / 3])+ if lit == PARTS:+ pieces = self.bottom_pieces(canvas)+ self.assertTrue(pieces)+ self.assertTrue(all(path[4] == 4.0 for path in pieces))+ for before, after in zip(pieces, pieces[1:]):+ painted_gap = (after[1].x() - after[4] / 2) - (before[2].x() + before[4] / 2)+ self.assertAlmostEqual(painted_gap, 0.0)+ else:+ self.assert_breaks(canvas, [own.left() + own.width() / 3,+ own.left() + 2 * own.width() / 3])if __name__ == "__main__":diff --git a/win_app/tests/test_user_name_locale_regression.py b/win_app/tests/test_user_name_locale_regression.pynew file mode 100644index 0000000..03200b5--- /dev/null+++ b/win_app/tests/test_user_name_locale_regression.py@@ -0,0 +1,45 @@+import unittest+from unittest import mock++from PySide6.QtWidgets import QApplication++import crossing_ledger+import widgets+from core import i18n, locale, peerlist+++class UserNameLocaleTests(unittest.TestCase):+ @classmethod+ def setUpClass(cls):+ cls.app = QApplication.instance() or QApplication([])++ def test_crossing_name_preserves_typed_spelling_in_us_english(self):+ peers = [{"id": "synthetic-peer", "token": "synthetic-token",+ "name": "Colourful", "port": 24800}]+ source = peerlist.label_for(peers, peer_id="synthetic-peer")+ with mock.patch.object(i18n, "is_source", return_value=True), \+ mock.patch.object(locale, "is_us_region", return_value=True):+ name = crossing_ledger._Name()+ name.resize(600, 40)+ name.set_name(source)+ self.assertEqual(name.full_text, "Colourful")+ self.assertEqual(name.accessibleName(), "Colourful")+ self.assertEqual(name.text(), "Colourful")+ self.assertEqual(name.toolTip(), "Colourful")++ def test_direct_and_interpolated_typed_fields_keep_their_spelling(self):+ with mock.patch.object(i18n, "_language", "en"), \+ mock.patch.object(i18n, "_translations", i18n.load("en")), \+ mock.patch.object(locale, "is_us_region", return_value=True):+ for value in ("Colourful", "Favourite centre", "colour.example", "Organising"):+ with self.subTest(value=value):+ label = widgets.label(value, "note")+ label.setToolTip(value)+ self.assertEqual(label.text(), value)+ self.assertEqual(label.toolTip(), value)+ label.setText(i18n.tr("Favourite: {name}").format(name=value))+ self.assertEqual(label.text(), "Favorite: " + value)+++if __name__ == "__main__":+ unittest.main()diff --git a/win_app/widgets.py b/win_app/widgets.pyindex cdd0a57..52a8024 100644--- a/win_app/widgets.py+++ b/win_app/widgets.py@@ -38,7 +38,6 @@ from PySide6.QtWidgets import (import motionimport themeimport tokens-from core.locale import americanisefrom core.i18n import N_, trfrom core import ways as core_ways@@ -126,59 +125,12 @@ def focus_ring_visible(widget) -> bool:def label(text: str, role: str, wrap: bool = False) -> QLabel:- item = QLabel(americanise(text))+ item = QLabel(text)item.setProperty("vernier", role)item.setWordWrap(wrap)return item-def install_text_localisation() -> None:- """Route Qt's visible text setters through the shared spelling map."""- from PySide6.QtWidgets import QMessageBox, QMenu-- def wrap(cls, method, positions=(0,)):- original = getattr(cls, method)- if getattr(original, "_beamer_localised", False):- return-- def setter(self, *args, **kwargs):- args = list(args)- for position in positions:- if position < len(args) and isinstance(args[position], str):- args[position] = americanise(args[position])- return original(self, *args, **kwargs)-- setter._beamer_localised = True- setattr(cls, method, setter)-- def wrap_static(cls, method, positions):- original = getattr(cls, method)- if getattr(original, "_beamer_localised", False):- return-- def setter(*args, **kwargs):- args = list(args)- for position in positions:- if position < len(args) and isinstance(args[position], str):- args[position] = americanise(args[position])- return original(*args, **kwargs)-- setter._beamer_localised = True- setattr(cls, method, staticmethod(setter))-- for cls, method in (- (QLabel, "setText"), (QAbstractButton, "setText"), (QGroupBox, "setTitle"),- (QMenu, "setTitle"), (QMenu, "addAction"), (QWidget, "setToolTip"),- (QAction, "setText"), (QMessageBox, "setText"), (QMessageBox, "setInformativeText"),- (QMessageBox, "setDetailedText"),- (QSystemTrayIcon, "setToolTip"), (QSystemTrayIcon, "showMessage"),- ):- wrap(cls, method, (0, 1) if method == "showMessage" else (0,))- for method in ("critical", "information", "question", "warning"):- wrap_static(QMessageBox, method, (1, 2))- wrap_static(QToolTip, "showText", (1,))--def set_role(widget: QWidget, role: str) -> None:if widget.property("vernier") != role:widget.setProperty("vernier", role)