fix lang change hotkey
This commit is contained in:
parent
b41168aaaf
commit
90dd142107
2 changed files with 16 additions and 23 deletions
|
|
@ -53,8 +53,7 @@ in {
|
|||
input {
|
||||
keyboard {
|
||||
xkb {
|
||||
layout "us,pt"
|
||||
variant ",br"
|
||||
layout "us,br"
|
||||
}
|
||||
}
|
||||
touchpad {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import QtQuick
|
|||
|
||||
BarPill {
|
||||
id: root
|
||||
layer.enabled: true
|
||||
|
||||
property int currentIdx: 0
|
||||
property var names: []
|
||||
|
|
@ -18,32 +19,24 @@ BarPill {
|
|||
}
|
||||
|
||||
Process {
|
||||
command: ["niri", "msg", "--json", "keyboard-layouts"]
|
||||
command: ["niri", "msg", "--json", "event-stream"]
|
||||
running: true
|
||||
stdout: SplitParser {
|
||||
splitMarker: ""
|
||||
splitMarker: "\n"
|
||||
onRead: data => {
|
||||
try {
|
||||
const kl = JSON.parse(data)
|
||||
root.currentIdx = kl.current_idx
|
||||
root.names = kl.names
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: niri
|
||||
function onRawEventReceived(event) {
|
||||
try {
|
||||
const ev = JSON.parse(event)
|
||||
if (!ev.KeyboardLayoutsChanged) return
|
||||
const ev = JSON.parse(data)
|
||||
if (ev.KeyboardLayoutsChanged) {
|
||||
const kl = ev.KeyboardLayoutsChanged.keyboard_layouts
|
||||
root.currentIdx = kl.current_idx
|
||||
root.names = kl.names
|
||||
} else if (ev.KeyboardLayoutSwitched) {
|
||||
root.currentIdx = ev.KeyboardLayoutSwitched.idx
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: ""
|
||||
|
|
@ -52,6 +45,7 @@ BarPill {
|
|||
font.family: Theme.font
|
||||
}
|
||||
Text {
|
||||
id: shortNameText
|
||||
text: root.shortName
|
||||
color: Theme.text
|
||||
font.pixelSize: Theme.fontSize
|
||||
|
|
@ -60,9 +54,9 @@ BarPill {
|
|||
Behavior on text {
|
||||
// Flash the label on layout change
|
||||
SequentialAnimation {
|
||||
PropertyAnimation { target: parent; property: "opacity"; to: 0; duration: 80 }
|
||||
PropertyAction { target: parent; property: "text" }
|
||||
PropertyAnimation { target: parent; property: "opacity"; to: 1; duration: 80 }
|
||||
PropertyAnimation { target: shortNameText; property: "opacity"; to: 0; duration: 80 }
|
||||
PropertyAction { target: shortNameText; property: "text" }
|
||||
PropertyAnimation { target: shortNameText; property: "opacity"; to: 1; duration: 80 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue