Fix lockscreen
Add lockscreen ipc call Edit Applauncher
This commit is contained in:
parent
5d1d59c04b
commit
1cb30757de
5 changed files with 26 additions and 341 deletions
|
|
@ -157,17 +157,9 @@ PanelWindow {
|
||||||
radius: 22
|
radius: 22
|
||||||
height: 48
|
height: 48
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
//border.color: searchField.activeFocus ? Theme.accentPrimary : Theme.outline
|
border.color: searchField.activeFocus ? Theme.accentPrimary : Theme.outline
|
||||||
//border.width: searchField.activeFocus ? 2.5 : 1.5
|
border.width: 2
|
||||||
layer.enabled: searchField.activeFocus
|
|
||||||
layer.effect: DropShadow {
|
|
||||||
color: Theme.accentPrimary
|
|
||||||
radius: 12
|
|
||||||
samples: 16
|
|
||||||
verticalOffset: 0
|
|
||||||
horizontalOffset: 0
|
|
||||||
opacity: 0.10
|
|
||||||
}
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import Quickshell.Io
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
property var appLauncherPanel
|
property var appLauncherPanel
|
||||||
|
property var lockScreen
|
||||||
|
|
||||||
target: "globalIPC"
|
target: "globalIPC"
|
||||||
|
|
||||||
|
|
@ -18,4 +19,13 @@ IpcHandler {
|
||||||
appLauncherPanel.showAt();
|
appLauncherPanel.showAt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleLock(): void {
|
||||||
|
if (!lockScreen) {
|
||||||
|
console.warn("LockScreenIpcHandler: lockScreen not set!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("[IPC] LockScreen lock() called");
|
||||||
|
lockScreen.locked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,12 +118,18 @@ To make the weather widget, wallpaper manager and record button work you will ha
|
||||||
<details>
|
<details>
|
||||||
<summary><strong>Keybinds</strong></summary>
|
<summary><strong>Keybinds</strong></summary>
|
||||||
|
|
||||||
### Open Applauncher:
|
### Toggle Applauncher:
|
||||||
|
|
||||||
```
|
```
|
||||||
qs ipc call globalIPC toggleLauncher
|
qs ipc call globalIPC toggleLauncher
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Toggle Lockscreen:
|
||||||
|
|
||||||
|
```
|
||||||
|
qs ipc call globalIPC toggleLock
|
||||||
|
```
|
||||||
|
|
||||||
You can keybind it however you want in your niri setup.
|
You can keybind it however you want in your niri setup.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import "../Helpers/Weather.js" as WeatherHelper
|
||||||
// Password-only lockscreen for all screens
|
// Password-only lockscreen for all screens
|
||||||
WlSessionLock {
|
WlSessionLock {
|
||||||
id: lock
|
id: lock
|
||||||
property bool demoMode: true // Set to true for demo/recording mode
|
|
||||||
property string errorMessage: ""
|
property string errorMessage: ""
|
||||||
property bool authenticating: false
|
property bool authenticating: false
|
||||||
property string password: ""
|
property string password: ""
|
||||||
|
|
@ -121,303 +120,9 @@ WlSessionLock {
|
||||||
console.log("PAM start result:", started);
|
console.log("PAM start result:", started);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the surface property and use a Loader instead
|
|
||||||
Loader {
|
|
||||||
anchors.fill: parent
|
|
||||||
active: true
|
|
||||||
sourceComponent: demoMode ? demoComponent : lockComponent
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: demoComponent
|
|
||||||
Window {
|
|
||||||
id: demoWindow
|
|
||||||
visible: true
|
|
||||||
width: 900
|
|
||||||
height: 600
|
|
||||||
color: "transparent"
|
|
||||||
flags: Qt.Window | Qt.FramelessWindowHint
|
|
||||||
// Blurred wallpaper background
|
|
||||||
Image {
|
|
||||||
id: demoBgImage
|
|
||||||
anchors.fill: parent
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
source: WallpaperManager.currentWallpaper !== "" ? WallpaperManager.currentWallpaper : "/home/lysec/nixos/assets/wallpapers/lantern.png"
|
|
||||||
cache: true
|
|
||||||
smooth: true
|
|
||||||
sourceSize.width: 2560
|
|
||||||
sourceSize.height: 1440
|
|
||||||
visible: true // Show the original for FastBlur input
|
|
||||||
}
|
|
||||||
FastBlur {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: demoBgImage
|
|
||||||
radius: 48 // Adjust blur strength as needed
|
|
||||||
transparentBorder: true
|
|
||||||
}
|
|
||||||
// Main content container (moved up, Rectangle removed)
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: 30
|
|
||||||
width: Math.min(parent.width * 0.8, 400)
|
|
||||||
|
|
||||||
// User avatar/icon
|
|
||||||
Rectangle {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
width: 80
|
|
||||||
height: 80
|
|
||||||
radius: 40
|
|
||||||
color: Theme.accentPrimary
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: avatarImage
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 4
|
|
||||||
source: Settings.profileImage
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
visible: false // Only show the masked version
|
|
||||||
asynchronous: true
|
|
||||||
}
|
|
||||||
OpacityMask {
|
|
||||||
anchors.fill: avatarImage
|
|
||||||
source: avatarImage
|
|
||||||
maskSource: Rectangle {
|
|
||||||
width: avatarImage.width
|
|
||||||
height: avatarImage.height
|
|
||||||
radius: avatarImage.width / 2
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
visible: Settings.profileImage !== ""
|
|
||||||
}
|
|
||||||
// Fallback icon
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "person"
|
|
||||||
font.family: "Material Symbols Outlined"
|
|
||||||
font.pixelSize: 32
|
|
||||||
color: Theme.onAccent
|
|
||||||
visible: Settings.profileImage === ""
|
|
||||||
}
|
|
||||||
// Glow effect
|
|
||||||
layer.enabled: true
|
|
||||||
layer.effect: Glow {
|
|
||||||
color: Theme.accentPrimary
|
|
||||||
radius: 8
|
|
||||||
samples: 16
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Username
|
|
||||||
Text {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: Settings.userName
|
|
||||||
font.pixelSize: 24
|
|
||||||
font.weight: Font.Medium
|
|
||||||
color: Theme.textPrimary
|
|
||||||
}
|
|
||||||
|
|
||||||
// Password input container
|
|
||||||
Rectangle {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
height: 50
|
|
||||||
radius: 25
|
|
||||||
color: Theme.surface
|
|
||||||
opacity: 0.3
|
|
||||||
border.color: passwordInput.activeFocus ? Theme.accentPrimary : Theme.outline
|
|
||||||
border.width: 2
|
|
||||||
|
|
||||||
TextInput {
|
|
||||||
id: passwordInput
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 15
|
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
|
||||||
horizontalAlignment: TextInput.AlignHCenter
|
|
||||||
font.pixelSize: 16
|
|
||||||
color: Theme.textPrimary
|
|
||||||
echoMode: TextInput.Password
|
|
||||||
passwordCharacter: "●"
|
|
||||||
passwordMaskDelay: 0
|
|
||||||
|
|
||||||
text: lock.password
|
|
||||||
onTextChanged: lock.password = text
|
|
||||||
|
|
||||||
// Placeholder text
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "Enter password..."
|
|
||||||
color: Theme.textSecondary
|
|
||||||
opacity: 0.6
|
|
||||||
font.pixelSize: 16
|
|
||||||
visible: !passwordInput.text && !passwordInput.activeFocus
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle Enter key
|
|
||||||
Keys.onPressed: function(event) {
|
|
||||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
|
||||||
lock.unlockAttempt()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error message
|
|
||||||
Text {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: lock.errorMessage
|
|
||||||
color: Theme.error
|
|
||||||
font.pixelSize: 14
|
|
||||||
visible: lock.errorMessage !== ""
|
|
||||||
opacity: lock.errorMessage !== "" ? 1 : 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation { duration: 200 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unlock button
|
|
||||||
Rectangle {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
width: 120
|
|
||||||
height: 44
|
|
||||||
radius: 22
|
|
||||||
color: unlockButtonArea.containsMouse ? Theme.accentPrimary : "transparent"
|
|
||||||
border.color: Theme.accentPrimary
|
|
||||||
border.width: 2
|
|
||||||
opacity: lock.authenticating ? 0.5 : 0.8
|
|
||||||
enabled: !lock.authenticating
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: lock.authenticating ? "Authenticating..." : "Unlock"
|
|
||||||
font.pixelSize: 16
|
|
||||||
font.bold: true
|
|
||||||
color: unlockButtonArea.containsMouse ? Theme.onAccent : Theme.accentPrimary
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: unlockButtonArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
onClicked: {
|
|
||||||
if (!lock.authenticating) {
|
|
||||||
lock.unlockAttempt()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Bypass Login button
|
|
||||||
Rectangle {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
width: 120
|
|
||||||
height: 44
|
|
||||||
radius: 22
|
|
||||||
color: bypassButtonArea.containsMouse ? Theme.accentSecondary : "transparent"
|
|
||||||
border.color: Theme.accentSecondary
|
|
||||||
border.width: 2
|
|
||||||
opacity: lock.authenticating ? 0.5 : 0.8
|
|
||||||
enabled: !lock.authenticating
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "Bypass Login"
|
|
||||||
font.pixelSize: 16
|
|
||||||
font.bold: true
|
|
||||||
color: bypassButtonArea.containsMouse ? Theme.onAccent : Theme.accentSecondary
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: bypassButtonArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
onClicked: {
|
|
||||||
if (!lock.authenticating) {
|
|
||||||
lock.locked = false;
|
|
||||||
lock.errorMessage = "";
|
|
||||||
lock.password = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Top-center info panel (clock + weather)
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.topMargin: 40
|
|
||||||
spacing: 8
|
|
||||||
// Clock
|
|
||||||
Text {
|
|
||||||
id: timeText
|
|
||||||
text: Qt.formatDateTime(new Date(), "HH:mm")
|
|
||||||
font.pixelSize: 48
|
|
||||||
font.bold: true
|
|
||||||
color: Theme.textPrimary
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
id: dateText
|
|
||||||
text: Qt.formatDateTime(new Date(), "dddd, MMMM d")
|
|
||||||
font.pixelSize: 16
|
|
||||||
color: Theme.textSecondary
|
|
||||||
opacity: 0.8
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
}
|
|
||||||
// Weather info (centered, no city)
|
|
||||||
RowLayout {
|
|
||||||
spacing: 6
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
visible: weatherData && weatherData.current_weather
|
|
||||||
Text {
|
|
||||||
text: weatherData && weatherData.current_weather ? materialSymbolForCode(weatherData.current_weather.weathercode) : "cloud"
|
|
||||||
font.family: "Material Symbols Outlined"
|
|
||||||
font.pixelSize: 28
|
|
||||||
color: Theme.accentPrimary
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
text: weatherData && weatherData.current_weather ? (Settings.useFahrenheit ? `${Math.round(weatherData.current_weather.temperature * 9/5 + 32)}°F` : `${Math.round(weatherData.current_weather.temperature)}°C`) : (Settings.useFahrenheit ? "--°F" : "--°C")
|
|
||||||
font.pixelSize: 18
|
|
||||||
color: Theme.textSecondary
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Weather error
|
|
||||||
Text {
|
|
||||||
text: weatherError
|
|
||||||
color: Theme.error
|
|
||||||
visible: weatherError !== ""
|
|
||||||
font.pixelSize: 10
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update clock every second
|
|
||||||
Timer {
|
|
||||||
interval: 1000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
onTriggered: {
|
|
||||||
timeText.text = Qt.formatDateTime(new Date(), "HH:mm")
|
|
||||||
dateText.text = Qt.formatDateTime(new Date(), "dddd, MMMM d")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update weather every 10 minutes
|
|
||||||
Timer {
|
|
||||||
interval: 600000 // 10 minutes
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
onTriggered: {
|
|
||||||
fetchWeatherData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: lockComponent
|
id: lockComponent
|
||||||
|
|
@ -427,7 +132,7 @@ WlSessionLock {
|
||||||
id: lockBgImage
|
id: lockBgImage
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
source: WallpaperManager.currentWallpaper !== "" ? WallpaperManager.currentWallpaper : "/home/lysec/nixos/assets/wallpapers/lantern.png"
|
source: Settings.currentWallpaper !== "" ? Settings.currentWallpaper : "/home/lysec/nixos/assets/wallpapers/lantern.png"
|
||||||
cache: true
|
cache: true
|
||||||
smooth: true
|
smooth: true
|
||||||
sourceSize.width: 2560
|
sourceSize.width: 2560
|
||||||
|
|
@ -590,39 +295,6 @@ WlSessionLock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Bypass Login button
|
|
||||||
Rectangle {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
width: 120
|
|
||||||
height: 44
|
|
||||||
radius: 22
|
|
||||||
color: bypassButtonArea.containsMouse ? Theme.accentSecondary : "transparent"
|
|
||||||
border.color: Theme.accentSecondary
|
|
||||||
border.width: 2
|
|
||||||
opacity: lock.authenticating ? 0.5 : 0.8
|
|
||||||
enabled: !lock.authenticating
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "Bypass Login"
|
|
||||||
font.pixelSize: 16
|
|
||||||
font.bold: true
|
|
||||||
color: bypassButtonArea.containsMouse ? Theme.onAccent : Theme.accentSecondary
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: bypassButtonArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
onClicked: {
|
|
||||||
if (!lock.authenticating) {
|
|
||||||
lock.locked = false;
|
|
||||||
lock.errorMessage = "";
|
|
||||||
lock.password = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top-center info panel (clock + weather)
|
// Top-center info panel (clock + weather)
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ Scope {
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LockScreen {
|
||||||
|
id: lockScreen
|
||||||
|
}
|
||||||
|
|
||||||
NotificationServer {
|
NotificationServer {
|
||||||
id: notificationServer
|
id: notificationServer
|
||||||
onNotification: function(notification) {
|
onNotification: function(notification) {
|
||||||
|
|
@ -54,5 +58,6 @@ Scope {
|
||||||
|
|
||||||
IPCHandlers {
|
IPCHandlers {
|
||||||
appLauncherPanel: appLauncherPanel
|
appLauncherPanel: appLauncherPanel
|
||||||
|
lockScreen: lockScreen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue