From df56224df6990b5714f212bd9f0651c6d38ce70f Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 5 Sep 2025 13:07:44 +0200 Subject: [PATCH] lock screen: add kb layout indicator --- .config/quickshell/ii/modules/bar/SysTray.qml | 8 +- .../ii/modules/common/widgets/Toolbar.qml | 3 +- .../ii/modules/lock/LockSurface.qml | 139 ++++++++++++++---- 3 files changed, 113 insertions(+), 37 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/SysTray.qml b/.config/quickshell/ii/modules/bar/SysTray.qml index 9519a6d6d..cfeb42752 100644 --- a/.config/quickshell/ii/modules/bar/SysTray.qml +++ b/.config/quickshell/ii/modules/bar/SysTray.qml @@ -12,6 +12,8 @@ Item { property bool vertical: false property bool invertSide: false property bool trayOverflowOpen: false + property bool showSeparator: true + property bool showOverflowMenu: true property list itemsInUserList: SystemTray.items.values.filter(i => Config.options.bar.tray.pinnedItems.includes(i.id)) property list itemsNotInUserList: SystemTray.items.values.filter(i => !Config.options.bar.tray.pinnedItems.includes(i.id)) @@ -29,7 +31,7 @@ Item { RippleButton { id: trayOverflowButton - visible: root.unpinnedItems.length > 0 + visible: root.showOverflowMenu && root.unpinnedItems.length > 0 toggled: root.trayOverflowOpen property bool containsMouse: hovered @@ -101,9 +103,7 @@ Item { font.pixelSize: Appearance.font.pixelSize.larger color: Appearance.colors.colSubtext text: "•" - visible: { - SystemTray.items.values.length > 0 - } + visible: root.showSeparator && SystemTray.items.values.length > 0 } } diff --git a/.config/quickshell/ii/modules/common/widgets/Toolbar.qml b/.config/quickshell/ii/modules/common/widgets/Toolbar.qml index 9263ffb63..aa07f8230 100644 --- a/.config/quickshell/ii/modules/common/widgets/Toolbar.qml +++ b/.config/quickshell/ii/modules/common/widgets/Toolbar.qml @@ -12,6 +12,7 @@ Item { property real padding: 8 property alias colBackground: background.color + property alias spacing: toolbarLayout.spacing default property alias data: toolbarLayout.data implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight @@ -24,7 +25,7 @@ Item { id: background anchors.centerIn: parent 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 radius: Appearance.rounding.full diff --git a/.config/quickshell/ii/modules/lock/LockSurface.qml b/.config/quickshell/ii/modules/lock/LockSurface.qml index 39d1d3378..39817d19f 100644 --- a/.config/quickshell/ii/modules/lock/LockSurface.qml +++ b/.config/quickshell/ii/modules/lock/LockSurface.qml @@ -5,6 +5,8 @@ import qs.services import qs.modules.common import qs.modules.common.widgets import qs.modules.common.functions +import qs.modules.bar as Bar +import Quickshell.Services.SystemTray MouseArea { id: root @@ -135,29 +137,108 @@ MouseArea { } Toolbar { + id: leftIsland anchors { right: mainIsland.left top: mainIsland.top 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 opacity: root.toolbarOpacity - ToolbarButton { - id: powerButton - implicitWidth: height + RowLayout { + spacing: 6 + Layout.fillHeight: true + Layout.leftMargin: 10 + Layout.rightMargin: 10 - onClicked: Session.poweroff() - - contentItem: MaterialSymbol { - anchors.centerIn: parent - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - iconSize: 24 - text: "power_settings_new" - color: Appearance.colors.colOnSurfaceVariant + MaterialSymbol { + id: boltIcon + Layout.alignment: Qt.AlignVCenter + Layout.leftMargin: -2 + Layout.rightMargin: -2 + fill: 1 + text: Battery.isCharging ? "bolt" : "battery_android_full" + iconSize: Appearance.font.pixelSize.huge + 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 { - spacing: 6 - Layout.fillHeight: true - Layout.leftMargin: 10 - Layout.rightMargin: 10 + ToolbarButton { + id: powerButton + implicitWidth: height - MaterialSymbol { - id: boltIcon - Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: -2 - Layout.rightMargin: -2 - fill: 1 - text: Battery.isCharging ? "bolt" : "battery_android_full" - iconSize: Appearance.font.pixelSize.huge - animateChange: true + onClicked: Session.poweroff() + + contentItem: MaterialSymbol { + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + iconSize: 24 + text: "power_settings_new" + color: Appearance.colors.colOnSurfaceVariant } - StyledText { - Layout.alignment: Qt.AlignVCenter - text: (Battery.percentage * 100) - } - } + } } }