Turn the lock screen into an unfolding glass dashboard
At rest the lock screen shows the date, glass clock and Now Playing. Typing or clicking opens a glass card with avatar, name, status and password, then wings unfold: weather (with the next forecasts) and system usage on the left, notifications and media with Cava on the right, reusing the desktop widget faces. Adds a Caps Lock warning, power controls behind a corner button, and Dashboard and Notification previews settings. The screenshot backdrop is now always fully blurred and dimmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4fa0c2c042
commit
b96b0cb683
12 files changed
+1114
-330
No files matched your search
@@ -99,6 +99,8 @@
|
||||
"backdrop": "wallpaper",
|
||||
"glass": true,
|
||||
"media": true,
|
||||
"dashboard": true,
|
||||
"notificationPreviews": true,
|
||||
"powerButtons": true,
|
||||
"pamService": ""
|
||||
},
|
||||
|
||||
@@ -222,7 +222,7 @@ Singleton {
|
||||
available: true,
|
||||
group: "system",
|
||||
icon: "",
|
||||
keywords: ["Lock now", "Preview lock screen", "Test password", "Backdrop", "Glass", "PAM", "Now Playing on lock screen", "Power buttons"]
|
||||
keywords: ["Lock now", "Preview lock screen", "Test password", "Backdrop", "Glass", "PAM", "Now Playing on lock screen", "Lock screen dashboard", "Notification previews", "Power buttons"]
|
||||
},
|
||||
{
|
||||
id: "notifications",
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Current weather from wttr.in as compact JSON: {ok, place, temperature, feels, code, description}."""
|
||||
import json, sys, urllib.parse, urllib.request
|
||||
"""Current weather from wttr.in as compact JSON: {ok, place, celsius, feelsCelsius, code, description, humidity, wind, hourly}."""
|
||||
import datetime, json, sys, urllib.parse, urllib.request
|
||||
|
||||
def upcoming(data, now, count=4):
|
||||
"""The next `count` three-hourly forecasts: [{hour, celsius, code}]. wttr.in
|
||||
usually omits the local observation time, so this machine's clock stands in."""
|
||||
try:
|
||||
observed = datetime.datetime.strptime(now['localObsDateTime'], '%Y-%m-%d %I:%M %p')
|
||||
except (KeyError, ValueError):
|
||||
observed = datetime.datetime.now()
|
||||
slots = []
|
||||
for day in data.get('weather') or []:
|
||||
for slot in day.get('hourly') or []:
|
||||
try:
|
||||
at = datetime.datetime.strptime(day['date'], '%Y-%m-%d') + datetime.timedelta(hours=int(slot['time']) // 100)
|
||||
if at > observed:
|
||||
slots.append(dict(hour=at.hour, celsius=float(slot['tempC']), code=int(slot['weatherCode'])))
|
||||
except (KeyError, ValueError):
|
||||
continue
|
||||
return slots[:count]
|
||||
|
||||
def main():
|
||||
location = sys.argv[1] if len(sys.argv) > 1 else ''
|
||||
@@ -13,7 +31,7 @@ def main():
|
||||
place = (area.get('areaName') or [{'value': ''}])[0]['value']
|
||||
print(json.dumps(dict(ok=True, place=place or location, celsius=float(now['temp_C']), feelsCelsius=float(now['FeelsLikeC']),
|
||||
code=int(now['weatherCode']), description=now['weatherDesc'][0]['value'].strip(),
|
||||
humidity=int(now['humidity']), wind=float(now['windspeedKmph']))))
|
||||
humidity=int(now['humidity']), wind=float(now['windspeedKmph']), hourly=upcoming(data, now))))
|
||||
except Exception as error: # Network, HTTP and format errors all surface as a message.
|
||||
print(json.dumps(dict(ok=False, error=str(error))))
|
||||
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import "../services"
|
||||
import "../theme"
|
||||
|
||||
// Notifications on the lock screen, newest first. Read-only: nothing can be
|
||||
// opened or acted on while locked, and bodies show only with previews on.
|
||||
ColumnLayout {
|
||||
id: root
|
||||
property real unit: 1
|
||||
function s(value) {
|
||||
return Math.round(value * unit);
|
||||
}
|
||||
readonly property bool previews: LockState.options.notificationPreviews
|
||||
spacing: s(10)
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: root.s(4)
|
||||
spacing: root.s(8)
|
||||
Text {
|
||||
text: "Notifications"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(13)
|
||||
font.weight: Font.DemiBold
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
visible: NotificationService.dnd
|
||||
text: Icons.available ? "" : "Do Not Disturb"
|
||||
font.family: Icons.available ? Icons.family : ""
|
||||
color: Qt.alpha("#ffffff", 0.6)
|
||||
font.pixelSize: root.s(13)
|
||||
}
|
||||
Rectangle {
|
||||
visible: list.count > 0
|
||||
implicitWidth: Math.max(height, countText.implicitWidth + root.s(12))
|
||||
implicitHeight: root.s(20)
|
||||
radius: height / 2
|
||||
color: Qt.alpha("#ffffff", 0.14)
|
||||
Text {
|
||||
id: countText
|
||||
anchors.centerIn: parent
|
||||
text: list.count
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(11)
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: list
|
||||
objectName: "lockNotifications"
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
clip: true
|
||||
spacing: root.s(8)
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
model: ScriptModel {
|
||||
values: NotificationService.active ? NotificationService.list : []
|
||||
}
|
||||
delegate: Rectangle {
|
||||
id: card
|
||||
required property var modelData
|
||||
readonly property string icon: NotificationService.iconFor(modelData)
|
||||
width: list.width
|
||||
height: row.implicitHeight + root.s(20)
|
||||
radius: root.s(14)
|
||||
color: Qt.alpha("#ffffff", 0.08)
|
||||
border.width: NotificationService.critical(modelData) ? 1 : 0
|
||||
border.color: Qt.alpha(Theme.urgent, 0.6)
|
||||
RowLayout {
|
||||
id: row
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.margins: root.s(10)
|
||||
spacing: root.s(10)
|
||||
Item {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.preferredWidth: root.s(30)
|
||||
Layout.preferredHeight: root.s(30)
|
||||
Image {
|
||||
id: appIcon
|
||||
anchors.fill: parent
|
||||
source: card.icon
|
||||
sourceSize: Qt.size(64, 64)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
asynchronous: true
|
||||
visible: status === Image.Ready
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: appIcon.status !== Image.Ready
|
||||
radius: root.s(8)
|
||||
color: Qt.alpha("#ffffff", 0.15)
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: NotificationService.appLabel(card.modelData).charAt(0).toUpperCase()
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(13)
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: root.s(2)
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: root.s(6)
|
||||
Text {
|
||||
text: NotificationService.appLabel(card.modelData)
|
||||
color: Qt.alpha("#ffffff", 0.7)
|
||||
font.pixelSize: root.s(11)
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.PlainText
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: NotificationService.since(card.modelData)
|
||||
color: Qt.alpha("#ffffff", 0.5)
|
||||
font.pixelSize: root.s(10)
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: card.modelData.summary
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(12)
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.PlainText
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
visible: root.previews && text !== ""
|
||||
text: card.modelData.body
|
||||
color: Qt.alpha("#ffffff", 0.75)
|
||||
font.pixelSize: root.s(11)
|
||||
textFormat: Text.StyledText
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - root.s(24)
|
||||
visible: list.count === 0
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: NotificationService.active ? "No Notifications" : NotificationService.notice || "Notifications are off"
|
||||
color: Qt.alpha("#ffffff", 0.55)
|
||||
font.pixelSize: root.s(12)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,10 @@ Singleton {
|
||||
// Live lock surfaces, for diagnostics and tests.
|
||||
property var surfaces: []
|
||||
property string realName: ""
|
||||
// Active keyboard layout, read from Hyprland when the lock screen shows.
|
||||
// Active keyboard layout and Caps Lock, read from Hyprland when the lock
|
||||
// screen shows and again whenever Caps Lock is pressed.
|
||||
property string layout: ""
|
||||
property bool capsLock: false
|
||||
readonly property bool shown: locked || previewing
|
||||
readonly property string runtimeDir: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/glassMxrph"
|
||||
|
||||
@@ -107,6 +109,10 @@ Singleton {
|
||||
testResult = "";
|
||||
return submit(password, "test");
|
||||
}
|
||||
function probeKeyboard() {
|
||||
layoutProbe.running = false;
|
||||
layoutProbe.running = true;
|
||||
}
|
||||
function finishUnlock() {
|
||||
unlocking = true;
|
||||
unlockTimer.restart();
|
||||
@@ -184,7 +190,7 @@ Singleton {
|
||||
}
|
||||
}
|
||||
onShownChanged: if (shown)
|
||||
layoutProbe.running = true
|
||||
probeKeyboard()
|
||||
Process {
|
||||
id: layoutProbe
|
||||
command: ["hyprctl", "devices", "-j"]
|
||||
@@ -194,8 +200,10 @@ Singleton {
|
||||
const keyboards = JSON.parse(text).keyboards || [];
|
||||
const main = keyboards.find(k => k.main) || keyboards[0];
|
||||
root.layout = main && main.active_keymap ? main.active_keymap.slice(0, 2).toUpperCase() : "";
|
||||
root.capsLock = keyboards.some(k => k.capsLock);
|
||||
} catch (e) {
|
||||
root.layout = "";
|
||||
root.capsLock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+801
-291
File diff suppressed because it is too large.
Load diff
@@ -2,3 +2,4 @@ singleton LockState 1.0 LockState.qml
|
||||
Lock 1.0 Lock.qml
|
||||
LockSurface 1.0 LockSurface.qml
|
||||
GlassSurface 1.0 GlassSurface.qml
|
||||
LockNotifications 1.0 LockNotifications.qml
|
||||
@@ -70,7 +70,7 @@ function validate(c) {
|
||||
for(const key of ["showAlbumArt","showProgress","showAlbum","showCava"])if(typeof c.media[key]!=="boolean")throw Error("Invalid media toggle");
|
||||
if(typeof c.media.preferredPlayer!=="string")throw Error("Invalid media preferences");
|
||||
const lock=c.lock;
|
||||
if(!lock || ["enabled","glass","media","powerButtons"].some(k=>typeof lock[k]!=="boolean") || !["wallpaper","screenshot"].includes(lock.backdrop) || typeof lock.pamService!=="string" || !/^[A-Za-z0-9._-]{0,64}$/.test(lock.pamService))throw Error("Invalid lock screen preferences");
|
||||
if(!lock || ["enabled","glass","media","dashboard","notificationPreviews","powerButtons"].some(k=>typeof lock[k]!=="boolean") || !["wallpaper","screenshot"].includes(lock.backdrop) || typeof lock.pamService!=="string" || !/^[A-Za-z0-9._-]{0,64}$/.test(lock.pamService))throw Error("Invalid lock screen preferences");
|
||||
const dw=c.desktopWidgets;
|
||||
if(!dw || dw.version!==1 || typeof dw.grid!=="boolean" || !Array.isArray(dw.items))throw Error("Invalid desktop widgets");
|
||||
const widgetIds=new Set();
|
||||
|
||||
@@ -60,7 +60,7 @@ SettingsPage {
|
||||
title: "Appearance"
|
||||
PreferenceChoice {
|
||||
label: "Backdrop"
|
||||
description: "Your wallpaper, like macOS, or a snapshot of the desktop taken when locking"
|
||||
description: "Your wallpaper, like macOS, or a heavily blurred snapshot of the desktop taken when locking"
|
||||
icon: ""
|
||||
setting: "lock.backdrop"
|
||||
choices: ["wallpaper", "screenshot"]
|
||||
@@ -71,14 +71,27 @@ SettingsPage {
|
||||
icon: ""
|
||||
setting: "lock.glass"
|
||||
}
|
||||
PreferenceToggle {
|
||||
label: "Dashboard"
|
||||
description: "When you start typing, weather and system usage unfold on the left, notifications and media on the right"
|
||||
icon: ""
|
||||
setting: "lock.dashboard"
|
||||
}
|
||||
PreferenceToggle {
|
||||
label: "Now Playing"
|
||||
description: "Below the clock, and as a media card in the dashboard"
|
||||
icon: ""
|
||||
setting: "lock.media"
|
||||
}
|
||||
PreferenceToggle {
|
||||
label: "Notification previews"
|
||||
description: "Show message text in the dashboard, not just the app and title"
|
||||
icon: ""
|
||||
setting: "lock.notificationPreviews"
|
||||
}
|
||||
PreferenceToggle {
|
||||
label: "Power buttons"
|
||||
description: "Sleep, Restart and Shut Down below the password field"
|
||||
description: "Sleep, Restart and Shut Down behind a button in the corner"
|
||||
icon: ""
|
||||
setting: "lock.powerButtons"
|
||||
}
|
||||
|
||||
@@ -141,6 +141,15 @@ Item {
|
||||
const surface = LockState.surfaces[index];
|
||||
return !!surface && surface.grabToImage(result => result.saveToFile(path));
|
||||
}
|
||||
function lockDashboard(open: bool): int {
|
||||
for (const surface of LockState.surfaces) {
|
||||
if (open)
|
||||
surface.openDashboard();
|
||||
else
|
||||
surface.closeDashboard();
|
||||
}
|
||||
return LockState.surfaces.length;
|
||||
}
|
||||
function lockSubmit(text: string): bool {
|
||||
return LockState.submit(text, LockState.previewing ? "preview" : "test");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
|
||||
// Current conditions from wttr.in, refreshed every 30 minutes.
|
||||
@@ -59,41 +61,96 @@ Face {
|
||||
}
|
||||
onLocationChanged: if (!fetch.running)
|
||||
fetch.running = true
|
||||
RowLayout {
|
||||
// The next few forecasts appear below once the face is large enough.
|
||||
readonly property var hourly: current && current.hourly ? current.hourly : []
|
||||
readonly property bool showHourly: hourly.length > 0 && height >= 150 && width >= 260
|
||||
function hourLabel(hour) {
|
||||
if (ConfigService.ready && !ConfigService.data.bar.clock.use24Hour)
|
||||
return (hour % 12 || 12) + (hour < 12 ? " AM" : " PM");
|
||||
return (hour < 10 ? "0" : "") + hour + ":00";
|
||||
}
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 14
|
||||
spacing: 12
|
||||
GlassIcon {
|
||||
size: Math.min(root.height - 28, 64)
|
||||
glyphSize: size * 0.62
|
||||
glyph: root.current ? root.glyph(root.current.code) : ""
|
||||
fallback: "☁"
|
||||
color: Theme.transparent
|
||||
border.width: 0
|
||||
spacing: 10
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 12
|
||||
GlassIcon {
|
||||
size: Math.min((root.showHourly ? root.height * 0.55 : root.height) - 28, 64)
|
||||
glyphSize: size * 0.62
|
||||
glyph: root.current ? root.glyph(root.current.code) : ""
|
||||
fallback: "☁"
|
||||
color: Theme.transparent
|
||||
border.width: 0
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
Text {
|
||||
text: root.current ? root.temperature(root.current.celsius) : "—"
|
||||
color: Theme.text
|
||||
font.pixelSize: Math.max(20, Math.min(root.height * 0.3, 44))
|
||||
font.weight: Font.Light
|
||||
}
|
||||
Text {
|
||||
text: root.current ? root.current.description : root.error || "Loading…"
|
||||
color: Theme.text
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
visible: !!root.current && root.height > 110
|
||||
text: root.current ? root.current.place + " · feels " + root.temperature(root.current.feelsCelsius) : ""
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
visible: root.showHourly
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
Text {
|
||||
text: root.current ? root.temperature(root.current.celsius) : "—"
|
||||
color: Theme.text
|
||||
font.pixelSize: Math.max(20, root.height * 0.3)
|
||||
font.weight: Font.Light
|
||||
}
|
||||
Text {
|
||||
text: root.current ? root.current.description : root.error || "Loading…"
|
||||
color: Theme.text
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
visible: !!root.current && root.height > 110
|
||||
text: root.current ? root.current.place + " · feels " + root.temperature(root.current.feelsCelsius) : ""
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
Repeater {
|
||||
model: root.showHourly ? root.hourly : []
|
||||
// Equal-width slots: a nested layout only grows when a child fills.
|
||||
Item {
|
||||
id: slot
|
||||
required property var modelData
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: 1
|
||||
implicitHeight: slotColumn.implicitHeight
|
||||
Column {
|
||||
id: slotColumn
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 2
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: root.hourLabel(slot.modelData.hour)
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
}
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: Icons.available
|
||||
text: Icons.available ? root.glyph(slot.modelData.code) : ""
|
||||
font.family: Icons.family
|
||||
color: Theme.text
|
||||
font.pixelSize: 18
|
||||
}
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: root.temperature(slot.modelData.celsius)
|
||||
color: Theme.text
|
||||
font.pixelSize: 11
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
Face 1.0 Face.qml
|
||||
NetworkFace 1.0 NetworkFace.qml
|
||||
UsageFace 1.0 UsageFace.qml
|
||||
WeatherFace 1.0 WeatherFace.qml
|
||||
Reference in new issue
Block a user