Remember input selections before an app gains focus
This commit is contained in:
1 parent
cd73dc6cfd
commit
2841563e6c
5 files changed
+148
-40
No files matched your search
@@ -36,7 +36,7 @@ BarWidget {
|
||||
// xkb's own table rather than maintained by hand.
|
||||
property var layoutBriefs: ({})
|
||||
readonly property string layoutLabel: KeyboardLayoutModel.shortLabel(layoutFull, layoutBriefs)
|
||||
property var inputState: ({})
|
||||
readonly property var inputState: InputMethodState.state
|
||||
readonly property bool multipleInputs: (inputState.methods || []).length > 1
|
||||
readonly property string inputLabel: KeyboardLayoutModel.inputLabel(inputState, layoutLabel)
|
||||
|
||||
@@ -231,39 +231,6 @@ BarWidget {
|
||||
onTriggered: root.refresh()
|
||||
}
|
||||
|
||||
Process {
|
||||
id: inputWatcher
|
||||
command: ["/usr/bin/python", Quickshell.env("OMARCHY_PATH") + "/default/input-methods/indicator.py"]
|
||||
running: true
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
try { root.inputState = JSON.parse(data) } catch (e) {}
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
root.inputState = ({})
|
||||
inputRestart.restart()
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: inputRestart
|
||||
interval: 5000
|
||||
onTriggered: inputWatcher.running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: inputCycle
|
||||
property int pending: 0
|
||||
command: ["/usr/bin/python", Quickshell.env("OMARCHY_PATH") + "/default/input-methods/indicator.py", "cycle"]
|
||||
onExited: {
|
||||
if (pending > 0) {
|
||||
pending--
|
||||
running = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visible: inputLabel !== "" && KeyboardLayoutModel.showIndicator(layoutLabel, multipleLayouts, multipleInputs)
|
||||
implicitWidth: button.implicitWidth
|
||||
implicitHeight: button.implicitHeight
|
||||
@@ -278,8 +245,7 @@ BarWidget {
|
||||
tooltipText: KeyboardLayoutModel.inputTooltip(root.inputState, root.layoutFull, root.multipleLayouts)
|
||||
onPressed: function(button) {
|
||||
if (root.multipleInputs && button === Qt.LeftButton) {
|
||||
if (inputCycle.running) inputCycle.pending++
|
||||
else inputCycle.running = true
|
||||
InputMethodState.cycle()
|
||||
} else if (root.multipleLayouts) {
|
||||
root.cycleLayout()
|
||||
} else if (!root.multipleInputs && root.bar) {
|
||||
|
||||
Reference in new issue
Block a user