mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-01 18:15:41 +00:00
Switched to qmlformat.
This commit is contained in:
@@ -18,24 +18,24 @@ Scope {
|
||||
|
||||
onCurrentTextChanged: {
|
||||
if (currentText !== "") {
|
||||
showFailure = false
|
||||
errorMessage = ""
|
||||
showFailure = false;
|
||||
errorMessage = "";
|
||||
}
|
||||
}
|
||||
|
||||
function tryUnlock() {
|
||||
if (!pamAvailable) {
|
||||
errorMessage = "PAM not available"
|
||||
showFailure = true
|
||||
return
|
||||
errorMessage = "PAM not available";
|
||||
showFailure = true;
|
||||
return;
|
||||
}
|
||||
|
||||
root.unlockInProgress = true
|
||||
errorMessage = ""
|
||||
showFailure = false
|
||||
root.unlockInProgress = true;
|
||||
errorMessage = "";
|
||||
showFailure = false;
|
||||
|
||||
Logger.i("LockContext", "Starting PAM authentication for user:", pam.user)
|
||||
pam.start()
|
||||
Logger.i("LockContext", "Starting PAM authentication for user:", pam.user);
|
||||
pam.start();
|
||||
}
|
||||
|
||||
PamContext {
|
||||
@@ -44,48 +44,48 @@ Scope {
|
||||
user: HostService.username
|
||||
|
||||
onPamMessage: {
|
||||
Logger.i("LockContext", "PAM message:", message, "isError:", messageIsError, "responseRequired:", responseRequired)
|
||||
Logger.i("LockContext", "PAM message:", message, "isError:", messageIsError, "responseRequired:", responseRequired);
|
||||
|
||||
if (messageIsError) {
|
||||
errorMessage = message
|
||||
errorMessage = message;
|
||||
} else {
|
||||
infoMessage = message
|
||||
infoMessage = message;
|
||||
}
|
||||
|
||||
if (responseRequired) {
|
||||
Logger.i("LockContext", "Responding to PAM with password")
|
||||
respond(root.currentText)
|
||||
Logger.i("LockContext", "Responding to PAM with password");
|
||||
respond(root.currentText);
|
||||
}
|
||||
}
|
||||
|
||||
onResponseRequiredChanged: {
|
||||
Logger.i("LockContext", "Response required changed:", responseRequired)
|
||||
Logger.i("LockContext", "Response required changed:", responseRequired);
|
||||
if (responseRequired && root.unlockInProgress) {
|
||||
Logger.i("LockContext", "Automatically responding to PAM")
|
||||
respond(root.currentText)
|
||||
Logger.i("LockContext", "Automatically responding to PAM");
|
||||
respond(root.currentText);
|
||||
}
|
||||
}
|
||||
|
||||
onCompleted: result => {
|
||||
Logger.i("LockContext", "PAM completed with result:", result)
|
||||
Logger.i("LockContext", "PAM completed with result:", result);
|
||||
if (result === PamResult.Success) {
|
||||
Logger.i("LockContext", "Authentication successful")
|
||||
root.unlocked()
|
||||
Logger.i("LockContext", "Authentication successful");
|
||||
root.unlocked();
|
||||
} else {
|
||||
Logger.i("LockContext", "Authentication failed")
|
||||
errorMessage = "Authentication failed"
|
||||
showFailure = true
|
||||
root.failed()
|
||||
Logger.i("LockContext", "Authentication failed");
|
||||
errorMessage = "Authentication failed";
|
||||
showFailure = true;
|
||||
root.failed();
|
||||
}
|
||||
root.unlockInProgress = false
|
||||
root.unlockInProgress = false;
|
||||
}
|
||||
|
||||
onError: {
|
||||
Logger.i("LockContext", "PAM error:", error, "message:", message)
|
||||
errorMessage = message || "Authentication error"
|
||||
showFailure = true
|
||||
root.unlockInProgress = false
|
||||
root.failed()
|
||||
Logger.i("LockContext", "PAM error:", error, "message:", message);
|
||||
errorMessage = message || "Authentication error";
|
||||
showFailure = true;
|
||||
root.unlockInProgress = false;
|
||||
root.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Pam
|
||||
import Quickshell.Services.UPower
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
import qs.Commons
|
||||
import qs.Services.Compositor
|
||||
import qs.Services.Hardware
|
||||
import qs.Services.Keyboard
|
||||
import qs.Services.Location
|
||||
import qs.Services.Media
|
||||
import qs.Services.Compositor
|
||||
import qs.Services.UI
|
||||
import qs.Services.System
|
||||
import qs.Services.UI
|
||||
import qs.Widgets
|
||||
import qs.Widgets.AudioSpectrum
|
||||
|
||||
@@ -31,14 +31,14 @@ Loader {
|
||||
interval: 250
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
lockScreen.active = false
|
||||
lockScreen.active = false;
|
||||
// Reset the deprecation flag when unlocking
|
||||
lockScreen.triggeredViaDeprecatedCall = false
|
||||
lockScreen.triggeredViaDeprecatedCall = false;
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleUnloadAfterUnlock() {
|
||||
unloadAfterUnlockTimer.start()
|
||||
unloadAfterUnlockTimer.start();
|
||||
}
|
||||
|
||||
sourceComponent: Component {
|
||||
@@ -48,12 +48,12 @@ Loader {
|
||||
LockContext {
|
||||
id: lockContext
|
||||
onUnlocked: {
|
||||
lockSession.locked = false
|
||||
lockScreen.scheduleUnloadAfterUnlock()
|
||||
lockContext.currentText = ""
|
||||
lockSession.locked = false;
|
||||
lockScreen.scheduleUnloadAfterUnlock();
|
||||
lockContext.currentText = "";
|
||||
}
|
||||
onFailed: {
|
||||
lockContext.currentText = ""
|
||||
lockContext.currentText = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,21 +130,20 @@ Loader {
|
||||
smooth: false
|
||||
|
||||
onPaint: {
|
||||
const ctx = getContext("2d")
|
||||
const ctx = getContext("2d");
|
||||
if (!ctx)
|
||||
return
|
||||
return;
|
||||
ctx.reset();
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
ctx.reset()
|
||||
ctx.clearRect(0, 0, width, height)
|
||||
ctx.fillStyle = parent.cornerColor;
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
|
||||
ctx.fillStyle = parent.cornerColor
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.beginPath()
|
||||
ctx.arc(width, height, parent.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
ctx.globalCompositeOperation = "destination-out";
|
||||
ctx.fillStyle = "#ffffff";
|
||||
ctx.beginPath();
|
||||
ctx.arc(width, height, parent.cornerRadius, 0, 2 * Math.PI);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
onWidthChanged: if (available)
|
||||
@@ -164,21 +163,20 @@ Loader {
|
||||
smooth: true
|
||||
|
||||
onPaint: {
|
||||
const ctx = getContext("2d")
|
||||
const ctx = getContext("2d");
|
||||
if (!ctx)
|
||||
return
|
||||
return;
|
||||
ctx.reset();
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
ctx.reset()
|
||||
ctx.clearRect(0, 0, width, height)
|
||||
ctx.fillStyle = parent.cornerColor;
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
|
||||
ctx.fillStyle = parent.cornerColor
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.beginPath()
|
||||
ctx.arc(0, height, parent.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
ctx.globalCompositeOperation = "destination-out";
|
||||
ctx.fillStyle = "#ffffff";
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, height, parent.cornerRadius, 0, 2 * Math.PI);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
onWidthChanged: if (available)
|
||||
@@ -198,21 +196,20 @@ Loader {
|
||||
smooth: true
|
||||
|
||||
onPaint: {
|
||||
const ctx = getContext("2d")
|
||||
const ctx = getContext("2d");
|
||||
if (!ctx)
|
||||
return
|
||||
return;
|
||||
ctx.reset();
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
ctx.reset()
|
||||
ctx.clearRect(0, 0, width, height)
|
||||
ctx.fillStyle = parent.cornerColor;
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
|
||||
ctx.fillStyle = parent.cornerColor
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.beginPath()
|
||||
ctx.arc(width, 0, parent.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
ctx.globalCompositeOperation = "destination-out";
|
||||
ctx.fillStyle = "#ffffff";
|
||||
ctx.beginPath();
|
||||
ctx.arc(width, 0, parent.cornerRadius, 0, 2 * Math.PI);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
onWidthChanged: if (available)
|
||||
@@ -232,21 +229,20 @@ Loader {
|
||||
smooth: true
|
||||
|
||||
onPaint: {
|
||||
const ctx = getContext("2d")
|
||||
const ctx = getContext("2d");
|
||||
if (!ctx)
|
||||
return
|
||||
return;
|
||||
ctx.reset();
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
ctx.reset()
|
||||
ctx.clearRect(0, 0, width, height)
|
||||
ctx.fillStyle = parent.cornerColor;
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
|
||||
ctx.fillStyle = parent.cornerColor
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.beginPath()
|
||||
ctx.arc(0, 0, parent.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
ctx.globalCompositeOperation = "destination-out";
|
||||
ctx.fillStyle = "#ffffff";
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, parent.cornerRadius, 0, 2 * Math.PI);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
onWidthChanged: if (available)
|
||||
@@ -347,7 +343,7 @@ Loader {
|
||||
// Date below
|
||||
NText {
|
||||
text: {
|
||||
var lang = I18n.locale.name.split("_")[0]
|
||||
var lang = I18n.locale.name.split("_")[0];
|
||||
var formats = {
|
||||
"de": "dddd, d. MMMM",
|
||||
"es": "dddd, d 'de' MMMM",
|
||||
@@ -356,8 +352,8 @@ Loader {
|
||||
"zh": "yyyy年M月d日 dddd",
|
||||
"uk": "dddd, d MMMM",
|
||||
"tr": "dddd, d MMMM"
|
||||
}
|
||||
return I18n.locale.toString(Time.now, formats[lang] || "dddd, MMMM d")
|
||||
};
|
||||
return I18n.locale.toString(Time.now, formats[lang] || "dddd, MMMM d");
|
||||
}
|
||||
pointSize: Style.fontSizeXL
|
||||
font.weight: Font.Medium
|
||||
@@ -487,15 +483,15 @@ Loader {
|
||||
// Compact status indicators container (compact mode only)
|
||||
Rectangle {
|
||||
width: {
|
||||
var hasBattery = UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent
|
||||
var hasKeyboard = keyboardLayout.currentLayout !== "Unknown"
|
||||
var hasBattery = UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent;
|
||||
var hasKeyboard = keyboardLayout.currentLayout !== "Unknown";
|
||||
|
||||
if (hasBattery && hasKeyboard) {
|
||||
return 200
|
||||
return 200;
|
||||
} else if (hasBattery || hasKeyboard) {
|
||||
return 120
|
||||
return 120;
|
||||
} else {
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
height: 40
|
||||
@@ -708,14 +704,14 @@ Loader {
|
||||
|
||||
NText {
|
||||
text: {
|
||||
var temp = LocationService.data.weather.current_weather.temperature
|
||||
var suffix = "C"
|
||||
var temp = LocationService.data.weather.current_weather.temperature;
|
||||
var suffix = "C";
|
||||
if (Settings.data.location.useFahrenheit) {
|
||||
temp = LocationService.celsiusToFahrenheit(temp)
|
||||
suffix = "F"
|
||||
temp = LocationService.celsiusToFahrenheit(temp);
|
||||
suffix = "F";
|
||||
}
|
||||
temp = Math.round(temp)
|
||||
return temp + "°" + suffix
|
||||
temp = Math.round(temp);
|
||||
return temp + "°" + suffix;
|
||||
}
|
||||
pointSize: Style.fontSizeXL
|
||||
font.weight: Style.fontWeightBold
|
||||
@@ -724,14 +720,14 @@ Loader {
|
||||
|
||||
NText {
|
||||
text: {
|
||||
var wind = LocationService.data.weather.current_weather.windspeed
|
||||
var unit = "km/h"
|
||||
var wind = LocationService.data.weather.current_weather.windspeed;
|
||||
var unit = "km/h";
|
||||
if (Settings.data.location.useFahrenheit) {
|
||||
wind = wind * 0.621371 // Convert km/h to mph
|
||||
unit = "mph"
|
||||
wind = wind * 0.621371; // Convert km/h to mph
|
||||
unit = "mph";
|
||||
}
|
||||
wind = Math.round(wind)
|
||||
return wind + " " + unit
|
||||
wind = Math.round(wind);
|
||||
return wind + " " + unit;
|
||||
}
|
||||
pointSize: Style.fontSizeM
|
||||
color: Color.mOnSurfaceVariant
|
||||
@@ -773,8 +769,8 @@ Loader {
|
||||
|
||||
NText {
|
||||
text: {
|
||||
var weatherDate = new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/"))
|
||||
return I18n.locale.toString(weatherDate, "ddd")
|
||||
var weatherDate = new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/"));
|
||||
return I18n.locale.toString(weatherDate, "ddd");
|
||||
}
|
||||
pointSize: Style.fontSizeM
|
||||
color: Color.mOnSurfaceVariant
|
||||
@@ -791,15 +787,15 @@ Loader {
|
||||
|
||||
NText {
|
||||
text: {
|
||||
var max = LocationService.data.weather.daily.temperature_2m_max[index]
|
||||
var min = LocationService.data.weather.daily.temperature_2m_min[index]
|
||||
var max = LocationService.data.weather.daily.temperature_2m_max[index];
|
||||
var min = LocationService.data.weather.daily.temperature_2m_min[index];
|
||||
if (Settings.data.location.useFahrenheit) {
|
||||
max = LocationService.celsiusToFahrenheit(max)
|
||||
min = LocationService.celsiusToFahrenheit(min)
|
||||
max = LocationService.celsiusToFahrenheit(max);
|
||||
min = LocationService.celsiusToFahrenheit(min);
|
||||
}
|
||||
max = Math.round(max)
|
||||
min = Math.round(min)
|
||||
return max + "°/" + min + "°"
|
||||
max = Math.round(max);
|
||||
min = Math.round(min);
|
||||
return max + "°/" + min + "°";
|
||||
}
|
||||
pointSize: Style.fontSizeM
|
||||
font.weight: Style.fontWeightMedium
|
||||
@@ -916,7 +912,7 @@ Loader {
|
||||
|
||||
Keys.onPressed: function (event) {
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||
lockContext.tryUnlock()
|
||||
lockContext.tryUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user