Files
omarchy/shell/Commons/InputMethodState.qml
T
David Heinemeier HanssonandClaude Opus 5.5 a044bec0ab Run the input-method scripts with the system Python
A bare python resolves through PATH, so a mise, pyenv or venv interpreter
could run them without the system's PyGObject.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 08:08:09 +09:00

39 lines
800 B
QML

pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
property var state: ({})
function cycle(back) {
if (!watcher.running) return false
watcher.write(back ? "cycle back\n" : "cycle\n")
return true
}
// One reader and pending selection for every monitor's keyboard widget.
Process {
id: watcher
command: ["/usr/bin/python3", Quickshell.env("OMARCHY_PATH") + "/default/input-methods/indicator.py"]
running: true
stdinEnabled: true
stdout: SplitParser {
onRead: data => {
try { root.state = JSON.parse(data) } catch (e) {}
}
}
onExited: {
root.state = ({})
restart.restart()
}
}
Timer {
id: restart
interval: 5000
onTriggered: watcher.running = true
}
}