diff options
| -rw-r--r-- | assets/pam.d/fprint | 3 | ||||
| -rw-r--r-- | assets/pam.d/passwd | 6 | ||||
| -rw-r--r-- | config/Config.qml | 21 | ||||
| -rw-r--r-- | config/GeneralConfig.qml | 21 | ||||
| -rw-r--r-- | config/LockConfig.qml | 14 | ||||
| -rw-r--r-- | modules/IdleMonitors.qml | 51 | ||||
| -rw-r--r-- | modules/lock/Center.qml | 417 | ||||
| -rw-r--r-- | modules/lock/Content.qml | 27 | ||||
| -rw-r--r-- | modules/lock/InputField.qml | 149 | ||||
| -rw-r--r-- | modules/lock/Lock.qml | 55 | ||||
| -rw-r--r-- | modules/lock/LockSurface.qml | 231 | ||||
| -rw-r--r-- | modules/lock/Pam.qml | 193 | ||||
| -rw-r--r-- | modules/utilities/Content.qml | 2 | ||||
| -rw-r--r-- | modules/utilities/cards/IdleInhibit.qml | 125 | ||||
| -rw-r--r-- | nix/default.nix | 2 | ||||
| -rw-r--r-- | plugin/src/Caelestia/Internal/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | plugin/src/Caelestia/Internal/logindmanager.cpp | 65 | ||||
| -rw-r--r-- | plugin/src/Caelestia/Internal/logindmanager.hpp | 27 | ||||
| -rw-r--r-- | services/IdleInhibitor.qml | 56 | ||||
| -rw-r--r-- | shell.qml | 6 |
20 files changed, 0 insertions, 1472 deletions
diff --git a/assets/pam.d/fprint b/assets/pam.d/fprint deleted file mode 100644 index d4814e9..0000000 --- a/assets/pam.d/fprint +++ /dev/null @@ -1,3 +0,0 @@ -#%PAM-1.0 - -auth required pam_fprintd.so max-tries=1 diff --git a/assets/pam.d/passwd b/assets/pam.d/passwd deleted file mode 100644 index 4b14064..0000000 --- a/assets/pam.d/passwd +++ /dev/null @@ -1,6 +0,0 @@ -#%PAM-1.0 - -auth required pam_faillock.so preauth -auth [success=1 default=bad] pam_unix.so nullok -auth [default=die] pam_faillock.so authfail -auth required pam_faillock.so authsucc diff --git a/config/Config.qml b/config/Config.qml index d9fb892..af1b5d9 100644 --- a/config/Config.qml +++ b/config/Config.qml @@ -21,7 +21,6 @@ Singleton { property alias osd: adapter.osd property alias session: adapter.session property alias winfo: adapter.winfo - property alias lock: adapter.lock property alias utilities: adapter.utilities property alias sidebar: adapter.sidebar property alias services: adapter.services @@ -42,7 +41,6 @@ Singleton { osd: serializeOsd(), session: serializeSession(), winfo: serializeWinfo(), - lock: serializeLock(), utilities: serializeUtilities(), sidebar: serializeSidebar(), services: serializeServices(), @@ -83,11 +81,6 @@ Singleton { playback: general.apps.playback, explorer: general.apps.explorer }, - idle: { - lockBeforeSleep: general.idle.lockBeforeSleep, - inhibitWhenAudio: general.idle.inhibitWhenAudio, - timeouts: general.idle.timeouts - }, battery: { warnLevels: general.battery.warnLevels, criticalLevel: general.battery.criticalLevel @@ -266,19 +259,6 @@ Singleton { }; } - function serializeLock(): var { - return { - recolourLogo: lock.recolourLogo, - enableFprint: lock.enableFprint, - maxFprintTries: lock.maxFprintTries, - sizes: { - heightMult: lock.sizes.heightMult, - ratio: lock.sizes.ratio, - centerWidth: lock.sizes.centerWidth - } - }; - } - function serializeUtilities(): var { return { enabled: utilities.enabled, @@ -382,7 +362,6 @@ Singleton { property OsdConfig osd: OsdConfig {} property SessionConfig session: SessionConfig {} property WInfoConfig winfo: WInfoConfig {} - property LockConfig lock: LockConfig {} property UtilitiesConfig utilities: UtilitiesConfig {} property SidebarConfig sidebar: SidebarConfig {} property ServiceConfig services: ServiceConfig {} diff --git a/config/GeneralConfig.qml b/config/GeneralConfig.qml index eecca01..08b29dd 100644 --- a/config/GeneralConfig.qml +++ b/config/GeneralConfig.qml @@ -2,7 +2,6 @@ import Quickshell.Io JsonObject { property Apps apps: Apps {} - property Idle idle: Idle {} property Battery battery: Battery {} component Apps: JsonObject { @@ -12,26 +11,6 @@ JsonObject { property list<string> explorer: ["thunar"] } - component Idle: JsonObject { - property bool lockBeforeSleep: true - property bool inhibitWhenAudio: true - property list<var> timeouts: [ - { - timeout: 180, - idleAction: "lock" - }, - { - timeout: 300, - idleAction: "dpms off", - returnAction: "dpms on" - }, - { - timeout: 600, - idleAction: ["systemctl", "suspend-then-hibernate"] - } - ] - } - component Battery: JsonObject { property list<var> warnLevels: [ { diff --git a/config/LockConfig.qml b/config/LockConfig.qml deleted file mode 100644 index 2af4e2c..0000000 --- a/config/LockConfig.qml +++ /dev/null @@ -1,14 +0,0 @@ -import Quickshell.Io - -JsonObject { - property bool recolourLogo: false - property bool enableFprint: true - property int maxFprintTries: 3 - property Sizes sizes: Sizes {} - - component Sizes: JsonObject { - property real heightMult: 0.7 - property real ratio: 16 / 9 - property int centerWidth: 600 - } -} diff --git a/modules/IdleMonitors.qml b/modules/IdleMonitors.qml deleted file mode 100644 index b7ce058..0000000 --- a/modules/IdleMonitors.qml +++ /dev/null @@ -1,51 +0,0 @@ -pragma ComponentBehavior: Bound - -import "lock" -import qs.config -import qs.services -import Caelestia.Internal -import Quickshell -import Quickshell.Wayland - -Scope { - id: root - - required property Lock lock - readonly property bool enabled: !Config.general.idle.inhibitWhenAudio || !Players.list.some(p => p.isPlaying) - - function handleIdleAction(action: var): void { - if (!action) - return; - - if (action === "lock") - lock.lock.locked = true; - else if (action === "unlock") - lock.lock.locked = false; - else if (typeof action === "string") - Hypr.dispatch(action); - else - Quickshell.execDetached(action); - } - - LogindManager { - onAboutToSleep: { - if (Config.general.idle.lockBeforeSleep) - root.lock.lock.locked = true; - } - onLockRequested: root.lock.lock.locked = true - onUnlockRequested: root.lock.lock.unlock() - } - - Variants { - model: Config.general.idle.timeouts - - IdleMonitor { - required property var modelData - - enabled: root.enabled && (modelData.enabled ?? true) - timeout: modelData.timeout - respectInhibitors: modelData.respectInhibitors ?? true - onIsIdleChanged: root.handleIdleAction(isIdle ? modelData.idleAction : modelData.returnAction) - } - } -} diff --git a/modules/lock/Center.qml b/modules/lock/Center.qml deleted file mode 100644 index 4e2215b..0000000 --- a/modules/lock/Center.qml +++ /dev/null @@ -1,417 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.components.controls -import qs.services -import qs.config -import qs.utils -import QtQuick -import QtQuick.Layouts - -ColumnLayout { - id: root - - required property var lock - readonly property list<string> timeComponents: Time.format(Config.services.useTwelveHourClock ? "hh:mm:A" : "hh:mm").split(":") - readonly property real centerScale: Math.min(1, (lock.screen?.height ?? 1440) / 1440) - readonly property int centerWidth: Config.lock.sizes.centerWidth * centerScale - - Layout.preferredWidth: centerWidth - Layout.fillWidth: false - Layout.fillHeight: true - - spacing: Appearance.spacing.large * 2 - - RowLayout { - Layout.alignment: Qt.AlignHCenter - spacing: Appearance.spacing.small - - StyledText { - Layout.alignment: Qt.AlignVCenter - text: root.timeComponents[0] - color: Colours.palette.m3secondary - font.pointSize: Math.floor(Appearance.font.size.extraLarge * 3 * root.centerScale) - font.family: Appearance.font.family.clock - font.bold: true - } - - StyledText { - Layout.alignment: Qt.AlignVCenter - text: ":" - color: Colours.palette.m3primary - font.pointSize: Math.floor(Appearance.font.size.extraLarge * 3 * root.centerScale) - font.family: Appearance.font.family.clock - font.bold: true - } - - StyledText { - Layout.alignment: Qt.AlignVCenter - text: root.timeComponents[1] - color: Colours.palette.m3secondary - font.pointSize: Math.floor(Appearance.font.size.extraLarge * 3 * root.centerScale) - font.family: Appearance.font.family.clock - font.bold: true - } - - Loader { - Layout.leftMargin: Appearance.spacing.small - Layout.alignment: Qt.AlignVCenter - - asynchronous: true - active: Config.services.useTwelveHourClock - visible: active - - sourceComponent: StyledText { - text: root.timeComponents[2] ?? "" - color: Colours.palette.m3primary - font.pointSize: Math.floor(Appearance.font.size.extraLarge * 2 * root.centerScale) - font.family: Appearance.font.family.clock - font.bold: true - } - } - } - - StyledText { - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: -Appearance.padding.large * 2 - - text: Time.format("dddd, d MMMM yyyy") - color: Colours.palette.m3tertiary - font.pointSize: Math.floor(Appearance.font.size.extraLarge * root.centerScale) - font.family: Appearance.font.family.mono - font.bold: true - } - - StyledClippingRect { - Layout.topMargin: Appearance.spacing.large * 2 - Layout.alignment: Qt.AlignHCenter - - implicitWidth: root.centerWidth / 2 - implicitHeight: root.centerWidth / 2 - - color: Colours.tPalette.m3surfaceContainer - radius: Appearance.rounding.full - - MaterialIcon { - anchors.centerIn: parent - - text: "person" - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Math.floor(root.centerWidth / 4) - } - - Image { - id: pfp - - anchors.fill: parent - source: Paths.face - } - } - - StyledRect { - Layout.alignment: Qt.AlignHCenter - - implicitWidth: root.centerWidth * 0.8 - implicitHeight: input.implicitHeight + Appearance.padding.small * 2 - - color: Colours.tPalette.m3surfaceContainer - radius: Appearance.rounding.full - - focus: true - onActiveFocusChanged: { - if (!activeFocus) - forceActiveFocus(); - } - - Keys.onPressed: event => { - if (root.lock.unlocking) - return; - - if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) - inputField.placeholder.animate = false; - - root.lock.pam.handleKey(event); - } - - StateLayer { - hoverEnabled: false - cursorShape: Qt.IBeamCursor - - function onClicked(): void { - parent.forceActiveFocus(); - } - } - - RowLayout { - id: input - - anchors.fill: parent - anchors.margins: Appearance.padding.small - spacing: Appearance.spacing.normal - - Item { - implicitWidth: implicitHeight - implicitHeight: fprintIcon.implicitHeight + Appearance.padding.small * 2 - - MaterialIcon { - id: fprintIcon - - anchors.centerIn: parent - animate: true - text: { - if (root.lock.pam.fprint.tries >= Config.lock.maxFprintTries) - return "fingerprint_off"; - if (root.lock.pam.fprint.active) - return "fingerprint"; - return "lock"; - } - color: root.lock.pam.fprint.tries >= Config.lock.maxFprintTries ? Colours.palette.m3error : Colours.palette.m3onSurface - opacity: root.lock.pam.passwd.active ? 0 : 1 - - Behavior on opacity { - Anim {} - } - } - - CircularIndicator { - anchors.fill: parent - running: root.lock.pam.passwd.active - } - } - - InputField { - id: inputField - - pam: root.lock.pam - } - - StyledRect { - implicitWidth: implicitHeight - implicitHeight: enterIcon.implicitHeight + Appearance.padding.small * 2 - - color: root.lock.pam.buffer ? Colours.palette.m3primary : Colours.layer(Colours.palette.m3surfaceContainerHigh, 2) - radius: Appearance.rounding.full - - StateLayer { - color: root.lock.pam.buffer ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface - - function onClicked(): void { - root.lock.pam.passwd.start(); - } - } - - MaterialIcon { - id: enterIcon - - anchors.centerIn: parent - text: "arrow_forward" - color: root.lock.pam.buffer ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface - font.weight: 500 - } - } - } - } - - Item { - Layout.fillWidth: true - Layout.topMargin: -Appearance.spacing.large - - implicitHeight: Math.max(message.implicitHeight, stateMessage.implicitHeight) - - Behavior on implicitHeight { - Anim {} - } - - StyledText { - id: stateMessage - - readonly property string msg: { - if (Hypr.kbLayout !== Hypr.defaultKbLayout) { - if (Hypr.capsLock && Hypr.numLock) - return qsTr("Caps lock and Num lock are ON.\nKeyboard layout: %1").arg(Hypr.kbLayoutFull); - if (Hypr.capsLock) - return qsTr("Caps lock is ON. Kb layout: %1").arg(Hypr.kbLayoutFull); - if (Hypr.numLock) - return qsTr("Num lock is ON. Kb layout: %1").arg(Hypr.kbLayoutFull); - return qsTr("Keyboard layout: %1").arg(Hypr.kbLayoutFull); - } - - if (Hypr.capsLock && Hypr.numLock) - return qsTr("Caps lock and Num lock are ON."); - if (Hypr.capsLock) - return qsTr("Caps lock is ON."); - if (Hypr.numLock) - return qsTr("Num lock is ON."); - - return ""; - } - - property bool shouldBeVisible - - onMsgChanged: { - if (msg) { - if (opacity > 0) { - animate = true; - text = msg; - animate = false; - } else { - text = msg; - } - shouldBeVisible = true; - } else { - shouldBeVisible = false; - } - } - - anchors.left: parent.left - anchors.right: parent.right - - scale: shouldBeVisible && !message.msg ? 1 : 0.7 - opacity: shouldBeVisible && !message.msg ? 1 : 0 - color: Colours.palette.m3onSurfaceVariant - animateProp: "opacity" - - font.family: Appearance.font.family.mono - horizontalAlignment: Qt.AlignHCenter - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - lineHeight: 1.2 - - Behavior on scale { - Anim {} - } - - Behavior on opacity { - Anim {} - } - } - - StyledText { - id: message - - readonly property Pam pam: root.lock.pam - readonly property string msg: { - if (pam.fprintState === "error") - return qsTr("FP ERROR: %1").arg(pam.fprint.message); - if (pam.state === "error") - return qsTr("PW ERROR: %1").arg(pam.passwd.message); - - if (pam.lockMessage) - return pam.lockMessage; - - if (pam.state === "max" && pam.fprintState === "max") - return qsTr("Maximum password and fingerprint attempts reached."); - if (pam.state === "max") { - if (pam.fprint.available) - return qsTr("Maximum password attempts reached. Please use fingerprint."); - return qsTr("Maximum password attempts reached."); - } - if (pam.fprintState === "max") - return qsTr("Maximum fingerprint attempts reached. Please use password."); - - if (pam.state === "fail") { - if (pam.fprint.available) - return qsTr("Incorrect password. Please try again or use fingerprint."); - return qsTr("Incorrect password. Please try again."); - } - if (pam.fprintState === "fail") - return qsTr("Fingerprint not recognized (%1/%2). Please try again or use password.").arg(pam.fprint.tries).arg(Config.lock.maxFprintTries); - - return ""; - } - - anchors.left: parent.left - anchors.right: parent.right - - scale: 0.7 - opacity: 0 - color: Colours.palette.m3error - - font.pointSize: Appearance.font.size.small - font.family: Appearance.font.family.mono - horizontalAlignment: Qt.AlignHCenter - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - - onMsgChanged: { - if (msg) { - if (opacity > 0) { - animate = true; - text = msg; - animate = false; - - exitAnim.stop(); - if (scale < 1) - appearAnim.restart(); - else - flashAnim.restart(); - } else { - text = msg; - exitAnim.stop(); - appearAnim.restart(); - } - } else { - appearAnim.stop(); - flashAnim.stop(); - exitAnim.start(); - } - } - - Connections { - target: root.lock.pam - - function onFlashMsg(): void { - exitAnim.stop(); - if (message.scale < 1) - appearAnim.restart(); - else - flashAnim.restart(); - } - } - - Anim { - id: appearAnim - - target: message - properties: "scale,opacity" - to: 1 - onFinished: flashAnim.restart() - } - - SequentialAnimation { - id: flashAnim - - loops: 2 - - FlashAnim { - to: 0.3 - } - FlashAnim { - to: 1 - } - } - - ParallelAnimation { - id: exitAnim - - Anim { - target: message - property: "scale" - to: 0.7 - duration: Appearance.anim.durations.large - } - Anim { - target: message - property: "opacity" - to: 0 - duration: Appearance.anim.durations.large - } - } - } - } - - component FlashAnim: NumberAnimation { - target: message - property: "opacity" - duration: Appearance.anim.durations.small - easing.type: Easing.Linear - } -} diff --git a/modules/lock/Content.qml b/modules/lock/Content.qml deleted file mode 100644 index daa87ac..0000000 --- a/modules/lock/Content.qml +++ /dev/null @@ -1,27 +0,0 @@ -import qs.components -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -RowLayout { - id: root - - required property var lock - - spacing: Appearance.spacing.large * 2 - - ColumnLayout { - Layout.fillWidth: true - spacing: Appearance.spacing.normal - } - - Center { - lock: root.lock - } - - ColumnLayout { - Layout.fillWidth: true - spacing: Appearance.spacing.normal - } -} diff --git a/modules/lock/InputField.qml b/modules/lock/InputField.qml deleted file mode 100644 index 1acc787..0000000 --- a/modules/lock/InputField.qml +++ /dev/null @@ -1,149 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.services -import qs.config -import Quickshell -import QtQuick -import QtQuick.Layouts - -Item { - id: root - - required property Pam pam - readonly property alias placeholder: placeholder - property string buffer - - Layout.fillWidth: true - Layout.fillHeight: true - - clip: true - - Connections { - target: root.pam - - function onBufferChanged(): void { - if (root.pam.buffer.length > root.buffer.length) { - charList.bindImWidth(); - } else if (root.pam.buffer.length === 0) { - charList.implicitWidth = charList.implicitWidth; - placeholder.animate = true; - } - - root.buffer = root.pam.buffer; - } - } - - StyledText { - id: placeholder - - anchors.centerIn: parent - - text: { - if (root.pam.passwd.active) - return qsTr("Loading..."); - if (root.pam.state === "max") - return qsTr("You have reached the maximum number of tries"); - return qsTr("Enter your password"); - } - - animate: true - color: root.pam.passwd.active ? Colours.palette.m3secondary : Colours.palette.m3outline - font.pointSize: Appearance.font.size.normal - font.family: Appearance.font.family.mono - - opacity: root.buffer ? 0 : 1 - - Behavior on opacity { - Anim {} - } - } - - ListView { - id: charList - - readonly property int fullWidth: count * (implicitHeight + spacing) - spacing - - function bindImWidth(): void { - imWidthBehavior.enabled = false; - implicitWidth = Qt.binding(() => fullWidth); - imWidthBehavior.enabled = true; - } - - anchors.centerIn: parent - anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0 - - implicitWidth: fullWidth - implicitHeight: Appearance.font.size.normal - - orientation: Qt.Horizontal - spacing: Appearance.spacing.small / 2 - interactive: false - - model: ScriptModel { - values: root.buffer.split("") - } - - delegate: StyledRect { - id: ch - - implicitWidth: implicitHeight - implicitHeight: charList.implicitHeight - - color: Colours.palette.m3onSurface - radius: Appearance.rounding.full - - opacity: 0 - scale: 0 - Component.onCompleted: { - opacity = 1; - scale = 1; - } - ListView.onRemove: removeAnim.start() - - SequentialAnimation { - id: removeAnim - - PropertyAction { - target: ch - property: "ListView.delayRemove" - value: true - } - ParallelAnimation { - Anim { - target: ch - property: "opacity" - to: 0 - } - Anim { - target: ch - property: "scale" - to: 0.5 - } - } - PropertyAction { - target: ch - property: "ListView.delayRemove" - value: false - } - } - - Behavior on opacity { - Anim {} - } - - Behavior on scale { - Anim { - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial - } - } - } - - Behavior on implicitWidth { - id: imWidthBehavior - - Anim {} - } - } -} diff --git a/modules/lock/Lock.qml b/modules/lock/Lock.qml deleted file mode 100644 index 6fd5277..0000000 --- a/modules/lock/Lock.qml +++ /dev/null @@ -1,55 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components.misc -import Quickshell -import Quickshell.Io -import Quickshell.Wayland - -Scope { - property alias lock: lock - - WlSessionLock { - id: lock - - signal unlock - - LockSurface { - lock: lock - pam: pam - } - } - - Pam { - id: pam - - lock: lock - } - - CustomShortcut { - name: "lock" - description: "Lock the current session" - onPressed: lock.locked = true - } - - CustomShortcut { - name: "unlock" - description: "Unlock the current session" - onPressed: lock.unlock() - } - - IpcHandler { - target: "lock" - - function lock(): void { - lock.locked = true; - } - - function unlock(): void { - lock.unlock(); - } - - function isLocked(): bool { - return lock.locked; - } - } -} diff --git a/modules/lock/LockSurface.qml b/modules/lock/LockSurface.qml deleted file mode 100644 index 0c3ce69..0000000 --- a/modules/lock/LockSurface.qml +++ /dev/null @@ -1,231 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.services -import qs.config -import qs.utils -import Quickshell.Wayland -import QtQuick -import QtQuick.Effects - -WlSessionLockSurface { - id: root - - required property WlSessionLock lock - required property Pam pam - - readonly property alias unlocking: unlockAnim.running - - color: "transparent" - - Connections { - target: root.lock - - function onUnlock(): void { - unlockAnim.start(); - } - } - - SequentialAnimation { - id: unlockAnim - - ParallelAnimation { - Anim { - target: lockContent - properties: "implicitWidth,implicitHeight" - to: lockContent.size - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - Anim { - target: lockBg - property: "radius" - to: lockContent.radius - } - Anim { - target: content - property: "scale" - to: 0 - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - Anim { - target: content - property: "opacity" - to: 0 - duration: Appearance.anim.durations.small - } - Anim { - target: lockIcon - property: "opacity" - to: 1 - duration: Appearance.anim.durations.large - } - Anim { - target: background - property: "opacity" - to: 0 - duration: Appearance.anim.durations.large - } - SequentialAnimation { - PauseAnimation { - duration: Appearance.anim.durations.small - } - Anim { - target: lockContent - property: "opacity" - to: 0 - } - } - } - PropertyAction { - target: root.lock - property: "locked" - value: false - } - } - - ParallelAnimation { - id: initAnim - - running: true - - Anim { - target: background - property: "opacity" - to: 1 - duration: Appearance.anim.durations.large - } - SequentialAnimation { - ParallelAnimation { - Anim { - target: lockContent - property: "scale" - to: 1 - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial - } - Anim { - target: lockContent - property: "rotation" - to: 360 - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.standardAccel - } - } - ParallelAnimation { - Anim { - target: lockIcon - property: "rotation" - to: 360 - easing.bezierCurve: Appearance.anim.curves.standardDecel - } - Anim { - target: lockIcon - property: "opacity" - to: 0 - } - Anim { - target: content - property: "opacity" - to: 1 - } - Anim { - target: content - property: "scale" - to: 1 - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - Anim { - target: lockBg - property: "radius" - to: Appearance.rounding.large * 1.5 - } - Anim { - target: lockContent - property: "implicitWidth" - to: root.screen?.height * Config.lock.sizes.heightMult * Config.lock.sizes.ratio - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - Anim { - target: lockContent - property: "implicitHeight" - to: root.screen?.height * Config.lock.sizes.heightMult - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - } - } - - Image { - id: background - - anchors.fill: parent - source: Paths.wallpaper ?? "" - opacity: 1 - - layer.enabled: true - layer.effect: MultiEffect { - autoPaddingEnabled: false - blurEnabled: true - blur: 1 - blurMax: 64 - blurMultiplier: 1 - } - } - - Item { - id: lockContent - - readonly property int size: lockIcon.implicitHeight + Appearance.padding.large * 4 - readonly property int radius: size / 4 * Appearance.rounding.scale - - anchors.centerIn: parent - implicitWidth: size - implicitHeight: size - - rotation: 180 - scale: 0 - - StyledRect { - id: lockBg - - anchors.fill: parent - color: Colours.palette.m3surface - radius: parent.radius - opacity: Colours.transparency.enabled ? Colours.transparency.base : 1 - - layer.enabled: true - layer.effect: MultiEffect { - shadowEnabled: true - blurMax: 15 - shadowColor: Qt.alpha(Colours.palette.m3shadow, 0.7) - } - } - - MaterialIcon { - id: lockIcon - - anchors.centerIn: parent - text: "lock" - font.pointSize: Appearance.font.size.extraLarge * 4 - font.bold: true - rotation: 180 - } - - Content { - id: content - - anchors.centerIn: parent - width: (root.screen?.height ?? 0) * Config.lock.sizes.heightMult * Config.lock.sizes.ratio - Appearance.padding.large * 2 - height: (root.screen?.height ?? 0) * Config.lock.sizes.heightMult - Appearance.padding.large * 2 - - lock: root - opacity: 0 - scale: 0 - } - } -} diff --git a/modules/lock/Pam.qml b/modules/lock/Pam.qml deleted file mode 100644 index 0186c2f..0000000 --- a/modules/lock/Pam.qml +++ /dev/null @@ -1,193 +0,0 @@ -import qs.config -import Quickshell -import Quickshell.Io -import Quickshell.Wayland -import Quickshell.Services.Pam -import QtQuick - -Scope { - id: root - - required property WlSessionLock lock - - readonly property alias passwd: passwd - readonly property alias fprint: fprint - property string lockMessage - property string state - property string fprintState - property string buffer - - signal flashMsg - - function handleKey(event: KeyEvent): void { - if (passwd.active || state === "max") - return; - - if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { - passwd.start(); - } else if (event.key === Qt.Key_Backspace) { - if (event.modifiers & Qt.ControlModifier) { - buffer = ""; - } else { - buffer = buffer.slice(0, -1); - } - } else if (" abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?".includes(event.text.toLowerCase())) { - // No illegal characters (you are insane if you use unicode in your password) - buffer += event.text; - } - } - - PamContext { - id: passwd - - config: "passwd" - configDirectory: Quickshell.shellDir + "/assets/pam.d" - - onMessageChanged: { - if (message.startsWith("The account is locked")) - root.lockMessage = message; - else if (root.lockMessage && message.endsWith(" left to unlock)")) - root.lockMessage += "\n" + message; - } - - onResponseRequiredChanged: { - if (!responseRequired) - return; - - respond(root.buffer); - root.buffer = ""; - } - - onCompleted: res => { - if (res === PamResult.Success) - return root.lock.unlock(); - - if (res === PamResult.Error) - root.state = "error"; - else if (res === PamResult.MaxTries) - root.state = "max"; - else if (res === PamResult.Failed) - root.state = "fail"; - - root.flashMsg(); - stateReset.restart(); - } - } - - PamContext { - id: fprint - - property bool available - property int tries - property int errorTries - - function checkAvail(): void { - if (!available || !Config.lock.enableFprint || !root.lock.secure) { - abort(); - return; - } - - tries = 0; - errorTries = 0; - start(); - } - - config: "fprint" - configDirectory: Quickshell.shellDir + "/assets/pam.d" - - onCompleted: res => { - if (!available) - return; - - if (res === PamResult.Success) - return root.lock.unlock(); - - if (res === PamResult.Error) { - root.fprintState = "error"; - errorTries++; - if (errorTries < 5) { - abort(); - errorRetry.restart(); - } - } else if (res === PamResult.MaxTries) { - // Isn't actually the real max tries as pam only reports completed - // when max tries is reached. - tries++; - if (tries < Config.lock.maxFprintTries) { - // Restart if not actually real max tries - root.fprintState = "fail"; - start(); - } else { - root.fprintState = "max"; - abort(); - } - } - - root.flashMsg(); - fprintStateReset.start(); - } - } - - Process { - id: availProc - - command: ["sh", "-c", "fprintd-list $USER"] - onExited: code => { - fprint.available = code === 0; - fprint.checkAvail(); - } - } - - Timer { - id: errorRetry - - interval: 800 - onTriggered: fprint.start() - } - - Timer { - id: stateReset - - interval: 4000 - onTriggered: { - if (root.state !== "max") - root.state = ""; - } - } - - Timer { - id: fprintStateReset - - interval: 4000 - onTriggered: { - root.fprintState = ""; - fprint.errorTries = 0; - } - } - - Connections { - target: root.lock - - function onSecureChanged(): void { - if (root.lock.secure) { - availProc.running = true; - root.buffer = ""; - root.state = ""; - root.fprintState = ""; - root.lockMessage = ""; - } - } - - function onUnlock(): void { - fprint.abort(); - } - } - - Connections { - target: Config.lock - - function onEnableFprintChanged(): void { - fprint.checkAvail(); - } - } -} diff --git a/modules/utilities/Content.qml b/modules/utilities/Content.qml index f6d8d63..770a774 100644 --- a/modules/utilities/Content.qml +++ b/modules/utilities/Content.qml @@ -19,8 +19,6 @@ Item { anchors.fill: parent spacing: Appearance.spacing.normal - IdleInhibit {} - Toggles { visibilities: root.visibilities popouts: root.popouts diff --git a/modules/utilities/cards/IdleInhibit.qml b/modules/utilities/cards/IdleInhibit.qml deleted file mode 100644 index 0344e3a..0000000 --- a/modules/utilities/cards/IdleInhibit.qml +++ /dev/null @@ -1,125 +0,0 @@ -import qs.components -import qs.components.controls -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -StyledRect { - id: root - - Layout.fillWidth: true - implicitHeight: layout.implicitHeight + (IdleInhibitor.enabled ? activeChip.implicitHeight + activeChip.anchors.topMargin : 0) + Appearance.padding.large * 2 - - radius: Appearance.rounding.normal - color: Colours.tPalette.m3surfaceContainer - clip: true - - RowLayout { - id: layout - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal - - StyledRect { - implicitWidth: implicitHeight - implicitHeight: icon.implicitHeight + Appearance.padding.smaller * 2 - - radius: Appearance.rounding.full - color: IdleInhibitor.enabled ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer - - MaterialIcon { - id: icon - - anchors.centerIn: parent - text: "coffee" - color: IdleInhibitor.enabled ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer - font.pointSize: Appearance.font.size.large - } - } - - ColumnLayout { - Layout.fillWidth: true - spacing: 0 - - StyledText { - Layout.fillWidth: true - text: qsTr("Keep Awake") - font.pointSize: Appearance.font.size.normal - elide: Text.ElideRight - } - - StyledText { - Layout.fillWidth: true - text: IdleInhibitor.enabled ? qsTr("Preventing sleep mode") : qsTr("Normal power management") - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Appearance.font.size.small - elide: Text.ElideRight - } - } - - StyledSwitch { - checked: IdleInhibitor.enabled - onToggled: IdleInhibitor.enabled = checked - } - } - - Loader { - id: activeChip - - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.topMargin: Appearance.spacing.larger - anchors.bottomMargin: IdleInhibitor.enabled ? Appearance.padding.large : -implicitHeight - anchors.leftMargin: Appearance.padding.large - - opacity: IdleInhibitor.enabled ? 1 : 0 - scale: IdleInhibitor.enabled ? 1 : 0.5 - - Component.onCompleted: active = Qt.binding(() => opacity > 0) - - sourceComponent: StyledRect { - implicitWidth: activeText.implicitWidth + Appearance.padding.normal * 2 - implicitHeight: activeText.implicitHeight + Appearance.padding.small * 2 - - radius: Appearance.rounding.full - color: Colours.palette.m3primary - - StyledText { - id: activeText - - anchors.centerIn: parent - text: qsTr("Active since %1").arg(Qt.formatTime(IdleInhibitor.enabledSince, Config.services.useTwelveHourClock ? "hh:mm a" : "hh:mm")) - color: Colours.palette.m3onPrimary - font.pointSize: Math.round(Appearance.font.size.small * 0.9) - } - } - - Behavior on anchors.bottomMargin { - Anim { - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - - Behavior on opacity { - Anim { - duration: Appearance.anim.durations.small - } - } - - Behavior on scale { - Anim {} - } - } - - Behavior on implicitHeight { - Anim { - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } -} diff --git a/nix/default.nix b/nix/default.nix index 9f2e4af..0f2675a 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -124,8 +124,6 @@ in dontStrip = debug; prePatch = '' - substituteInPlace assets/pam.d/fprint \ - --replace-fail pam_fprintd.so /run/current-system/sw/lib/security/pam_fprintd.so substituteInPlace shell.qml \ --replace-fail 'ShellRoot {' 'ShellRoot { settings.watchFiles: false' ''; diff --git a/plugin/src/Caelestia/Internal/CMakeLists.txt b/plugin/src/Caelestia/Internal/CMakeLists.txt index 0240de8..d0b7548 100644 --- a/plugin/src/Caelestia/Internal/CMakeLists.txt +++ b/plugin/src/Caelestia/Internal/CMakeLists.txt @@ -4,7 +4,6 @@ qml_module(caelestia-internal circularindicatormanager.hpp circularindicatormanager.cpp hyprdevices.hpp hyprdevices.cpp hyprextras.hpp hyprextras.cpp - logindmanager.hpp logindmanager.cpp LIBRARIES Qt::Gui Qt::Quick diff --git a/plugin/src/Caelestia/Internal/logindmanager.cpp b/plugin/src/Caelestia/Internal/logindmanager.cpp deleted file mode 100644 index 4194ee1..0000000 --- a/plugin/src/Caelestia/Internal/logindmanager.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "logindmanager.hpp" - -#include <QtDBus/qdbusconnection.h> -#include <QtDBus/qdbuserror.h> -#include <QtDBus/qdbusinterface.h> -#include <QtDBus/qdbusreply.h> - -namespace caelestia::internal { - -LogindManager::LogindManager(QObject* parent) - : QObject(parent) { - auto bus = QDBusConnection::systemBus(); - if (!bus.isConnected()) { - qWarning() << "LogindManager::LogindManager: failed to connect to system bus:" << bus.lastError().message(); - return; - } - - bool ok = bus.connect("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", - "PrepareForSleep", this, SLOT(handlePrepareForSleep(bool))); - - if (!ok) { - qWarning() << "LogindManager::LogindManager: failed to connect to PrepareForSleep signal:" - << bus.lastError().message(); - } - - QDBusInterface login1("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", bus); - const QDBusReply<QDBusObjectPath> reply = login1.call("GetSession", "auto"); - if (!reply.isValid()) { - qWarning() << "LogindManager::LogindManager: failed to get session path"; - return; - } - const auto sessionPath = reply.value().path(); - - ok = bus.connect("org.freedesktop.login1", sessionPath, "org.freedesktop.login1.Session", "Lock", this, - SLOT(handleLockRequested())); - - if (!ok) { - qWarning() << "LogindManager::LogindManager: failed to connect to Lock signal:" << bus.lastError().message(); - } - - ok = bus.connect("org.freedesktop.login1", sessionPath, "org.freedesktop.login1.Session", "Unlock", this, - SLOT(handleUnlockRequested())); - - if (!ok) { - qWarning() << "LogindManager::LogindManager: failed to connect to Unlock signal:" << bus.lastError().message(); - } -} - -void LogindManager::handlePrepareForSleep(bool sleep) { - if (sleep) { - emit aboutToSleep(); - } else { - emit resumed(); - } -} - -void LogindManager::handleLockRequested() { - emit lockRequested(); -} - -void LogindManager::handleUnlockRequested() { - emit unlockRequested(); -} - -} // namespace caelestia::internal diff --git a/plugin/src/Caelestia/Internal/logindmanager.hpp b/plugin/src/Caelestia/Internal/logindmanager.hpp deleted file mode 100644 index 72a3401..0000000 --- a/plugin/src/Caelestia/Internal/logindmanager.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include <qobject.h> -#include <qqmlintegration.h> - -namespace caelestia::internal { - -class LogindManager : public QObject { - Q_OBJECT - QML_ELEMENT - -public: - explicit LogindManager(QObject* parent = nullptr); - -signals: - void aboutToSleep(); - void resumed(); - void lockRequested(); - void unlockRequested(); - -private slots: - void handlePrepareForSleep(bool sleep); - void handleLockRequested(); - void handleUnlockRequested(); -}; - -} // namespace caelestia::internal diff --git a/services/IdleInhibitor.qml b/services/IdleInhibitor.qml deleted file mode 100644 index 29409ab..0000000 --- a/services/IdleInhibitor.qml +++ /dev/null @@ -1,56 +0,0 @@ -pragma Singleton - -import Quickshell -import Quickshell.Io -import Quickshell.Wayland - -Singleton { - id: root - - property alias enabled: props.enabled - readonly property alias enabledSince: props.enabledSince - - onEnabledChanged: { - if (enabled) - props.enabledSince = new Date(); - } - - PersistentProperties { - id: props - - property bool enabled - property date enabledSince - - reloadableId: "idleInhibitor" - } - - IdleInhibitor { - enabled: props.enabled - window: PanelWindow { - implicitWidth: 0 - implicitHeight: 0 - color: "transparent" - mask: Region {} - } - } - - IpcHandler { - target: "idleInhibitor" - - function isEnabled(): bool { - return props.enabled; - } - - function toggle(): void { - props.enabled = !props.enabled; - } - - function enable(): void { - props.enabled = true; - } - - function disable(): void { - props.enabled = false; - } - } -} @@ -11,13 +11,7 @@ import Quickshell ShellRoot { Background {} Drawers {} - Lock { - id: lock - } Shortcuts {} BatteryMonitor {} - IdleMonitors { - lock: lock - } } |