From 203654bead6810f1c02fa32e38df20ad2878b1e1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 9 Oct 2026 14:44:27 +0200 Subject: [PATCH] Keep input tooltips to the name and switching shortcut --- shell/plugins/bar/widgets/KeyboardLayoutModel.js | 6 +----- test/shell.d/keyboard-layout-test.sh | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/shell/plugins/bar/widgets/KeyboardLayoutModel.js b/shell/plugins/bar/widgets/KeyboardLayoutModel.js index c9888ec5..3bfc0d4a 100644 --- a/shell/plugins/bar/widgets/KeyboardLayoutModel.js +++ b/shell/plugins/bar/widgets/KeyboardLayoutModel.js @@ -120,11 +120,7 @@ function inputLabel(state, fallback) { function inputTooltip(state, layout, multipleLayouts) { if (!state || !state.methods || state.methods.length < 2) return layout + (multipleLayouts ? "" : "\nClick to set up an input language") - var text = state.name + "\nClick to switch input language\nSuper + I to toggle input" - if (state.methods.indexOf("mozc") !== -1) - text += "\nJapanese: type a word, then Space twice for character choices" - if (multipleLayouts) text += "\nRight-click to switch keyboard layout" - return text + return (state.name || layout).replace(/^Keyboard - /, "") + " · Super + I" } function showIndicator(layoutLabel, multipleLayouts, multipleInputs) { diff --git a/test/shell.d/keyboard-layout-test.sh b/test/shell.d/keyboard-layout-test.sh index 5f204936..3d16b83d 100755 --- a/test/shell.d/keyboard-layout-test.sh +++ b/test/shell.d/keyboard-layout-test.sh @@ -14,9 +14,9 @@ assertEqual(model.inputLabel({ ...japanese, current: 'keyboard-us' }, 'EN'), 'EN assertEqual(model.inputLabel({}, 'EN'), 'EN', 'a stopped input service retains the keyboard label') assertEqual(model.inputLabel({ current: 'hangul' }, 'EN'), '한', 'Korean input has a distinct label') assertEqual(model.inputLabel({ current: 'custom', language: 'vi' }, 'EN'), 'VI', 'other engines use their reported language') -assertEqual(model.inputTooltip(japanese, 'English (US)', false).includes('Space twice'), true, 'Japanese explains character choices') -assertEqual(model.inputTooltip(japanese, 'English (US)', false).includes('Super + I'), true, 'the input toggle shortcut is discoverable') -assertEqual(model.inputTooltip(japanese, 'English (US)', true).includes('Right-click'), true, 'combined input and layout switching stays discoverable') +assertEqual(model.inputTooltip(japanese, 'English (US)', false), 'Mozc · Super + I', 'input tooltip shows only its name and shortcut') +assertEqual(model.inputTooltip(japanese, 'English (US)', true), 'Mozc · Super + I', 'multiple layouts keep the input tooltip compact') +assertEqual(model.inputTooltip({ ...japanese, current: 'keyboard-us', name: 'Keyboard - English (US)' }, 'English (US)', false), 'English (US) · Super + I', 'Latin input omits the redundant keyboard prefix') assertEqual(model.inputTooltip({ methods: ['keyboard-fr'] }, 'French', false), 'French\nClick to set up an input language', 'one foreign mode offers input setup') assertEqual(model.showIndicator('EN', false, false), false, 'English alone stays hidden') assertEqual(model.showIndicator('ENG', false, false), false, 'English before the brief table loads stays hidden')