5.6 KiB
5.6 KiB
hangul-overview-latin — GNOME Shell Extension Plan
Goal
When the Activities Overview opens, ensure input is in Latin mode so overview search works immediately, even if ibus-hangul was in Hangul mode.
Environment
- Fedora Workstation, vanilla GNOME, Wayland
- ibus-hangul input engine (
hangulIBus engine) - GNOME 45+ extension format (ESM
import,metadata.jsonwith appropriateshell-version)- First step: check actual Shell version with
gnome-shell --versionand setshell-versionaccordingly.
- First step: check actual Shell version with
Approach
Two candidate strategies, in order of preference:
Strategy A (primary): switch input source to English on overview open
- Use
getInputSourceManager()fromresource:///org/gnome/shell/ui/status/keyboard.js. - On
Main.overviewshowingsignal, if current source ishangul, activate thexkb:us::eng(or first non-IBus) source. - Pros: simple, engine-agnostic, reliable.
- Cons: changes the source, not the internal hangul/latin mode. User must switch source back (Super+Space) after leaving overview.
- Optional enhancement: remember previous source and restore it on
hiddensignal. Decide during implementation — restoring may be annoying if the user starts typing an app name and launches it (focus lands in new app with Hangul source restored). Ship without restore first; add behind a pref if wanted.
Strategy B (stretch): flip ibus-hangul's internal InputMode to latin
- ibus-hangul ≥ 1.5.15 exposes an
InputModeproperty via the IBus property API. - From a Shell extension, reach it through
IBus.Bus→ global engine property activation:ibus.set_global_engine()is not needed; instead useIBusManager(misc/ibusManager.js) andactivateProperty('InputMode.Latin', ...)style calls — verify exact property key by runningibus engine hanguland inspecting withibusintrospection or reading ibus-hangul source (src/engine.c, property name is likelyInputMode). - Pros: user stays on hangul source; just the mode flips — closest to the stated desire.
- Cons: depends on ibus-hangul version/property names; more fragile.
Plan: implement A first, get it working, then attempt B as a follow-up. If B works, prefer it and drop the source-switching path.
File Structure
hangul-overview-latin@timothykim.net/
├── metadata.json
└── extension.js
No prefs UI in v1. If restore-on-hide becomes a toggle, add prefs.js + GSettings schema later.
metadata.json
{
"uuid": "hangul-overview-latin@timothykim.net",
"name": "Hangul Overview Latin",
"description": "Switch to Latin input when the Activities Overview opens",
"shell-version": ["48"],
"url": ""
}
(Adjust shell-version to actual.)
extension.js sketch (Strategy A)
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {getInputSourceManager} from 'resource:///org/gnome/shell/ui/status/keyboard.js';
export default class HangulOverviewLatin {
enable() {
this._ism = getInputSourceManager();
this._showingId = Main.overview.connect('showing', () => {
const current = this._ism.currentSource;
if (current?.type === 'ibus' && current.id.startsWith('hangul')) {
const sources = this._ism.inputSources;
for (const i in sources) {
if (sources[i].type === 'xkb') { sources[i].activate(); break; }
}
}
});
}
disable() {
Main.overview.disconnect(this._showingId);
this._showingId = null;
this._ism = null;
}
}
Verify against actual keyboard.js API for the installed Shell version — property names (currentSource, inputSources, activate()) drift between releases. Read /usr/share/gnome-shell/ resources or upstream source for the matching tag.
Implementation Steps
gnome-shell --version; note version.- Scaffold extension dir under
~/.local/share/gnome-shell/extensions/. - Confirm the extension class shape against GNOME 45+ docs (
Extensionbase class fromresource:///org/gnome/shell/extensions/extension.jsis the current convention — use it, not a bare class). - Implement Strategy A.
- Test (see below).
- Investigate Strategy B: inspect ibus-hangul property names, try
Main.panel.statusArea/IBusManagerproperty activation from Looking Glass (lg) interactively before writing code. - If B works, gate A behind it or remove.
Testing (Wayland)
- No
Alt+F2 rrestart on Wayland. Options:- Nested session:
dbus-run-session -- gnome-shell --nested --wayland(extension must be enabled inside it), or - Log out/in per iteration.
- Nested session:
- Use Looking Glass (
lgvia run dialog... unavailable on Wayland restart-free flow; still usable for live inspection: Super, typelgwon't work — useAlt+F2is X11-only; on Wayland open Looking Glass viaglobal.contextfrom a nested session or usejournalctl -f -o cat /usr/bin/gnome-shellfor logs). - Log with
console.log(); watchjournalctl --user -f | grep -i hangul. - Test matrix:
- Hangul source + hangul mode → Super → search types Latin.
- Already on English source → Super → no-op.
- Rapid open/close of overview → no signal leaks (check
disable()/re-enable cycles).
Edge Cases / Open Questions
- Overview also opens via hot corner and
Superin app grid state —showingsignal covers all entry paths; confirm. disable()must disconnect signals (EGO review requirement if ever published).- Interaction with Super+Space source cycling while overview is open.
- Does typing in overview search re-trigger IBus engine focus? (Search entry is a Clutter/St entry; IBus applies — that's why the problem exists at all.)