Lockscreen: Use Theme.scale(Screen) instead of Theme.scale(screen)

This commit is contained in:
quadbyte 2025-08-07 23:34:55 -04:00
parent e92e205bda
commit 18a852adea

View file

@ -152,12 +152,12 @@ WlSessionLock {
ColumnLayout { ColumnLayout {
anchors.centerIn: parent anchors.centerIn: parent
spacing: 30 spacing: 30
width: Math.min(parent.width * 0.8, 400 * Theme.scale(screen)) width: Math.min(parent.width * 0.8, 400 * Theme.scale(Screen))
Rectangle { Rectangle {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
width: 80 * Theme.scale(screen) width: 80 * Theme.scale(Screen)
height: 80 * Theme.scale(screen) height: 80 * Theme.scale(Screen)
radius: 40 radius: 40
color: Theme.accentPrimary color: Theme.accentPrimary
@ -166,7 +166,7 @@ WlSessionLock {
color: "transparent" color: "transparent"
radius: 40 radius: 40
border.color: Theme.accentPrimary border.color: Theme.accentPrimary
border.width: 3 * Theme.scale(screen) border.width: 3 * Theme.scale(Screen)
z: 2 z: 2
} }
@ -183,28 +183,28 @@ WlSessionLock {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: Quickshell.env("USER") text: Quickshell.env("USER")
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 24 * Theme.scale(screen) font.pixelSize: 24 * Theme.scale(Screen)
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.textPrimary color: Theme.textPrimary
} }
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
height: 50 * Theme.scale(screen) height: 50 * Theme.scale(Screen)
radius: 25 radius: 25
color: Theme.surface color: Theme.surface
opacity: passwordInput.activeFocus ? 0.8 : 0.3 opacity: passwordInput.activeFocus ? 0.8 : 0.3
border.color: passwordInput.activeFocus ? Theme.accentPrimary : Theme.outline border.color: passwordInput.activeFocus ? Theme.accentPrimary : Theme.outline
border.width: 2 * Theme.scale(screen) border.width: 2 * Theme.scale(Screen)
TextInput { TextInput {
id: passwordInput id: passwordInput
anchors.fill: parent anchors.fill: parent
anchors.margins: 15 * Theme.scale(screen) anchors.margins: 15 * Theme.scale(Screen)
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 16 * Theme.scale(screen) font.pixelSize: 16 * Theme.scale(Screen)
color: Theme.textPrimary color: Theme.textPrimary
echoMode: TextInput.Password echoMode: TextInput.Password
passwordCharacter: "●" passwordCharacter: "●"
@ -218,7 +218,7 @@ WlSessionLock {
text: "Enter password..." text: "Enter password..."
color: Theme.textSecondary color: Theme.textSecondary
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 16 * Theme.scale(screen) font.pixelSize: 16 * Theme.scale(Screen)
visible: !passwordInput.text && !passwordInput.activeFocus visible: !passwordInput.text && !passwordInput.activeFocus
} }
@ -238,7 +238,7 @@ WlSessionLock {
id: errorMessageRect id: errorMessageRect
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
width: parent.width * 0.8 width: parent.width * 0.8
height: 44 * Theme.scale(screen) height: 44 * Theme.scale(Screen)
color: Theme.overlay color: Theme.overlay
radius: 18 radius: 18
visible: lock.errorMessage !== "" visible: lock.errorMessage !== ""
@ -248,7 +248,7 @@ WlSessionLock {
text: lock.errorMessage text: lock.errorMessage
color: Theme.error color: Theme.error
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 14 * Theme.scale(screen) font.pixelSize: 14 * Theme.scale(Screen)
opacity: 1 opacity: 1
visible: lock.errorMessage !== "" visible: lock.errorMessage !== ""
} }
@ -256,13 +256,13 @@ WlSessionLock {
Rectangle { Rectangle {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
width: 120 * Theme.scale(screen) width: 120 * Theme.scale(Screen)
height: 44 * Theme.scale(screen) height: 44 * Theme.scale(Screen)
radius: 18 radius: 18
opacity: unlockButtonArea.containsMouse ? 0.8 : 0.5 opacity: unlockButtonArea.containsMouse ? 0.8 : 0.5
color: unlockButtonArea.containsMouse ? Theme.accentPrimary : Theme.surface color: unlockButtonArea.containsMouse ? Theme.accentPrimary : Theme.surface
border.color: Theme.accentPrimary border.color: Theme.accentPrimary
border.width: 2 * Theme.scale(screen) border.width: 2 * Theme.scale(Screen)
enabled: !lock.authenticating enabled: !lock.authenticating
Text { Text {
@ -270,7 +270,7 @@ WlSessionLock {
anchors.centerIn: parent anchors.centerIn: parent
text: lock.authenticating ? "..." : "Unlock" text: lock.authenticating ? "..." : "Unlock"
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 16 * Theme.scale(screen) font.pixelSize: 16 * Theme.scale(Screen)
font.bold: true font.bold: true
color: unlockButtonArea.containsMouse ? Theme.onAccent : Theme.accentPrimary color: unlockButtonArea.containsMouse ? Theme.onAccent : Theme.accentPrimary
} }
@ -295,12 +295,12 @@ WlSessionLock {
} }
Rectangle { Rectangle {
width: infoColumn.width + 32 * Theme.scale(screen) width: infoColumn.width + 32 * Theme.scale(Screen)
height: infoColumn.height + 8 * Theme.scale(screen) height: infoColumn.height + 8 * Theme.scale(Screen)
color: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" color: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
bottomLeftRadius: 20 * Theme.scale(screen) bottomLeftRadius: 20 * Theme.scale(Screen)
bottomRightRadius: 20 * Theme.scale(screen) bottomRightRadius: 20 * Theme.scale(Screen)
ColumnLayout { ColumnLayout {
id: infoColumn id: infoColumn
@ -314,7 +314,7 @@ WlSessionLock {
id: timeText id: timeText
text: Qt.formatDateTime(new Date(), "HH:mm") text: Qt.formatDateTime(new Date(), "HH:mm")
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 48 * Theme.scale(screen) font.pixelSize: 48 * Theme.scale(Screen)
font.bold: true font.bold: true
color: Theme.textPrimary color: Theme.textPrimary
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -324,7 +324,7 @@ WlSessionLock {
id: dateText id: dateText
text: Qt.formatDateTime(new Date(), "dddd, MMMM d") text: Qt.formatDateTime(new Date(), "dddd, MMMM d")
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 16 * Theme.scale(screen) font.pixelSize: 16 * Theme.scale(Screen)
color: Theme.textSecondary color: Theme.textSecondary
opacity: 0.8 opacity: 0.8
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -340,7 +340,7 @@ WlSessionLock {
Text { Text {
text: weatherData && weatherData.current_weather ? materialSymbolForCode(weatherData.current_weather.weathercode) : "cloud" text: weatherData && weatherData.current_weather ? materialSymbolForCode(weatherData.current_weather.weathercode) : "cloud"
font.family: "Material Symbols Outlined" font.family: "Material Symbols Outlined"
font.pixelSize: 28 * Theme.scale(screen) font.pixelSize: 28 * Theme.scale(Screen)
color: Theme.accentPrimary color: Theme.accentPrimary
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@ -348,7 +348,7 @@ WlSessionLock {
Text { Text {
text: weatherData && weatherData.current_weather ? ((Settings.settings.useFahrenheit !== undefined ? Settings.settings.useFahrenheit : false) ? `${Math.round(weatherData.current_weather.temperature * 9 / 5 + 32)}°F` : `${Math.round(weatherData.current_weather.temperature)}°C`) : ((Settings.settings.useFahrenheit !== undefined ? Settings.settings.useFahrenheit : false) ? "--°F" : "--°C") text: weatherData && weatherData.current_weather ? ((Settings.settings.useFahrenheit !== undefined ? Settings.settings.useFahrenheit : false) ? `${Math.round(weatherData.current_weather.temperature * 9 / 5 + 32)}°F` : `${Math.round(weatherData.current_weather.temperature)}°C`) : ((Settings.settings.useFahrenheit !== undefined ? Settings.settings.useFahrenheit : false) ? "--°F" : "--°C")
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 18 * Theme.scale(screen) font.pixelSize: 18 * Theme.scale(Screen)
color: Theme.textSecondary color: Theme.textSecondary
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@ -359,7 +359,7 @@ WlSessionLock {
color: Theme.error color: Theme.error
visible: weatherError !== "" visible: weatherError !== ""
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pixelSize: 10 * Theme.scale(screen) font.pixelSize: 10 * Theme.scale(Screen)
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
@ -401,12 +401,12 @@ WlSessionLock {
spacing: 12 spacing: 12
Rectangle { Rectangle {
width: 48 * Theme.scale(screen) width: 48 * Theme.scale(Screen)
height: 48 * Theme.scale(screen) height: 48 * Theme.scale(Screen)
radius: 24 radius: 24
color: shutdownArea.containsMouse ? Theme.error : "transparent" color: shutdownArea.containsMouse ? Theme.error : "transparent"
border.color: Theme.error border.color: Theme.error
border.width: 1 * Theme.scale(screen) border.width: 1 * Theme.scale(Screen)
MouseArea { MouseArea {
id: shutdownArea id: shutdownArea
@ -421,18 +421,18 @@ WlSessionLock {
anchors.centerIn: parent anchors.centerIn: parent
text: "power_settings_new" text: "power_settings_new"
font.family: "Material Symbols Outlined" font.family: "Material Symbols Outlined"
font.pixelSize: 24 * Theme.scale(screen) font.pixelSize: 24 * Theme.scale(Screen)
color: shutdownArea.containsMouse ? Theme.onAccent : Theme.error color: shutdownArea.containsMouse ? Theme.onAccent : Theme.error
} }
} }
Rectangle { Rectangle {
width: 48 * Theme.scale(screen) width: 48 * Theme.scale(Screen)
height: 48 * Theme.scale(screen) height: 48 * Theme.scale(Screen)
radius: 24 radius: 24
color: rebootArea.containsMouse ? Theme.accentPrimary : "transparent" color: rebootArea.containsMouse ? Theme.accentPrimary : "transparent"
border.color: Theme.accentPrimary border.color: Theme.accentPrimary
border.width: 1 * Theme.scale(screen) border.width: 1 * Theme.scale(Screen)
MouseArea { MouseArea {
id: rebootArea id: rebootArea
@ -447,18 +447,18 @@ WlSessionLock {
anchors.centerIn: parent anchors.centerIn: parent
text: "refresh" text: "refresh"
font.family: "Material Symbols Outlined" font.family: "Material Symbols Outlined"
font.pixelSize: 24 * Theme.scale(screen) font.pixelSize: 24 * Theme.scale(Screen)
color: rebootArea.containsMouse ? Theme.onAccent : Theme.accentPrimary color: rebootArea.containsMouse ? Theme.onAccent : Theme.accentPrimary
} }
} }
Rectangle { Rectangle {
width: 48 * Theme.scale(screen) width: 48 * Theme.scale(Screen)
height: 48 * Theme.scale(screen) height: 48 * Theme.scale(Screen)
radius: 24 radius: 24
color: logoutArea.containsMouse ? Theme.accentSecondary : "transparent" color: logoutArea.containsMouse ? Theme.accentSecondary : "transparent"
border.color: Theme.accentSecondary border.color: Theme.accentSecondary
border.width: 1 * Theme.scale(screen) border.width: 1 * Theme.scale(Screen)
MouseArea { MouseArea {
id: logoutArea id: logoutArea
@ -473,7 +473,7 @@ WlSessionLock {
anchors.centerIn: parent anchors.centerIn: parent
text: "exit_to_app" text: "exit_to_app"
font.family: "Material Symbols Outlined" font.family: "Material Symbols Outlined"
font.pixelSize: 24 * Theme.scale(screen) font.pixelSize: 24 * Theme.scale(Screen)
color: logoutArea.containsMouse ? Theme.onAccent : Theme.accentSecondary color: logoutArea.containsMouse ? Theme.onAccent : Theme.accentSecondary
} }
} }