Skip to content

Commit 0d12f56

Browse files
committed
Implement elementaryOS Pantheon autoconfig
1 parent c6a16c8 commit 0d12f56

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/frontend/PlatformConfig.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,37 @@ void setupFcitx5InputMethod() {
412412
}
413413
}
414414

415+
void setupPantheonIME() {
416+
// Pantheon (elementary OS) uses iBus directly, not GNOME input sources.
417+
// Add OpenBangla to iBus preload engines so it appears in Pantheon's
418+
// Input Method settings panel.
419+
QString key = "/desktop/ibus/general/preload-engines";
420+
421+
QProcess readProcess;
422+
readProcess.start("dconf", {"read", key});
423+
readProcess.waitForFinished();
424+
425+
QString engines;
426+
if (readProcess.exitCode() == 0) {
427+
engines = readProcess.readAllStandardOutput().trimmed();
428+
}
429+
430+
if (engines.contains("'OpenBangla'")) {
431+
LOG_DEBUG("OpenBangla already in iBus preload engines\n");
432+
return;
433+
}
434+
435+
if (engines.isEmpty() || engines == "@as []") {
436+
engines = "['OpenBangla']";
437+
} else {
438+
// Insert before the closing bracket
439+
engines = engines.left(engines.length() - 1) + ", 'OpenBangla']";
440+
}
441+
442+
writeDConfSetting(key, engines);
443+
LOG_DEBUG("Added OpenBangla to iBus preload engines for Pantheon\n");
444+
}
445+
415446
void setupKdeIME() {
416447
setupKdeVirtualKeyboard();
417448
setupFcitx5InputMethod();
@@ -422,6 +453,8 @@ void setupInputSources() {
422453

423454
if(de == DesktopEnvironment::GNOME) {
424455
setupGnomeIME();
456+
} else if(de == DesktopEnvironment::Pantheon) {
457+
setupPantheonIME();
425458
} else if(de == DesktopEnvironment::KDE) {
426459
setupKdeIME();
427460
} else if(de == DesktopEnvironment::macOS) {

0 commit comments

Comments
 (0)