mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
greeter: sync power menu options
This commit is contained in:
@@ -527,7 +527,6 @@ Singleton {
|
|||||||
property bool osdAudioOutputEnabled: true
|
property bool osdAudioOutputEnabled: true
|
||||||
|
|
||||||
property bool powerActionConfirm: true
|
property bool powerActionConfirm: true
|
||||||
property bool powerActionConfirmGreeter: true
|
|
||||||
property real powerActionHoldDuration: 0.5
|
property real powerActionHoldDuration: 0.5
|
||||||
property var powerMenuActions: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"]
|
property var powerMenuActions: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"]
|
||||||
property string powerMenuDefaultAction: "logout"
|
property string powerMenuDefaultAction: "logout"
|
||||||
|
|||||||
@@ -350,7 +350,6 @@ var SPEC = {
|
|||||||
osdAudioOutputEnabled: { def: true },
|
osdAudioOutputEnabled: { def: true },
|
||||||
|
|
||||||
powerActionConfirm: { def: true },
|
powerActionConfirm: { def: true },
|
||||||
powerActionConfirmGreeter: { def: true },
|
|
||||||
powerActionHoldDuration: { def: 0.5 },
|
powerActionHoldDuration: { def: 0.5 },
|
||||||
powerMenuActions: { def: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"] },
|
powerMenuActions: { def: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"] },
|
||||||
powerMenuDefaultAction: { def: "logout" },
|
powerMenuDefaultAction: { def: "logout" },
|
||||||
|
|||||||
@@ -41,8 +41,11 @@ Singleton {
|
|||||||
property string lockDateFormat: ""
|
property string lockDateFormat: ""
|
||||||
property bool lockScreenShowPowerActions: true
|
property bool lockScreenShowPowerActions: true
|
||||||
property bool lockScreenShowProfileImage: true
|
property bool lockScreenShowProfileImage: true
|
||||||
property bool powerActionConfirmGreeter: true
|
property bool powerActionConfirm: true
|
||||||
property real powerActionHoldDuration: 0.5
|
property real powerActionHoldDuration: 0.5
|
||||||
|
property var powerMenuActions: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"]
|
||||||
|
property string powerMenuDefaultAction: "logout"
|
||||||
|
property bool powerMenuGridLayout: false
|
||||||
property var screenPreferences: ({})
|
property var screenPreferences: ({})
|
||||||
property int animationSpeed: 2
|
property int animationSpeed: 2
|
||||||
property string wallpaperFillMode: "Fill"
|
property string wallpaperFillMode: "Fill"
|
||||||
@@ -77,8 +80,11 @@ Singleton {
|
|||||||
lockDateFormat = settings.lockDateFormat !== undefined ? settings.lockDateFormat : "";
|
lockDateFormat = settings.lockDateFormat !== undefined ? settings.lockDateFormat : "";
|
||||||
lockScreenShowPowerActions = settings.lockScreenShowPowerActions !== undefined ? settings.lockScreenShowPowerActions : true;
|
lockScreenShowPowerActions = settings.lockScreenShowPowerActions !== undefined ? settings.lockScreenShowPowerActions : true;
|
||||||
lockScreenShowProfileImage = settings.lockScreenShowProfileImage !== undefined ? settings.lockScreenShowProfileImage : true;
|
lockScreenShowProfileImage = settings.lockScreenShowProfileImage !== undefined ? settings.lockScreenShowProfileImage : true;
|
||||||
powerActionConfirmGreeter = settings.powerActionConfirmGreeter !== undefined ? settings.powerActionConfirmGreeter : true;
|
powerActionConfirm = settings.powerActionConfirm !== undefined ? settings.powerActionConfirm : true;
|
||||||
powerActionHoldDuration = settings.powerActionHoldDuration !== undefined ? settings.powerActionHoldDuration : 0.5;
|
powerActionHoldDuration = settings.powerActionHoldDuration !== undefined ? settings.powerActionHoldDuration : 0.5;
|
||||||
|
powerMenuActions = settings.powerMenuActions !== undefined ? settings.powerMenuActions : ["reboot", "logout", "poweroff", "lock", "suspend", "restart"];
|
||||||
|
powerMenuDefaultAction = settings.powerMenuDefaultAction !== undefined ? settings.powerMenuDefaultAction : "logout";
|
||||||
|
powerMenuGridLayout = settings.powerMenuGridLayout !== undefined ? settings.powerMenuGridLayout : false;
|
||||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({});
|
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({});
|
||||||
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : 2;
|
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : 2;
|
||||||
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill";
|
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill";
|
||||||
|
|||||||
@@ -1231,9 +1231,12 @@ Item {
|
|||||||
LockPowerMenu {
|
LockPowerMenu {
|
||||||
id: powerMenu
|
id: powerMenu
|
||||||
showLogout: false
|
showLogout: false
|
||||||
useGreeterPowerSettings: true
|
powerActionConfirmOverride: GreetdSettings.powerActionConfirm
|
||||||
greeterPowerActionConfirm: GreetdSettings.powerActionConfirmGreeter
|
powerActionHoldDurationOverride: GreetdSettings.powerActionHoldDuration
|
||||||
greeterPowerActionHoldDuration: GreetdSettings.powerActionHoldDuration
|
powerMenuActionsOverride: GreetdSettings.powerMenuActions
|
||||||
|
powerMenuDefaultActionOverride: GreetdSettings.powerMenuDefaultAction
|
||||||
|
powerMenuGridLayoutOverride: GreetdSettings.powerMenuGridLayout
|
||||||
|
requiredActions: ["poweroff"]
|
||||||
onClosed: {
|
onClosed: {
|
||||||
if (isPrimaryScreen && inputField && inputField.forceActiveFocus) {
|
if (isPrimaryScreen && inputField && inputField.forceActiveFocus) {
|
||||||
Qt.callLater(() => inputField.forceActiveFocus());
|
Qt.callLater(() => inputField.forceActiveFocus());
|
||||||
|
|||||||
@@ -24,17 +24,20 @@ Rectangle {
|
|||||||
property real holdProgress: 0
|
property real holdProgress: 0
|
||||||
property bool showHoldHint: false
|
property bool showHoldHint: false
|
||||||
|
|
||||||
property bool useGreeterPowerSettings: false
|
property var powerActionConfirmOverride: undefined
|
||||||
property bool greeterPowerActionConfirm: true
|
property var powerActionHoldDurationOverride: undefined
|
||||||
property real greeterPowerActionHoldDuration: 0.5
|
property var powerMenuActionsOverride: undefined
|
||||||
|
property var powerMenuDefaultActionOverride: undefined
|
||||||
|
property var powerMenuGridLayoutOverride: undefined
|
||||||
|
property var requiredActions: []
|
||||||
|
|
||||||
readonly property bool needsConfirmation: useGreeterPowerSettings ? greeterPowerActionConfirm : (typeof SettingsData !== "undefined" && SettingsData.powerActionConfirm)
|
readonly property bool needsConfirmation: powerActionConfirmOverride !== undefined ? powerActionConfirmOverride : SettingsData.powerActionConfirm
|
||||||
readonly property int holdDurationMs: useGreeterPowerSettings ? (greeterPowerActionHoldDuration * 1000) : ((typeof SettingsData !== "undefined" ? SettingsData.powerActionHoldDuration : 0.5) * 1000)
|
readonly property int holdDurationMs: (powerActionHoldDurationOverride !== undefined ? powerActionHoldDurationOverride : SettingsData.powerActionHoldDuration) * 1000
|
||||||
|
|
||||||
signal closed
|
signal closed
|
||||||
|
|
||||||
function updateVisibleActions() {
|
function updateVisibleActions() {
|
||||||
const allActions = (typeof SettingsData !== "undefined" && SettingsData.powerMenuActions) ? SettingsData.powerMenuActions : ["logout", "suspend", "hibernate", "reboot", "poweroff"];
|
const allActions = powerMenuActionsOverride !== undefined ? powerMenuActionsOverride : ((typeof SettingsData !== "undefined" && SettingsData.powerMenuActions) ? SettingsData.powerMenuActions : ["logout", "suspend", "hibernate", "reboot", "poweroff"]);
|
||||||
const hibernateSupported = (typeof SessionService !== "undefined" && SessionService.hibernateSupported) || false;
|
const hibernateSupported = (typeof SessionService !== "undefined" && SessionService.hibernateSupported) || false;
|
||||||
let filtered = allActions.filter(action => {
|
let filtered = allActions.filter(action => {
|
||||||
if (action === "hibernate" && !hibernateSupported)
|
if (action === "hibernate" && !hibernateSupported)
|
||||||
@@ -48,9 +51,14 @@ Rectangle {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (const action of requiredActions) {
|
||||||
|
if (!filtered.includes(action))
|
||||||
|
filtered.push(action);
|
||||||
|
}
|
||||||
|
|
||||||
visibleActions = filtered;
|
visibleActions = filtered;
|
||||||
|
|
||||||
useGridLayout = (typeof SettingsData !== "undefined" && SettingsData.powerMenuGridLayout !== undefined) ? SettingsData.powerMenuGridLayout : false;
|
useGridLayout = powerMenuGridLayoutOverride !== undefined ? powerMenuGridLayoutOverride : ((typeof SettingsData !== "undefined" && SettingsData.powerMenuGridLayout !== undefined) ? SettingsData.powerMenuGridLayout : false);
|
||||||
if (!useGridLayout)
|
if (!useGridLayout)
|
||||||
return;
|
return;
|
||||||
const count = visibleActions.length;
|
const count = visibleActions.length;
|
||||||
@@ -77,7 +85,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultActionIndex() {
|
function getDefaultActionIndex() {
|
||||||
const defaultAction = (typeof SettingsData !== "undefined" && SettingsData.powerMenuDefaultAction) ? SettingsData.powerMenuDefaultAction : "suspend";
|
const defaultAction = powerMenuDefaultActionOverride !== undefined ? powerMenuDefaultActionOverride : ((typeof SettingsData !== "undefined" && SettingsData.powerMenuDefaultAction) ? SettingsData.powerMenuDefaultAction : "suspend");
|
||||||
const index = visibleActions.indexOf(defaultAction);
|
const index = visibleActions.indexOf(defaultAction);
|
||||||
return index >= 0 ? index : 0;
|
return index >= 0 ? index : 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
@@ -8,17 +7,6 @@ import qs.Modules.Settings.Widgets
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool greeterInstalled: false
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: greeterCheck
|
|
||||||
command: ["sh", "-c", "command -v dms-greeter 2>/dev/null || [ -f /usr/share/quickshell/dms-greeter/shell.qml ]"]
|
|
||||||
running: false
|
|
||||||
onExited: exitCode => root.greeterInstalled = exitCode === 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: greeterCheck.running = true
|
|
||||||
|
|
||||||
readonly property var timeoutOptions: [I18n.tr("Never"), I18n.tr("1 minute"), I18n.tr("2 minutes"), I18n.tr("3 minutes"), I18n.tr("5 minutes"), I18n.tr("10 minutes"), I18n.tr("15 minutes"), I18n.tr("20 minutes"), I18n.tr("30 minutes"), I18n.tr("1 hour"), I18n.tr("1 hour 30 minutes"), I18n.tr("2 hours"), I18n.tr("3 hours")]
|
readonly property var timeoutOptions: [I18n.tr("Never"), I18n.tr("1 minute"), I18n.tr("2 minutes"), I18n.tr("3 minutes"), I18n.tr("5 minutes"), I18n.tr("10 minutes"), I18n.tr("15 minutes"), I18n.tr("20 minutes"), I18n.tr("30 minutes"), I18n.tr("1 hour"), I18n.tr("1 hour 30 minutes"), I18n.tr("2 hours"), I18n.tr("3 hours")]
|
||||||
readonly property var timeoutValues: [0, 60, 120, 180, 300, 600, 900, 1200, 1800, 3600, 5400, 7200, 10800]
|
readonly property var timeoutValues: [0, 60, 120, 180, 300, 600, 900, 1200, 1800, 3600, 5400, 7200, 10800]
|
||||||
|
|
||||||
@@ -487,16 +475,6 @@ Item {
|
|||||||
onToggled: checked => SettingsData.set("powerActionConfirm", checked)
|
onToggled: checked => SettingsData.set("powerActionConfirm", checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
|
||||||
settingKey: "powerActionConfirmGreeter"
|
|
||||||
tags: ["power", "confirm", "hold", "greeter", "login", "screen"]
|
|
||||||
text: I18n.tr("Hold to Confirm Power Actions on the Login Screen")
|
|
||||||
description: I18n.tr("Require holding to confirm power off, restart, suspend and hibernate on the DMS Greeter login screen")
|
|
||||||
checked: SettingsData.powerActionConfirmGreeter
|
|
||||||
visible: root.greeterInstalled
|
|
||||||
onToggled: checked => SettingsData.set("powerActionConfirmGreeter", checked)
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsDropdownRow {
|
SettingsDropdownRow {
|
||||||
id: holdDurationDropdown
|
id: holdDurationDropdown
|
||||||
settingKey: "powerActionHoldDuration"
|
settingKey: "powerActionHoldDuration"
|
||||||
@@ -506,7 +484,7 @@ Item {
|
|||||||
|
|
||||||
text: I18n.tr("Hold Duration")
|
text: I18n.tr("Hold Duration")
|
||||||
options: durationOptions
|
options: durationOptions
|
||||||
visible: SettingsData.powerActionConfirm || SettingsData.powerActionConfirmGreeter
|
visible: SettingsData.powerActionConfirm
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const currentDuration = SettingsData.powerActionHoldDuration;
|
const currentDuration = SettingsData.powerActionHoldDuration;
|
||||||
|
|||||||
@@ -5776,26 +5776,6 @@
|
|||||||
],
|
],
|
||||||
"description": "Require holding button/key to confirm power off, restart, suspend, hibernate and logout"
|
"description": "Require holding button/key to confirm power off, restart, suspend, hibernate and logout"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"section": "powerActionConfirmGreeter",
|
|
||||||
"label": "Hold to confirm on login screen",
|
|
||||||
"tabIndex": 21,
|
|
||||||
"category": "Power & Sleep",
|
|
||||||
"keywords": [
|
|
||||||
"confirm",
|
|
||||||
"greeter",
|
|
||||||
"hold",
|
|
||||||
"holding",
|
|
||||||
"login",
|
|
||||||
"power",
|
|
||||||
"reboot",
|
|
||||||
"restart",
|
|
||||||
"screen",
|
|
||||||
"shutdown",
|
|
||||||
"suspend"
|
|
||||||
],
|
|
||||||
"description": "Require holding to confirm power off, restart, suspend and hibernate on the greetd login screen"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"section": "idleSettings",
|
"section": "idleSettings",
|
||||||
"label": "Idle Settings",
|
"label": "Idle Settings",
|
||||||
|
|||||||
Reference in New Issue
Block a user