feat: wip sddm theme
This commit is contained in:
1 parent
c3c1f29df0
commit
d503ff7496
7 files changed
+360
No files matched your search
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
[General]
|
||||
background=
|
||||
Reference in new issue
Block a user