Compare commits

...
2 Commits
Author SHA1 Message Date
johannes d503ff7496 feat: wip sddm theme 2026-08-29 22:11:49 +02:00
johannes c3c1f29df0 feat: add quickshell lock screen 2026-08-29 22:11:43 +02:00
13 changed files with 603 additions and 10 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
general {
lock_cmd = hyprlock
lock_cmd = qs ipc call lockScreen lock
before_sleep_cmd = loginctl lock-session
after_sleep_cmd = hyprctl dispatch dpms on
}
+1 -1
View File
@@ -26,7 +26,7 @@ local terminal = "ghostty"
local fileManager = "nemo"
local menu = "quickshell ipc call commandPalette toggle"
local clipboard = "qs ipc call clipboardPicker open"
local lock = "hyprlock"
local lock = "qs ipc call lockScreen lock"
-----------------
@@ -0,0 +1,218 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Services.Pam
import Quickshell.Services.UPower
import "../Shared"
// The one surface in this shell that owns a real wlr-session-lock-v1 object
// instead of being a PanelWindow toggled by IpcHandler: `locked` is the
// actual lock state (the compositor keeps the session locked even if this
// process dies), and unlocking only ever happens via a successful PamContext
// result - there is no external "unlock" IPC call by design.
//
// PamContext lives INSIDE the `surface` content tree (see below), not as a
// direct child of this WlSessionLock. A PamContext declared directly under
// WlSessionLock never worked reliably in testing: not just sibling-id
// references from outside it, but even PamContext's OWN Component.onCompleted
// never fired. WlSessionLock is a `Reloadable` or Quickshell C++ type with
// unusual object-graph handling for reload support; a plain QObject child
// declared directly under it doesn't get normal QML construction/binding
// behavior. The surface's content tree, in contrast, is a perfectly ordinary
// Item tree (proven extensively: every `sessionLock.xxx` reference from
// deep inside it - the password field, hint bar, shake animation - has
// always worked reliably), so PamContext lives there instead, created fresh
// each time the surface itself is created (i.e. each time the screen locks).
WlSessionLock {
id: sessionLock
property string password: ""
property string errorText: ""
property bool awaitingResponse: false
property bool responseVisible: false
function lock() {
reset();
locked = true;
}
function reset() {
sessionLock.password = "";
sessionLock.errorText = "";
sessionLock.awaitingResponse = false;
}
surface: Component {
WlSessionLockSurface {
id: lockSurface
color: Theme.colors.background
property QtObject battery: UPower.displayDevice
PamContext {
id: authCtx
config: "hyprlock" // reuse the PAM service that already exists for hyprlock
Component.onCompleted: authCtx.start()
// NOTE: PamContext's "onMessage" that shows up in tooling is
// a private C++ slot wired internally to the pam
// conversation object - declaring `function onMessage(...)`
// here does NOT override it and is silently never called.
// The real public signal is `pamMessage()` (no args); read
// the message/response properties off this object after it
// fires.
onPamMessage: {
sessionLock.errorText = authCtx.messageIsError ? authCtx.message : "";
sessionLock.awaitingResponse = authCtx.responseRequired;
sessionLock.responseVisible = authCtx.responseVisible;
}
onCompleted: (result) => {
if (result === PamResult.Success) {
sessionLock.locked = false;
} else {
sessionLock.errorText = "Incorrect password";
sessionLock.password = "";
sessionLock.awaitingResponse = false;
authCtx.start();
}
}
onError: (error) => {
sessionLock.errorText = "Authentication error";
sessionLock.password = "";
sessionLock.awaitingResponse = false;
authCtx.start();
}
}
SystemClock {
id: clock
precision: SystemClock.Seconds
}
Column {
anchors.centerIn: parent
spacing: Theme.geometry.spacing * 3
Column {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.geometry.spacing
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: Qt.formatDateTime(clock.date, "hh:mm")
color: Theme.colors.text
font.family: Theme.font.family
font.bold: true
font.pixelSize: 96
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: Qt.formatDateTime(clock.date, "dddd, d MMMM")
color: Theme.colors.textMuted
font.family: Theme.font.family
font.pixelSize: Theme.type.title
}
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.geometry.spacing / 2
visible: lockSurface.battery.isPresent
Text {
text: {
let p = lockSurface.battery.percentage;
if (p >= 0.9) return ""; // nf-fa-battery_full
if (p >= 0.65) return ""; // nf-fa-battery_three_quarters
if (p >= 0.4) return ""; // nf-fa-battery_half
if (p >= 0.15) return ""; // nf-fa-battery_quarter
return ""; // nf-fa-battery_empty
}
font.family: Theme.font.family
font.pixelSize: Theme.type.body
color: {
let p = lockSurface.battery.percentage;
if (p >= 0.5) return Theme.colors.success;
if (p >= 0.2) return Theme.colors.warning;
return Theme.colors.alert;
}
}
Text {
text: Math.round(lockSurface.battery.percentage * 100) + "%"
font.family: Theme.font.family
font.pixelSize: Theme.type.body
color: Theme.colors.textMuted
}
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.geometry.spacing
Item {
id: passwordShake
width: 320
height: passwordField.height
anchors.horizontalCenter: parent.horizontalCenter
SequentialAnimation {
id: shakeAnim
NumberAnimation { target: passwordShake; property: "x"; to: -8; duration: 40 }
NumberAnimation { target: passwordShake; property: "x"; to: 8; duration: 40 }
NumberAnimation { target: passwordShake; property: "x"; to: -6; duration: 40 }
NumberAnimation { target: passwordShake; property: "x"; to: 0; duration: 40 }
}
Connections {
target: sessionLock
function onErrorTextChanged() {
if (sessionLock.errorText.length > 0) shakeAnim.start();
}
function onPasswordChanged() {
if (sessionLock.password.length === 0) passwordField.text = "";
}
}
TextField {
id: passwordField
width: parent.width
placeholder: "Password"
echoMode: sessionLock.responseVisible ? TextInput.Normal : TextInput.Password
onVisibleChanged: { if (visible) focusInput(); }
onTextChanged: sessionLock.password = text
onReturnPressed: {
if (!sessionLock.awaitingResponse) return;
authCtx.respond(sessionLock.password);
sessionLock.awaitingResponse = false;
}
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: sessionLock.errorText
visible: sessionLock.errorText.length > 0
color: Theme.colors.alert
font.family: Theme.font.family
font.pixelSize: Theme.type.caption
}
HintBar {
anchors.horizontalCenter: parent.horizontalCenter
hints: [ { key: "↵", label: "Unlock" } ]
}
}
}
onVisibleChanged: {
if (visible) passwordField.focusInput();
}
}
}
}
@@ -10,6 +10,7 @@ Rectangle {
id: field
property alias text: input.text
property alias echoMode: input.echoMode
property string placeholder: ""
signal escapePressed()
@@ -13,14 +13,14 @@ QtObject {
property color surfaceHover: "#f2313244"
property color overlay: "#6011111b"
property color primary: "#cba6f7"
property color secondary: "#f5c2e7"
property color tertiary: "#89b4fa"
property color accent: "#cba6f7"
property color primary: "#74c7ec"
property color secondary: "#cba6f7"
property color tertiary: "#a6e3a1"
property color accent: "#74c7ec"
property color primaryContainer: "#24cba6f7"
property color secondaryContainer: "#24f5c2e7"
property color tertiaryContainer: "#2489b4fa"
property color primaryContainer: "#2474c7ec"
property color secondaryContainer: "#24cba6f7"
property color tertiaryContainer: "#24a6e3a1"
property color alert: "#f38ba8"
property color alertContainer: "#24f38ba8"
@@ -35,7 +35,7 @@ QtObject {
property color textMuted: "#a6adc8"
property color textOnAccent: "#e611111b"
property color border: "#1acba6f7"
property color border: "#1a74c7ec"
}
// GENERATED:COLORS:END
+14
View File
@@ -10,6 +10,7 @@ import "components/LogoutMenu"
import "components/ClipboardManager"
import "components/Notifications"
import "components/WallpaperPicker"
import "components/LockScreen"
ShellRoot {
id: root
@@ -133,4 +134,17 @@ ShellRoot {
Showcase {
id: showcase
}
// No unlock/toggle exposed here on purpose: unlocking only ever happens
// through a successful PamContext result inside LockScreen.qml.
IpcHandler {
target: "lockScreen"
function lock() {
lockScreen.locked = true;
}
}
LockScreen {
id: lockScreen
}
}
+149
View File
@@ -0,0 +1,149 @@
import QtQuick
import SddmComponents 2.0
import "components"
Rectangle {
id: root
width: Screen.width
height: Screen.height
color: Theme.colors.background
// Background Image
Image {
id: bgImage
anchors.fill: parent
// SDDM loads the theme.conf, but since we want the dynamic user wallpaper,
// we can try reading it if SDDM has permissions, or fallback to theme.conf.
// Usually, SDDM runs as user 'sddm' and might not have access to ~/.config/current-wallpaper.
// We will default to theme.conf's background.
source: config.background
fillMode: Image.PreserveAspectCrop
}
Rectangle {
anchors.fill: parent
color: Theme.colors.background
}
Item {
id: lockSurface
anchors.fill: parent
property QtObject battery: QtObject {
property bool isPresent: false
property real percentage: 0
}
Column {
anchors.centerIn: parent
spacing: Theme.geometry.spacing * 3
Column {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.geometry.spacing
property date currentTime: new Date()
Timer {
interval: 1000; running: true; repeat: true
onTriggered: parent.currentTime = new Date()
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: Qt.formatDateTime(parent.currentTime, "hh:mm")
color: Theme.colors.text
font.family: Theme.font.family
font.bold: true
font.pixelSize: 96
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: Qt.formatDateTime(parent.currentTime, "dddd, d MMMM")
color: Theme.colors.textMuted
font.family: Theme.font.family
font.pixelSize: Theme.type.title
}
}
// Battery section kept just in case you find a way to populate it,
// but hidden by default via isPresent: false
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.geometry.spacing / 2
visible: lockSurface.battery.isPresent
Text {
text: Math.round(lockSurface.battery.percentage * 100) + "%"
font.family: Theme.font.family
font.pixelSize: Theme.type.body
color: Theme.colors.textMuted
}
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.geometry.spacing
Item {
id: passwordShake
width: 320
height: passwordField.height
anchors.horizontalCenter: parent.horizontalCenter
SequentialAnimation {
id: shakeAnim
NumberAnimation { target: passwordShake; property: "x"; to: -8; duration: 40 }
NumberAnimation { target: passwordShake; property: "x"; to: 8; duration: 40 }
NumberAnimation { target: passwordShake; property: "x"; to: -6; duration: 40 }
NumberAnimation { target: passwordShake; property: "x"; to: 0; duration: 40 }
}
Connections {
target: sddm
function onLoginFailed() {
passwordField.text = ""
errorText.text = "Incorrect password"
shakeAnim.start()
}
function onLoginSucceeded() {
errorText.text = ""
}
}
TextField {
id: passwordField
width: parent.width
placeholder: "Password for " + userModel.lastUser
echoMode: TextInput.Password
onReturnPressed: {
if (text.length > 0) {
sddm.login(userModel.lastUser, text, sessionModel.lastIndex)
}
}
}
}
Text {
id: errorText
anchors.horizontalCenter: parent.horizontalCenter
text: ""
visible: text.length > 0
color: Theme.colors.alert
font.family: Theme.font.family
font.pixelSize: Theme.type.caption
}
HintBar {
anchors.horizontalCenter: parent.horizontalCenter
hints: [ { key: "↵", label: "Unlock" } ]
}
}
}
Component.onCompleted: {
passwordField.focusInput();
}
}
}
@@ -0,0 +1,35 @@
import QtQuick
// Row of "key label" keyboard hints shown under launcher-style overlays,
// e.g. [ [↑↓, "Navigate"], ["↵", "Launch"], ["Esc", "Close"] ].
Row {
id: hintBar
property var hints: []
spacing: Theme.geometry.spacing * 2
Repeater {
model: hintBar.hints
delegate: Row {
spacing: Theme.geometry.spacing / 2
Text {
text: modelData.key
color: Theme.colors.textMuted
font.family: Theme.font.family
font.bold: true
font.pixelSize: Theme.type.caption
}
Text {
text: modelData.label
color: Theme.colors.textMuted
font.family: Theme.font.family
font.pixelSize: Theme.type.caption
}
}
}
}
@@ -0,0 +1,72 @@
import QtQuick
import QtQuick.Effects
// Search/filter input with an animated focus border + glow, shared by
// CommandPalette and ClipboardManager. Navigation is exposed as signals
// (rather than exposing the inner TextInput's Keys handlers directly) so
// each caller can wire up its own list navigation.
Rectangle {
id: field
property alias text: input.text
property alias echoMode: input.echoMode
property string placeholder: ""
signal escapePressed()
signal upPressed()
signal downPressed()
signal returnPressed()
signal deleteRequested()
function focusInput() { input.forceActiveFocus(); }
height: 50
color: Theme.colors.surface
radius: Theme.geometry.radiusSmall
border.width: 1
border.color: input.activeFocus ? Theme.colors.primary : Theme.colors.border
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
layer.enabled: input.activeFocus
layer.effect: MultiEffect {
shadowEnabled: true
shadowColor: Theme.colors.primary
shadowOpacity: Theme.elevation.low.opacity
shadowBlur: Theme.elevation.low.blur
shadowHorizontalOffset: 0
shadowVerticalOffset: 0
}
TextInput {
id: input
anchors.fill: parent
anchors.margins: Theme.geometry.padding
verticalAlignment: TextInput.AlignVCenter
font.family: Theme.font.family
font.pixelSize: 18
color: Theme.colors.text
clip: true
Text {
text: field.placeholder
color: Theme.colors.textMuted
font.family: Theme.font.family
font.pixelSize: 18
anchors.verticalCenter: parent.verticalCenter
visible: input.text.length === 0
}
Keys.onEscapePressed: (event) => { field.escapePressed(); event.accepted = true; }
Keys.onUpPressed: (event) => { field.upPressed(); event.accepted = true; }
Keys.onDownPressed: (event) => { field.downPressed(); event.accepted = true; }
Keys.onReturnPressed: (event) => { field.returnPressed(); event.accepted = true; }
Keys.onPressed: (event) => {
if (event.key === Qt.Key_Delete || (event.key === Qt.Key_Backspace && input.text.length === 0)) {
field.deleteRequested();
event.accepted = true;
}
}
}
}
@@ -0,0 +1,91 @@
pragma Singleton
import QtQuick
QtObject {
id: theme
// Regenerated by wallpaper-theme.nu on every wallpaper change - don't
// hand-edit between these markers, it gets overwritten.
// GENERATED:COLORS:BEGIN
property QtObject colors: QtObject {
property color background: "#e611111b"
property color surface: "#cc181825"
property color surfaceHover: "#f2313244"
property color overlay: "#6011111b"
property color primary: "#74c7ec"
property color secondary: "#cba6f7"
property color tertiary: "#a6e3a1"
property color accent: "#74c7ec"
property color primaryContainer: "#2474c7ec"
property color secondaryContainer: "#24cba6f7"
property color tertiaryContainer: "#24a6e3a1"
property color alert: "#f38ba8"
property color alertContainer: "#24f38ba8"
property color success: "#a6e3a1"
property color successContainer: "#24a6e3a1"
property color warning: "#f9e2af"
property color warningContainer: "#24f9e2af"
property color info: "#74c7ec"
property color infoContainer: "#2474c7ec"
property color text: "#cdd6f4"
property color textMuted: "#a6adc8"
property color textOnAccent: "#e611111b"
property color border: "#1a74c7ec"
}
// GENERATED:COLORS:END
property QtObject geometry: QtObject {
property int radiusTiny: 6
property int radiusSmall: 8
property int radiusMedium: 10
property int pillRadius: 100
property int padding: 12
property int spacing: 8
}
property QtObject animation: QtObject {
property int durationFast: 150
property int durationNormal: 250
property int durationSlow: 400
}
// Named spring presets, so call sites stop hand-rolling
// `SpringAnimation { spring: 4; damping: 0.3 }` with slightly different
// numbers each time.
property QtObject motion: QtObject {
property QtObject springSnappy: QtObject { property real spring: 4; property real damping: 0.3 }
property QtObject springSoft: QtObject { property real spring: 3; property real damping: 0.2 }
}
// Type scale. Family stays fixed - this is only about size/weight steps.
property QtObject type: QtObject {
property int caption: 11
property int body: 13
property int label: 14
property int title: 18
property int display: 24
}
property QtObject iconSize: QtObject {
property int small: 14
property int medium: 18
property int large: 24
}
// Named shadow presets for MultiEffect glows, keyed by how prominent the
// glow should read (e.g. hover vs. focus vs. an always-on active state).
property QtObject elevation: QtObject {
property QtObject low: QtObject { property real blur: 0.4; property real opacity: 0.35 }
property QtObject medium: QtObject { property real blur: 0.6; property real opacity: 0.5 }
property QtObject high: QtObject { property real blur: 0.8; property real opacity: 0.65 }
}
property QtObject font: QtObject {
property string family: "JetBrainsMono Nerd Font"
}
}
@@ -0,0 +1,3 @@
singleton Theme 1.0 Theme.qml
TextField 1.0 TextField.qml
HintBar 1.0 HintBar.qml
@@ -0,0 +1,8 @@
[SddmGreeterTheme]
Name=Quickshell Login
Description=A theme ported from my Quickshell lockscreen
Author=Johannes
Version=1.0
Type=sddm-theme
MainScript=Main.qml
ConfigFile=theme.conf
+2
View File
@@ -0,0 +1,2 @@
[General]
background=