Lock screen improvements

This commit is contained in:
Ryan Hughes
2026-06-02 23:32:53 -04:00
parent e8a8fcf183
commit 0f715dff88
4 changed files with 25 additions and 18 deletions
+3 -2
View File
@@ -206,9 +206,10 @@ accent = "{{ accent }}"
background = "{{ background }}"
background-alpha = 0.8
text = "{{ foreground }}"
placeholder = "{{ mix foreground background 34% }}"
text-error = "{{ red }}"
border = "{{ shell_gradient hyprland_active_border foreground }}"
border-active = "{{ shell_gradient hyprland_active_border accent }}"
border = "{{ foreground }}"
border-active = "{{ accent }}"
border-error = "{{ red }}"
border-alpha = 1.0
# selection is the text-selection tint inside the input field.
+8
View File
@@ -16,6 +16,7 @@ QtObject {
property color background: "#101315"
property color accent: "#cacccc"
property color urgent: "#a55555"
property color muted: "#707880"
// Flat dictionary of "section.key" -> raw string from shell.toml.
// Reassigning this whole property is what makes surface bindings below
@@ -49,6 +50,7 @@ QtObject {
if (role === "foreground" || role === "text") return root.foreground
if (role === "accent") return root.accent
if (role === "urgent") return root.urgent
if (role === "muted") return root.muted
if (role === "background") return root.background
if (role === "transparent") return Qt.rgba(0, 0, 0, 0)
@@ -117,6 +119,7 @@ QtObject {
readonly property QtObject lock: QtObject {
property color background: root.composed("lock.background", "lock.background-alpha", root.background, 0.8)
property color text: root.pick("lock.text", root.foreground)
property color placeholder: root.shellValues["lock.placeholder"] ? root.flatColor(root.shellValues["lock.placeholder"], Util.alpha(root.foreground, 0.66)) : Util.alpha(root.foreground, 0.66)
property color textError: root.pick("lock.text-error", root.urgent)
property color border: root.composed("lock.border", "lock.border-alpha", root.foreground, 1.0)
property color borderActive: root.composed("lock.border-active", "lock.border-alpha", root.accent, 1.0)
@@ -136,7 +139,9 @@ QtObject {
function loadColors(raw) {
var lines = String(raw || "").split("\n")
var foundAccent = false
var foundMuted = false
var color4Value = ""
var color8Value = ""
for (var i = 0; i < lines.length; i++) {
var match = lines[i].match(/^\s*([A-Za-z0-9_-]+)\s*=\s*["']?(#[0-9A-Fa-f]{6})/)
if (!match) continue
@@ -146,10 +151,13 @@ QtObject {
// theme doesn't define a separate accent. color4 appears later in the
// file so the old single-property approach clobbered accent with it.
else if (match[1] === "accent") { accent = match[2]; foundAccent = true }
else if (match[1] === "muted") { muted = match[2]; foundMuted = true }
else if (match[1] === "color4") color4Value = match[2]
else if (match[1] === "color8") color8Value = match[2]
else if (match[1] === "red" || match[1] === "color1") urgent = match[2]
}
if (!foundAccent && color4Value.length > 0) accent = color4Value
if (!foundMuted) muted = color8Value.length > 0 ? color8Value : foreground
}
// Single TOML walker for shell.toml. Both Color (surface roles) and Style
+14 -14
View File
@@ -15,17 +15,15 @@ Item {
property bool inputEnabled: true
property bool loadBackground: true
property string passwordText: ""
property real scaleFactor: 1
property bool syncingPasswordText: false
readonly property string fingerprintGlyph: "\uDB80\uDE37"
readonly property string placeholderText: fingerprintConfigured ? "Enter Password " + fingerprintGlyph : "Enter Password"
readonly property real effectiveScale: Math.max(1, scaleFactor)
readonly property int fieldWidth: Math.round(650 / effectiveScale)
readonly property int fieldHeight: Math.round(100 / effectiveScale)
readonly property int outlineThickness: Math.max(1, Math.round(4 / effectiveScale))
readonly property string placeholderText: "Password"
readonly property int fieldWidth: 650
readonly property int fieldHeight: 100
readonly property int outlineThickness: 4
readonly property int fieldFontSize: Style.font.heading
readonly property int passwordDotFontSize: Math.round(fieldFontSize * 1.3)
readonly property int passwordDotFontSize: Math.round(fieldFontSize * 2.0)
readonly property int passwordDotLetterSpacing: Math.round(fieldFontSize * 0.28)
readonly property bool showPasswordCursor: inputEnabled && !authenticatingPassword && failureMessage.length === 0
readonly property string borderToken: failureMessage.length > 0 ? "border-error" : (authenticatingPassword ? "border-active" : "border")
readonly property color borderFallback: failureMessage.length > 0 ? Color.lock.borderError : (authenticatingPassword ? Color.lock.borderActive : Color.lock.border)
@@ -90,8 +88,9 @@ Item {
autoPaddingEnabled: false
blurEnabled: root.loadBackground && wallpaper.status === Image.Ready
blur: 1.0
blurMax: 64
blurMultiplier: 1.0
blurMax: 128
blurMultiplier: 1.25
contrast: -0.08
}
MouseArea {
@@ -108,7 +107,7 @@ Item {
anchors.centerIn: parent
color: Color.lock.background
borderSpec: root.inputBorderSpec
radius: Style.cornerRadius
radius: 0
clip: true
TextInput {
@@ -125,16 +124,17 @@ Item {
enabled: root.inputEnabled && !root.authenticatingPassword
readOnly: root.authenticatingPassword
echoMode: TextInput.Password
passwordCharacter: "\u2022"
passwordCharacter: "\u25CF"
passwordMaskDelay: 0
color: Color.lock.text
selectionColor: Color.lock.selection
selectedTextColor: Color.lock.text
font.family: Style.font.family
font.pixelSize: text.length > 0 ? root.passwordDotFontSize : root.fieldFontSize
font.letterSpacing: text.length > 0 ? root.passwordDotLetterSpacing : 0
cursorVisible: activeFocus && root.showPasswordCursor && text.length > 0
cursorDelegate: Rectangle {
width: Math.max(1, Math.round(2 / root.effectiveScale))
width: 2
color: Color.lock.text
visible: passwordInput.cursorVisible
}
@@ -166,7 +166,7 @@ Item {
anchors.fill: passwordInput
text: root.authenticatingPassword ? "Checking…" : (root.failureMessage.length > 0 ? root.failureMessage : root.placeholderText)
visible: passwordInput.text.length === 0
color: (!root.authenticatingPassword && root.failureMessage.length > 0) ? Color.lock.textError : Color.lock.text
color: root.authenticatingPassword ? Color.lock.text : (root.failureMessage.length > 0 ? Color.lock.textError : Color.lock.placeholder)
font.family: Style.font.family
font.pixelSize: root.fieldFontSize
font.italic: !root.authenticatingPassword && root.failureMessage.length > 0
-2
View File
@@ -189,7 +189,6 @@ Item {
inputEnabled: root.lockRequested
loadBackground: root.locked
passwordText: root.enteredPassword
scaleFactor: lockSurface.screen && lockSurface.screen.devicePixelRatio > 0 ? lockSurface.screen.devicePixelRatio : 1
onPasswordTextEdited: function(password) { root.enteredPassword = password }
onSubmitPassword: function(password) { root.submitPassword(password) }
onClearFailureRequested: root.failureMessage = ""
@@ -220,7 +219,6 @@ Item {
inputEnabled: false
loadBackground: root.previewVisible
passwordText: ""
scaleFactor: previewWindow.screen && previewWindow.screen.devicePixelRatio > 0 ? previewWindow.screen.devicePixelRatio : 1
}
MouseArea {