forked from Shinonome/dots-hyprland
lock screen: add kb layout indicator
This commit is contained in:
@@ -12,6 +12,8 @@ Item {
|
|||||||
property bool vertical: false
|
property bool vertical: false
|
||||||
property bool invertSide: false
|
property bool invertSide: false
|
||||||
property bool trayOverflowOpen: false
|
property bool trayOverflowOpen: false
|
||||||
|
property bool showSeparator: true
|
||||||
|
property bool showOverflowMenu: true
|
||||||
|
|
||||||
property list<var> itemsInUserList: SystemTray.items.values.filter(i => Config.options.bar.tray.pinnedItems.includes(i.id))
|
property list<var> itemsInUserList: SystemTray.items.values.filter(i => Config.options.bar.tray.pinnedItems.includes(i.id))
|
||||||
property list<var> itemsNotInUserList: SystemTray.items.values.filter(i => !Config.options.bar.tray.pinnedItems.includes(i.id))
|
property list<var> itemsNotInUserList: SystemTray.items.values.filter(i => !Config.options.bar.tray.pinnedItems.includes(i.id))
|
||||||
@@ -29,7 +31,7 @@ Item {
|
|||||||
|
|
||||||
RippleButton {
|
RippleButton {
|
||||||
id: trayOverflowButton
|
id: trayOverflowButton
|
||||||
visible: root.unpinnedItems.length > 0
|
visible: root.showOverflowMenu && root.unpinnedItems.length > 0
|
||||||
toggled: root.trayOverflowOpen
|
toggled: root.trayOverflowOpen
|
||||||
property bool containsMouse: hovered
|
property bool containsMouse: hovered
|
||||||
|
|
||||||
@@ -101,9 +103,7 @@ Item {
|
|||||||
font.pixelSize: Appearance.font.pixelSize.larger
|
font.pixelSize: Appearance.font.pixelSize.larger
|
||||||
color: Appearance.colors.colSubtext
|
color: Appearance.colors.colSubtext
|
||||||
text: "•"
|
text: "•"
|
||||||
visible: {
|
visible: root.showSeparator && SystemTray.items.values.length > 0
|
||||||
SystemTray.items.values.length > 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ Item {
|
|||||||
|
|
||||||
property real padding: 8
|
property real padding: 8
|
||||||
property alias colBackground: background.color
|
property alias colBackground: background.color
|
||||||
|
property alias spacing: toolbarLayout.spacing
|
||||||
default property alias data: toolbarLayout.data
|
default property alias data: toolbarLayout.data
|
||||||
implicitWidth: background.implicitWidth
|
implicitWidth: background.implicitWidth
|
||||||
implicitHeight: background.implicitHeight
|
implicitHeight: background.implicitHeight
|
||||||
@@ -24,7 +25,7 @@ Item {
|
|||||||
id: background
|
id: background
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: Appearance.m3colors.m3surfaceContainer // Needs to be opaque
|
color: Appearance.m3colors.m3surfaceContainer // Needs to be opaque
|
||||||
implicitHeight: toolbarLayout.implicitHeight + root.padding * 2
|
implicitHeight: Math.max(toolbarLayout.implicitHeight + root.padding * 2, 56)
|
||||||
implicitWidth: toolbarLayout.implicitWidth + root.padding * 2
|
implicitWidth: toolbarLayout.implicitWidth + root.padding * 2
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import qs.services
|
|||||||
import qs.modules.common
|
import qs.modules.common
|
||||||
import qs.modules.common.widgets
|
import qs.modules.common.widgets
|
||||||
import qs.modules.common.functions
|
import qs.modules.common.functions
|
||||||
|
import qs.modules.bar as Bar
|
||||||
|
import Quickshell.Services.SystemTray
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: root
|
id: root
|
||||||
@@ -135,29 +137,108 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Toolbar {
|
Toolbar {
|
||||||
|
id: leftIsland
|
||||||
anchors {
|
anchors {
|
||||||
right: mainIsland.left
|
right: mainIsland.left
|
||||||
top: mainIsland.top
|
top: mainIsland.top
|
||||||
bottom: mainIsland.bottom
|
bottom: mainIsland.bottom
|
||||||
rightMargin: 20
|
rightMargin: 10
|
||||||
|
}
|
||||||
|
scale: root.toolbarScale
|
||||||
|
opacity: root.toolbarOpacity
|
||||||
|
|
||||||
|
// Username
|
||||||
|
RowLayout {
|
||||||
|
spacing: 6
|
||||||
|
Layout.leftMargin: 8
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
MaterialSymbol {
|
||||||
|
id: userIcon
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
fill: 1
|
||||||
|
text: "account_circle"
|
||||||
|
iconSize: Appearance.font.pixelSize.huge
|
||||||
|
color: Appearance.colors.colOnSurfaceVariant
|
||||||
|
}
|
||||||
|
StyledText {
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
text: SystemInfo.username
|
||||||
|
color: Appearance.colors.colOnSurfaceVariant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard layout (Xkb)
|
||||||
|
Loader {
|
||||||
|
Layout.leftMargin: 8
|
||||||
|
Layout.rightMargin: 8
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
active: true
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: RowLayout {
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
MaterialSymbol {
|
||||||
|
id: keyboardIcon
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
fill: 1
|
||||||
|
text: "keyboard_alt"
|
||||||
|
iconSize: Appearance.font.pixelSize.huge
|
||||||
|
color: Appearance.colors.colOnSurfaceVariant
|
||||||
|
}
|
||||||
|
StyledText {
|
||||||
|
text: HyprlandXkb.currentLayoutCode
|
||||||
|
color: Appearance.colors.colOnSurfaceVariant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard layout (Fcitx)
|
||||||
|
Bar.SysTray {
|
||||||
|
Layout.rightMargin: 10
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
showSeparator: false
|
||||||
|
showOverflowMenu: false
|
||||||
|
pinnedItems: SystemTray.items.values.filter(i => i.id == "Fcitx")
|
||||||
|
visible: pinnedItems.length > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Toolbar {
|
||||||
|
id: rightIsland
|
||||||
|
anchors {
|
||||||
|
left: mainIsland.right
|
||||||
|
top: mainIsland.top
|
||||||
|
bottom: mainIsland.bottom
|
||||||
|
leftMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
scale: root.toolbarScale
|
scale: root.toolbarScale
|
||||||
opacity: root.toolbarOpacity
|
opacity: root.toolbarOpacity
|
||||||
|
|
||||||
ToolbarButton {
|
RowLayout {
|
||||||
id: powerButton
|
spacing: 6
|
||||||
implicitWidth: height
|
Layout.fillHeight: true
|
||||||
|
Layout.leftMargin: 10
|
||||||
|
Layout.rightMargin: 10
|
||||||
|
|
||||||
onClicked: Session.poweroff()
|
MaterialSymbol {
|
||||||
|
id: boltIcon
|
||||||
contentItem: MaterialSymbol {
|
Layout.alignment: Qt.AlignVCenter
|
||||||
anchors.centerIn: parent
|
Layout.leftMargin: -2
|
||||||
horizontalAlignment: Text.AlignHCenter
|
Layout.rightMargin: -2
|
||||||
verticalAlignment: Text.AlignVCenter
|
fill: 1
|
||||||
iconSize: 24
|
text: Battery.isCharging ? "bolt" : "battery_android_full"
|
||||||
text: "power_settings_new"
|
iconSize: Appearance.font.pixelSize.huge
|
||||||
color: Appearance.colors.colOnSurfaceVariant
|
animateChange: true
|
||||||
|
color: (Battery.isLow && !Battery.isCharging) ? Appearance.colors.colError : Appearance.colors.colOnSurfaceVariant
|
||||||
|
}
|
||||||
|
StyledText {
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
text: Math.round(Battery.percentage * 100)
|
||||||
|
color: (Battery.isLow && !Battery.isCharging) ? Appearance.colors.colError : Appearance.colors.colOnSurfaceVariant
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,26 +258,20 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
ToolbarButton {
|
||||||
spacing: 6
|
id: powerButton
|
||||||
Layout.fillHeight: true
|
implicitWidth: height
|
||||||
Layout.leftMargin: 10
|
|
||||||
Layout.rightMargin: 10
|
|
||||||
|
|
||||||
MaterialSymbol {
|
onClicked: Session.poweroff()
|
||||||
id: boltIcon
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
contentItem: MaterialSymbol {
|
||||||
Layout.leftMargin: -2
|
anchors.centerIn: parent
|
||||||
Layout.rightMargin: -2
|
horizontalAlignment: Text.AlignHCenter
|
||||||
fill: 1
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: Battery.isCharging ? "bolt" : "battery_android_full"
|
iconSize: 24
|
||||||
iconSize: Appearance.font.pixelSize.huge
|
text: "power_settings_new"
|
||||||
animateChange: true
|
color: Appearance.colors.colOnSurfaceVariant
|
||||||
}
|
}
|
||||||
StyledText {
|
}
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
text: (Battery.percentage * 100)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user