Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
99e64a7713
433 files changed
+57792
No files matched your search
@@ -0,0 +1,82 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
// Liquid glass over the lock screen backdrop (see shaders/glass.frag).
|
||||
// Must be a direct child of the item that `backdrop` covers, so its own x/y
|
||||
// map straight onto the backdrop. The shape is a rounded rectangle unless
|
||||
// `shape` children are supplied (drawn opaque, e.g. white Text).
|
||||
Item {
|
||||
id: root
|
||||
required property var backdrop // ShaderEffectSource of the frosted backdrop
|
||||
required property Item space // item the backdrop covers (this item's parent)
|
||||
property real radius: Math.min(width, height) / 2
|
||||
property bool glass: true
|
||||
property color tint: "#000000"
|
||||
property real tintAmount: 0.18
|
||||
property real brightness: LockState.glass.brightness
|
||||
default property alias shape: shapeHolder.data
|
||||
readonly property bool customShape: shapeHolder.children.length > 1
|
||||
|
||||
Item {
|
||||
id: shapeHolder
|
||||
anchors.fill: parent
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: root.radius
|
||||
visible: !root.customShape && root.glass
|
||||
}
|
||||
}
|
||||
// With glass off the custom shape stays visible as-is (e.g. white clock digits).
|
||||
ShaderEffectSource {
|
||||
id: maskSource
|
||||
sourceItem: shapeHolder
|
||||
hideSource: root.glass
|
||||
visible: false
|
||||
}
|
||||
MultiEffect {
|
||||
id: heightEffect
|
||||
anchors.fill: parent
|
||||
source: maskSource
|
||||
blurEnabled: true
|
||||
blur: 1
|
||||
blurMax: Math.round(LockState.glass.edge)
|
||||
autoPaddingEnabled: false
|
||||
visible: false
|
||||
}
|
||||
ShaderEffectSource {
|
||||
id: heightSource
|
||||
sourceItem: heightEffect
|
||||
hideSource: true
|
||||
visible: false
|
||||
}
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
visible: root.glass && root.space.width > 0
|
||||
property variant backdropMap: root.backdrop
|
||||
property variant maskMap: maskSource
|
||||
property variant heightMap: heightSource
|
||||
property vector4d sourceRect: Qt.vector4d(root.x / root.space.width, root.y / root.space.height, root.width / root.space.width, root.height / root.space.height)
|
||||
property point pixelStep: Qt.point(1 / Math.max(1, root.width), 1 / Math.max(1, root.height))
|
||||
property real refraction: LockState.glass.refraction
|
||||
property real dispersion: LockState.glass.dispersion
|
||||
property real fresnel: LockState.glass.fresnel
|
||||
property real specular: LockState.glass.specular
|
||||
property real brightness: root.brightness
|
||||
property real saturation: LockState.glass.saturation
|
||||
property vector4d tint: Qt.vector4d(root.tint.r, root.tint.g, root.tint.b, root.tintAmount)
|
||||
fragmentShader: Qt.resolvedUrl("shaders/glass.frag.qsb")
|
||||
}
|
||||
// Without glass: a plain translucent surface with a hairline.
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
visible: !root.glass
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: !root.customShape
|
||||
radius: root.radius
|
||||
color: Qt.alpha("#ffffff", 0.16)
|
||||
border.width: 1
|
||||
border.color: Qt.alpha("#ffffff", 0.25)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
|
||||
// The session lock (ext-session-lock: one surface per output) plus the
|
||||
// preview, which shows the same UI in ordinary overlay windows.
|
||||
Scope {
|
||||
WlSessionLock {
|
||||
locked: LockState.locked
|
||||
WlSessionLockSurface {
|
||||
id: surface
|
||||
color: "#000000"
|
||||
LockSurface {
|
||||
anchors.fill: parent
|
||||
screenName: surface.screen ? surface.screen.name : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Variants {
|
||||
model: LockState.previewing ? Quickshell.screens : []
|
||||
// qmllint disable uncreatable-type
|
||||
PanelWindow {
|
||||
id: previewWindow
|
||||
required property var modelData
|
||||
screen: modelData
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
color: "#000000"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.namespace: "glassMxrph-lock-preview"
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||
LockSurface {
|
||||
anchors.fill: parent
|
||||
screenName: previewWindow.modelData.name
|
||||
preview: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Pam
|
||||
import "../services"
|
||||
import "../core"
|
||||
|
||||
// Lock screen state and authentication. Every attempt starts a fresh PAM
|
||||
// conversation (the bundled pam/password.conf, or a system service when
|
||||
// lock.pamService is set) and answers its password prompt.
|
||||
Singleton {
|
||||
id: root
|
||||
readonly property var options: ConfigService.ready ? ConfigService.data.lock : ({
|
||||
enabled: true,
|
||||
backdrop: "wallpaper",
|
||||
glass: true,
|
||||
media: true,
|
||||
powerButtons: true,
|
||||
pamService: ""
|
||||
})
|
||||
property bool locked: false
|
||||
// A preview runs the same UI in ordinary windows: nothing is locked and a
|
||||
// correct password simply closes it. Used by Settings and for testing.
|
||||
property bool previewing: false
|
||||
property bool unlocking: false
|
||||
property string primary: ""
|
||||
property string status: ""
|
||||
property bool busy: false
|
||||
property int failures: 0
|
||||
property string purpose: ""
|
||||
property var pending: null
|
||||
property string testResult: ""
|
||||
property var shots: ({})
|
||||
// Live lock surfaces, for diagnostics and tests.
|
||||
property var surfaces: []
|
||||
property string realName: ""
|
||||
// Active keyboard layout, read from Hyprland when the lock screen shows.
|
||||
property string layout: ""
|
||||
readonly property bool shown: locked || previewing
|
||||
readonly property string runtimeDir: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/glassMxrph"
|
||||
|
||||
// Glass parameters follow the desktop's HyprGlass values for a matching look.
|
||||
readonly property var glass: {
|
||||
const v = ConfigService.ready ? ConfigService.data.hyprglass.values : {};
|
||||
const pick = (key, fallback) => Number.isFinite(v[key]) ? v[key] : fallback;
|
||||
return {
|
||||
refraction: pick("refraction_strength", 3) * 6,
|
||||
dispersion: Math.min(0.6, pick("chromatic_aberration", 0.45) * 0.35),
|
||||
fresnel: pick("fresnel_strength", 0.5),
|
||||
specular: pick("specular_strength", 0.8),
|
||||
edge: Math.max(10, pick("edge_thickness", 0.065) * 300),
|
||||
frost: Math.min(1, pick("blur_strength", 0.45) / 1.2 + 0.25),
|
||||
brightness: pick("brightness", 0.95),
|
||||
saturation: pick("saturation", 1) * (1 + pick("vibrancy", 0.15))
|
||||
};
|
||||
}
|
||||
|
||||
function lock() {
|
||||
if (locked || grab.running)
|
||||
return;
|
||||
previewing = false;
|
||||
ShellState.settingsOpen = false;
|
||||
ShellState.controlCenterOpen = false;
|
||||
ShellState.launcherOpen = false;
|
||||
primary = ScreenService.active ? ScreenService.active.name : "";
|
||||
status = "";
|
||||
if (options.backdrop === "screenshot") {
|
||||
grab.names = Quickshell.screens.map(s => s.name).filter(n => /^[\w.-]+$/.test(n));
|
||||
grab.running = true;
|
||||
grabTimeout.restart();
|
||||
} else
|
||||
locked = true;
|
||||
}
|
||||
function preview() {
|
||||
if (locked)
|
||||
return;
|
||||
ShellState.settingsOpen = false;
|
||||
primary = ScreenService.active ? ScreenService.active.name : "";
|
||||
status = "";
|
||||
previewing = true;
|
||||
}
|
||||
function cancelPreview() {
|
||||
if (previewing && !busy) {
|
||||
previewing = false;
|
||||
status = "";
|
||||
}
|
||||
}
|
||||
function submit(password, why) {
|
||||
if (busy || !password)
|
||||
return false;
|
||||
purpose = why || (previewing ? "preview" : "unlock");
|
||||
pending = password;
|
||||
busy = true;
|
||||
status = "";
|
||||
if (!pam.start()) {
|
||||
busy = false;
|
||||
pending = null;
|
||||
status = "Authentication is unavailable";
|
||||
if (purpose === "test")
|
||||
testResult = "error";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function test(password) {
|
||||
testResult = "";
|
||||
return submit(password, "test");
|
||||
}
|
||||
function finishUnlock() {
|
||||
unlocking = true;
|
||||
unlockTimer.restart();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ShellState
|
||||
function onLockRequested() {
|
||||
root.lock();
|
||||
}
|
||||
}
|
||||
PamContext {
|
||||
id: pam
|
||||
config: root.options.pamService || "password.conf"
|
||||
configDirectory: root.options.pamService ? "/etc/pam.d" : Qt.resolvedUrl("pam")
|
||||
onPamMessage: {
|
||||
if (responseRequired && root.pending !== null) {
|
||||
respond(root.pending);
|
||||
root.pending = null;
|
||||
}
|
||||
}
|
||||
onCompleted: result => {
|
||||
root.busy = false;
|
||||
root.pending = null;
|
||||
const ok = result === PamResult.Success;
|
||||
if (root.purpose === "test") {
|
||||
root.testResult = ok ? "accepted" : "rejected";
|
||||
return;
|
||||
}
|
||||
if (ok)
|
||||
root.finishUnlock();
|
||||
else {
|
||||
root.failures++;
|
||||
root.status = result === PamResult.Error ? "Authentication error" : "Incorrect password";
|
||||
}
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id: unlockTimer
|
||||
interval: 420
|
||||
onTriggered: {
|
||||
root.locked = false;
|
||||
root.previewing = false;
|
||||
root.unlocking = false;
|
||||
root.status = "";
|
||||
if (Object.keys(root.shots).length) {
|
||||
Quickshell.execDetached(["rm", "-f"].concat(Object.values(root.shots)));
|
||||
root.shots = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
// Screenshot backdrops: one grim capture per output, then lock (or lock anyway after a timeout).
|
||||
Process {
|
||||
id: grab
|
||||
property var names: []
|
||||
command: ["sh", "-c", "mkdir -p \"$1\" && shift && dir=\"$1\" && shift && for name; do grim -l 0 -o \"$name\" \"$dir/lock-$name.png\" & done; wait", "sh", root.runtimeDir, root.runtimeDir].concat(names)
|
||||
// Quickshell 0.3.1 omits QProcess::ExitStatus from its type metadata.
|
||||
// qmllint disable signal-handler-parameters
|
||||
onExited: {
|
||||
grabTimeout.stop();
|
||||
const shots = {};
|
||||
for (const name of names)
|
||||
shots[name] = root.runtimeDir + "/lock-" + name + ".png";
|
||||
root.shots = shots;
|
||||
root.locked = true;
|
||||
}
|
||||
// qmllint enable signal-handler-parameters
|
||||
}
|
||||
Timer {
|
||||
id: grabTimeout
|
||||
interval: 1500
|
||||
onTriggered: {
|
||||
grab.running = false;
|
||||
root.locked = true;
|
||||
}
|
||||
}
|
||||
onShownChanged: if (shown)
|
||||
layoutProbe.running = true
|
||||
Process {
|
||||
id: layoutProbe
|
||||
command: ["hyprctl", "devices", "-j"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
try {
|
||||
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() : "";
|
||||
} catch (e) {
|
||||
root.layout = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Process {
|
||||
running: true
|
||||
command: ["sh", "-c", "getent passwd \"$USER\" | cut -d: -f5 | cut -d, -f1"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.realName = text.trim()
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "lock"
|
||||
function lock(): void {
|
||||
root.lock();
|
||||
}
|
||||
function preview(): void {
|
||||
root.preview();
|
||||
}
|
||||
function closePreview(): void {
|
||||
root.cancelPreview();
|
||||
}
|
||||
function status(): string {
|
||||
return JSON.stringify({
|
||||
locked: root.locked,
|
||||
previewing: root.previewing,
|
||||
busy: root.busy,
|
||||
status: root.status,
|
||||
primary: root.primary,
|
||||
testResult: root.testResult
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,651 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Services.UPower
|
||||
import "../services"
|
||||
import "../theme"
|
||||
|
||||
// One output of the lock screen, in the style of the macOS lock screen: date
|
||||
// and a large glass clock at the top, Now Playing below it, and the avatar,
|
||||
// name and password capsule near the bottom with power controls underneath.
|
||||
// Secondary outputs show only the backdrop and the clock.
|
||||
Item {
|
||||
id: root
|
||||
required property string screenName
|
||||
property bool preview: false
|
||||
readonly property bool primary: screenName === LockState.primary || !Quickshell.screens.some(s => s.name === LockState.primary)
|
||||
readonly property var byMonitor: ConfigService.ready ? ConfigService.data.wallpaper.byMonitor : ({})
|
||||
readonly property string backdropPath: LockState.options.backdrop === "screenshot" && LockState.shots[screenName] ? LockState.shots[screenName] : (byMonitor[screenName] || Object.values(byMonitor)[0] || "")
|
||||
readonly property bool glass: LockState.options.glass
|
||||
// Interface scale: about 1 on a 1500×1050 logical output, never below 0.85
|
||||
// (so portrait outputs keep readable controls) or above 1.3.
|
||||
readonly property real unit: Math.max(0.85, Math.min(1.3, Math.min(width / 1500, height / 1050)))
|
||||
function s(value) {
|
||||
return Math.round(value * unit);
|
||||
}
|
||||
property bool active: false
|
||||
function wake() {
|
||||
active = true;
|
||||
idle.restart();
|
||||
}
|
||||
|
||||
focus: true
|
||||
opacity: LockState.unlocking ? 0 : 1
|
||||
scale: LockState.unlocking ? 1.04 : 1
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 380
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: 380
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
Keys.onPressed: event => {
|
||||
root.wake();
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
if (root.preview)
|
||||
LockState.cancelPreview();
|
||||
else
|
||||
field.text = "";
|
||||
event.accepted = true;
|
||||
} else if (root.primary && !field.activeFocus) {
|
||||
field.forceActiveFocus();
|
||||
if (event.text && event.text.length === 1 && event.text >= " ") {
|
||||
field.insert(field.cursorPosition, event.text);
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
LockState.surfaces = LockState.surfaces.concat([root]);
|
||||
if (primary)
|
||||
field.forceActiveFocus();
|
||||
}
|
||||
Component.onDestruction: LockState.surfaces = LockState.surfaces.filter(s => s !== root)
|
||||
Timer {
|
||||
id: idle
|
||||
interval: 20000
|
||||
onTriggered: root.active = false
|
||||
}
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Minutes
|
||||
}
|
||||
|
||||
// Backdrop: wallpaper (or the pre-lock screenshot), lightly blurred while typing.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: Qt.darker(Theme.accent, 2.2)
|
||||
}
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: "#050507"
|
||||
}
|
||||
}
|
||||
}
|
||||
Image {
|
||||
id: wallpaper
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
source: root.backdropPath ? "file://" + encodeURI(root.backdropPath).replace(/#/g, "%23").replace(/\?/g, "%3F") : ""
|
||||
sourceSize: Qt.size(root.width, root.height)
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
cache: false
|
||||
}
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
source: wallpaper
|
||||
visible: wallpaper.status === Image.Ready
|
||||
blurEnabled: true
|
||||
blurMax: 48
|
||||
blur: root.active && root.primary ? 0.35 : 0
|
||||
brightness: root.active ? -0.06 : 0
|
||||
Behavior on blur {
|
||||
NumberAnimation {
|
||||
duration: 350
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: "#4d000000"
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.32
|
||||
color: "#00000000"
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.62
|
||||
color: "#00000000"
|
||||
}
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: "#80000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
// Frosted copy of the backdrop that every glass surface refracts.
|
||||
MultiEffect {
|
||||
id: frost
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
source: wallpaper.status === Image.Ready ? wallpaper : null
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: LockState.glass.frost
|
||||
saturation: 0.15
|
||||
}
|
||||
ShaderEffectSource {
|
||||
id: frostSource
|
||||
sourceItem: frost
|
||||
hideSource: true
|
||||
visible: false
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPositionChanged: root.wake()
|
||||
onPressed: {
|
||||
root.wake();
|
||||
if (root.primary)
|
||||
field.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
// Date and glass clock.
|
||||
Text {
|
||||
id: date
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: root.height * 0.085
|
||||
text: Qt.formatDate(clock.date, "dddd d MMMM")
|
||||
color: Qt.alpha("#ffffff", 0.92)
|
||||
font.pixelSize: root.s(24)
|
||||
font.weight: Font.DemiBold
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
shadowEnabled: true
|
||||
shadowColor: "#66000000"
|
||||
shadowBlur: 0.5
|
||||
}
|
||||
}
|
||||
GlassSurface {
|
||||
id: clockGlass
|
||||
objectName: "lockClock"
|
||||
backdrop: frostSource
|
||||
space: root
|
||||
glass: root.glass && wallpaper.status === Image.Ready
|
||||
x: Math.round((root.width - width) / 2)
|
||||
y: date.y + date.height - root.s(6)
|
||||
width: digits.implicitWidth + root.s(24)
|
||||
height: digits.implicitHeight
|
||||
brightness: 1.3
|
||||
tint: "#ffffff"
|
||||
tintAmount: 0.2
|
||||
Text {
|
||||
id: digits
|
||||
anchors.centerIn: parent
|
||||
text: Qt.formatTime(clock.date, ConfigService.ready && !ConfigService.data.bar.clock.use24Hour ? "h:mm" : "HH:mm")
|
||||
color: "#ffffff"
|
||||
font.pixelSize: Math.min(root.s(176), root.height * 0.2)
|
||||
font.weight: Font.Bold
|
||||
font.letterSpacing: -root.s(3)
|
||||
}
|
||||
}
|
||||
Text {
|
||||
visible: root.preview && root.primary
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: root.s(18)
|
||||
text: "Preview · type your password to test it, or press Esc to close"
|
||||
color: Qt.alpha("#ffffff", 0.75)
|
||||
font.pixelSize: root.s(12)
|
||||
}
|
||||
|
||||
// Status: keyboard layout, Wi-Fi and battery.
|
||||
Row {
|
||||
visible: root.primary
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.margins: root.s(18)
|
||||
spacing: root.s(14)
|
||||
Text {
|
||||
visible: LockState.layout !== ""
|
||||
text: LockState.layout
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(13)
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
Text {
|
||||
visible: NetworkService.available
|
||||
text: Icons.available ? (NetworkService.enabled ? "" : "") : (NetworkService.enabled ? "Wi-Fi" : "Wi-Fi off")
|
||||
font.family: Icons.available ? Icons.family : ""
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(15)
|
||||
}
|
||||
Text {
|
||||
readonly property var battery: UPower.displayDevice
|
||||
visible: battery.ready && battery.isLaptopBattery
|
||||
text: Math.round(battery.percentage * 100) + "%" + (battery.state === UPowerDeviceState.Charging ? " ⚡" : "")
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(13)
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
}
|
||||
|
||||
// Now Playing.
|
||||
GlassSurface {
|
||||
id: nowPlaying
|
||||
readonly property bool shown: root.primary && LockState.options.media && !!MediaService.player
|
||||
visible: shown
|
||||
backdrop: frostSource
|
||||
space: root
|
||||
glass: root.glass && wallpaper.status === Image.Ready
|
||||
x: Math.round((root.width - width) / 2)
|
||||
y: clockGlass.y + clockGlass.height + root.s(22)
|
||||
width: root.s(380)
|
||||
height: root.s(74)
|
||||
radius: root.s(24)
|
||||
// Darker material keeps white text readable over bright wallpapers.
|
||||
tint: "#000000"
|
||||
tintAmount: 0.45
|
||||
brightness: 0.8
|
||||
}
|
||||
RowLayout {
|
||||
visible: nowPlaying.shown
|
||||
x: nowPlaying.x + root.s(12)
|
||||
y: nowPlaying.y
|
||||
width: nowPlaying.width - root.s(24)
|
||||
height: nowPlaying.height
|
||||
spacing: root.s(12)
|
||||
Rectangle {
|
||||
Layout.preferredWidth: root.s(50)
|
||||
Layout.preferredHeight: root.s(50)
|
||||
radius: root.s(10)
|
||||
color: Qt.alpha("#ffffff", 0.15)
|
||||
clip: true
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: MediaService.artwork
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
sourceSize: Qt.size(120, 120)
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
Text {
|
||||
text: MediaService.title
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(14)
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: MediaService.artist
|
||||
color: Qt.alpha("#ffffff", 0.7)
|
||||
font.pixelSize: root.s(12)
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
model: [
|
||||
{
|
||||
glyph: "",
|
||||
fallback: "‹‹",
|
||||
run: () => MediaService.previous()
|
||||
},
|
||||
{
|
||||
glyph: MediaService.playing ? "" : "",
|
||||
fallback: MediaService.playing ? "❚❚" : "▶",
|
||||
run: () => MediaService.toggle()
|
||||
},
|
||||
{
|
||||
glyph: "",
|
||||
fallback: "››",
|
||||
run: () => MediaService.next()
|
||||
}
|
||||
]
|
||||
Rectangle {
|
||||
id: control
|
||||
required property var modelData
|
||||
Layout.preferredWidth: root.s(32)
|
||||
Layout.preferredHeight: root.s(32)
|
||||
radius: width / 2
|
||||
color: controlArea.containsMouse ? Qt.alpha("#ffffff", 0.18) : "transparent"
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: Icons.available ? control.modelData.glyph : control.modelData.fallback
|
||||
font.family: Icons.available ? Icons.family : ""
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(18)
|
||||
}
|
||||
MouseArea {
|
||||
id: controlArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: control.modelData.run()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Avatar, name and password.
|
||||
Item {
|
||||
id: avatar
|
||||
visible: root.primary
|
||||
width: root.s(84)
|
||||
height: width
|
||||
x: Math.round((root.width - width) / 2)
|
||||
y: root.height - root.s(LockState.options.powerButtons ? 330 : 250)
|
||||
readonly property var candidates: ["file://" + Quickshell.env("HOME") + "/.face", "file://" + Quickshell.env("HOME") + "/.face.icon", "file:///var/lib/AccountsService/icons/" + (Quickshell.env("USER") || "")]
|
||||
property int candidate: 0
|
||||
Image {
|
||||
id: face
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
source: avatar.candidate < avatar.candidates.length ? avatar.candidates[avatar.candidate] : ""
|
||||
sourceSize: Qt.size(200, 200)
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
onStatusChanged: if (status === Image.Error)
|
||||
avatar.candidate++
|
||||
}
|
||||
Rectangle {
|
||||
id: faceMask
|
||||
anchors.fill: parent
|
||||
radius: width / 2
|
||||
visible: false
|
||||
layer.enabled: true
|
||||
}
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
source: face
|
||||
maskEnabled: true
|
||||
maskSource: faceMask
|
||||
visible: face.status === Image.Ready
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: width / 2
|
||||
visible: face.status !== Image.Ready
|
||||
color: Qt.alpha("#ffffff", 0.22)
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: (LockState.realName || Quickshell.env("USER") || "?").charAt(0).toUpperCase()
|
||||
color: "#ffffff"
|
||||
font.pixelSize: parent.width * 0.42
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -root.s(3)
|
||||
radius: width / 2
|
||||
color: "transparent"
|
||||
border.width: root.s(2)
|
||||
border.color: Qt.alpha("#ffffff", 0.35)
|
||||
}
|
||||
}
|
||||
Text {
|
||||
id: userName
|
||||
visible: root.primary
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: avatar.y + avatar.height + root.s(12)
|
||||
text: LockState.realName || Quickshell.env("USER") || ""
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(17)
|
||||
font.weight: Font.DemiBold
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
shadowEnabled: true
|
||||
shadowColor: "#66000000"
|
||||
shadowBlur: 0.4
|
||||
}
|
||||
}
|
||||
property real shake: 0
|
||||
SequentialAnimation {
|
||||
id: shakeAnimation
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "shake"
|
||||
to: -root.s(14)
|
||||
duration: 50
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "shake"
|
||||
to: root.s(12)
|
||||
duration: 70
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "shake"
|
||||
to: -root.s(8)
|
||||
duration: 70
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "shake"
|
||||
to: root.s(4)
|
||||
duration: 60
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "shake"
|
||||
to: 0
|
||||
duration: 50
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: LockState
|
||||
function onFailuresChanged() {
|
||||
field.text = "";
|
||||
shakeAnimation.restart();
|
||||
}
|
||||
}
|
||||
GlassSurface {
|
||||
id: fieldGlass
|
||||
objectName: "lockField"
|
||||
visible: root.primary
|
||||
backdrop: frostSource
|
||||
space: root
|
||||
glass: root.glass && wallpaper.status === Image.Ready
|
||||
width: root.s(250)
|
||||
height: root.s(36)
|
||||
x: Math.round((root.width - width) / 2 + root.shake)
|
||||
y: userName.y + userName.height + root.s(14)
|
||||
tint: "#ffffff"
|
||||
tintAmount: 0.16
|
||||
brightness: 1.2
|
||||
}
|
||||
Item {
|
||||
visible: root.primary
|
||||
x: fieldGlass.x
|
||||
y: fieldGlass.y
|
||||
width: fieldGlass.width
|
||||
height: fieldGlass.height
|
||||
TextInput {
|
||||
id: field
|
||||
objectName: "lockPassword"
|
||||
anchors.left: parent.left
|
||||
anchors.right: submit.left
|
||||
anchors.leftMargin: root.s(16)
|
||||
anchors.rightMargin: root.s(6)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
echoMode: TextInput.Password
|
||||
passwordCharacter: "●"
|
||||
color: "#ffffff"
|
||||
selectionColor: Qt.alpha("#ffffff", 0.3)
|
||||
font.pixelSize: root.s(13)
|
||||
font.letterSpacing: root.s(1)
|
||||
enabled: !LockState.busy && !LockState.unlocking
|
||||
clip: true
|
||||
onTextChanged: root.wake()
|
||||
onAccepted: LockState.submit(text, root.preview ? "preview" : "unlock")
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !field.text
|
||||
text: LockState.busy ? "Checking…" : "Enter Password"
|
||||
color: Qt.alpha("#ffffff", 0.6)
|
||||
font.pixelSize: root.s(13)
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: submit
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: root.s(5)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.height - root.s(10)
|
||||
height: width
|
||||
radius: width / 2
|
||||
visible: field.text.length > 0 || LockState.busy
|
||||
color: submitArea.containsMouse ? Qt.alpha("#ffffff", 0.35) : Qt.alpha("#ffffff", 0.22)
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: !LockState.busy
|
||||
text: Icons.available ? "" : "→"
|
||||
font.family: Icons.available ? Icons.family : ""
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(14)
|
||||
}
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
visible: LockState.busy
|
||||
width: parent.width * 0.55
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: "transparent"
|
||||
border.width: root.s(2)
|
||||
border.color: "#ffffff"
|
||||
opacity: 0.8
|
||||
RotationAnimation on rotation {
|
||||
running: LockState.busy
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 900
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
Rectangle {
|
||||
width: parent.width / 2
|
||||
height: parent.height / 2
|
||||
color: "#000000"
|
||||
opacity: 0.6
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: submitArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: LockState.submit(field.text, root.preview ? "preview" : "unlock")
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
visible: root.primary
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: fieldGlass.y + fieldGlass.height + root.s(12)
|
||||
text: LockState.status || (root.preview ? "Your password is checked but nothing is locked" : "")
|
||||
color: Qt.alpha("#ffffff", LockState.status ? 0.95 : 0.65)
|
||||
font.pixelSize: root.s(12)
|
||||
font.weight: LockState.status ? Font.DemiBold : Font.Normal
|
||||
}
|
||||
|
||||
// Power controls, as on the macOS login window. Inert in preview.
|
||||
readonly property var powerActions: root.primary && LockState.options.powerButtons ? [
|
||||
{
|
||||
id: "suspend",
|
||||
label: "Sleep",
|
||||
glyph: ""
|
||||
},
|
||||
{
|
||||
id: "reboot",
|
||||
label: "Restart",
|
||||
glyph: ""
|
||||
},
|
||||
{
|
||||
id: "shutdown",
|
||||
label: "Shut Down",
|
||||
glyph: ""
|
||||
}
|
||||
] : []
|
||||
function powerAvailable(id) {
|
||||
return !!SystemService.state.power && !!SystemService.state.power[id];
|
||||
}
|
||||
function powerX(index) {
|
||||
return Math.round(width / 2 + (index - 1) * s(104) - s(23));
|
||||
}
|
||||
Repeater {
|
||||
model: root.powerActions
|
||||
GlassSurface {
|
||||
required property var modelData
|
||||
required property int index
|
||||
objectName: "lockPower-" + modelData.id
|
||||
backdrop: frostSource
|
||||
space: root
|
||||
glass: root.glass && wallpaper.status === Image.Ready
|
||||
width: root.s(46)
|
||||
height: width
|
||||
x: root.powerX(index)
|
||||
y: root.height - root.s(118)
|
||||
tint: "#ffffff"
|
||||
tintAmount: 0.16
|
||||
brightness: 1.2
|
||||
opacity: root.powerAvailable(modelData.id) ? 1 : 0.4
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
model: root.powerActions
|
||||
Item {
|
||||
id: power
|
||||
required property var modelData
|
||||
required property int index
|
||||
x: root.powerX(index)
|
||||
y: root.height - root.s(118)
|
||||
width: root.s(46)
|
||||
height: width
|
||||
opacity: root.powerAvailable(modelData.id) ? 1 : 0.4
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: width / 2
|
||||
color: Qt.alpha("#ffffff", powerArea.containsMouse && powerArea.enabled ? 0.18 : 0)
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: Icons.available ? power.modelData.glyph : power.modelData.label.charAt(0)
|
||||
font.family: Icons.available ? Icons.family : ""
|
||||
color: "#ffffff"
|
||||
font.pixelSize: root.s(20)
|
||||
}
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.bottom
|
||||
anchors.topMargin: root.s(8)
|
||||
text: power.modelData.label
|
||||
color: Qt.alpha("#ffffff", 0.85)
|
||||
font.pixelSize: root.s(12)
|
||||
}
|
||||
MouseArea {
|
||||
id: powerArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: root.powerAvailable(power.modelData.id) && !root.preview
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: SystemService.action("power", power.modelData.id, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
auth required pam_unix.so
|
||||
@@ -0,0 +1,4 @@
|
||||
singleton LockState 1.0 LockState.qml
|
||||
Lock 1.0 Lock.qml
|
||||
LockSurface 1.0 LockSurface.qml
|
||||
GlassSurface 1.0 GlassSurface.qml
|
||||
@@ -0,0 +1,62 @@
|
||||
#version 440
|
||||
// Liquid glass for the lock screen, where compositor glass (HyprGlass) does not
|
||||
// reach session-lock surfaces. A shape mask and its blurred copy (a height
|
||||
// field) give an edge profile; the frosted backdrop is refracted towards the
|
||||
// rim with RGB dispersion, plus a fresnel rim and a light-facing highlight.
|
||||
// Rebuild glass.frag.qsb with scripts/build-shaders after editing.
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
vec4 sourceRect; // backdrop UV rect covered by this item
|
||||
vec2 pixelStep; // 1 / item size in pixels
|
||||
float refraction; // edge displacement in pixels
|
||||
float dispersion; // RGB split, fraction of the displacement
|
||||
float fresnel;
|
||||
float specular;
|
||||
float brightness;
|
||||
float saturation;
|
||||
vec4 tint; // rgb tint, a = amount
|
||||
};
|
||||
|
||||
layout(binding = 1) uniform sampler2D backdropMap;
|
||||
layout(binding = 2) uniform sampler2D maskMap;
|
||||
layout(binding = 3) uniform sampler2D heightMap;
|
||||
|
||||
vec3 backdropAt(vec2 uv) {
|
||||
return texture(backdropMap, sourceRect.xy + clamp(uv, 0.0, 1.0) * sourceRect.zw).rgb;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = qt_TexCoord0;
|
||||
float shape = texture(maskMap, uv).a;
|
||||
if (shape < 0.002) {
|
||||
fragColor = vec4(0.0);
|
||||
return;
|
||||
}
|
||||
float h = texture(heightMap, uv).a;
|
||||
vec2 e = pixelStep * 2.0;
|
||||
vec2 slope = vec2(texture(heightMap, uv + vec2(e.x, 0.0)).a - texture(heightMap, uv - vec2(e.x, 0.0)).a,
|
||||
texture(heightMap, uv + vec2(0.0, e.y)).a - texture(heightMap, uv - vec2(0.0, e.y)).a);
|
||||
float rim = 1.0 - smoothstep(0.0, 1.0, h);
|
||||
vec2 inward = length(slope) > 1e-5 ? normalize(slope) : vec2(0.0);
|
||||
|
||||
// Pull the backdrop in from the rim, as a convex lens would.
|
||||
vec2 offset = inward * refraction * rim * rim * pixelStep;
|
||||
vec3 color = vec3(backdropAt(uv + offset * (1.0 + dispersion)).r,
|
||||
backdropAt(uv + offset).g,
|
||||
backdropAt(uv + offset * (1.0 - dispersion)).b);
|
||||
|
||||
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
||||
color = mix(vec3(luma), color, saturation) * brightness;
|
||||
color = mix(color, tint.rgb, tint.a);
|
||||
|
||||
color += vec3(fresnel) * pow(rim, 3.0) * 0.55;
|
||||
// Light from the top left catches the rim facing it.
|
||||
float facing = max(0.0, dot(inward, normalize(vec2(1.0, 1.0))));
|
||||
color += vec3(specular) * pow(rim, 4.0) * facing * 0.9;
|
||||
|
||||
fragColor = vec4(clamp(color, 0.0, 1.0), 1.0) * shape * qt_Opacity;
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user