mirror of
https://github.com/luneko/SweetTokyoNight.git
synced 2025-12-16 16:39:52 +01:00
KDE: Fix KeyboardLayoutButton in lockscreen
This commit is contained in:
@@ -32,21 +32,31 @@ PlasmaComponents.ToolButton {
|
|||||||
|
|
||||||
iconName: "input-keyboard"
|
iconName: "input-keyboard"
|
||||||
implicitWidth: minimumWidth
|
implicitWidth: minimumWidth
|
||||||
text: layout.currentLayoutDisplayName
|
text: layout.layoutName()
|
||||||
font.pointSize: Math.max(fontSize,theme.defaultFont.pointSize)
|
font.pointSize: Math.max(fontSize,theme.defaultFont.pointSize)
|
||||||
|
|
||||||
Accessible.name: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to change keyboard layout", "Switch layout")
|
Accessible.name: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to change keyboard layout", "Switch layout")
|
||||||
|
|
||||||
visible: layout.layouts.length > 1
|
visible: layout.shouldBeVisible()
|
||||||
|
|
||||||
onClicked: layout.nextLayout()
|
onClicked: layout.nextLayout()
|
||||||
|
|
||||||
KeyboardLayout {
|
KeyboardLayout {
|
||||||
id: layout
|
id: layout
|
||||||
function nextLayout() {
|
function nextLayout() {
|
||||||
var layouts = layout.layouts;
|
layout.layout = (layout.layout + 1) % layout.layoutsList.length;
|
||||||
var index = (layouts.indexOf(layout.currentLayout)+1) % layouts.length;
|
}
|
||||||
layout.currentLayout = layouts[index];
|
|
||||||
|
function shouldBeVisible() {
|
||||||
|
return layout.layoutsList.length > 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function layoutName() {
|
||||||
|
return (layout.isInitialized() && layout.layoutsList[layout.layout].displayName) || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isInitialized() {
|
||||||
|
return layout.layoutsList.length > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user