mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-12 00:32:17 -04:00
feat: Add independent power action confirmation settings for dms greeter
This commit is contained in:
@@ -528,6 +528,7 @@ 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"
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ 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" },
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
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
|
||||||
@@ -7,6 +8,17 @@ 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]
|
||||||
|
|
||||||
@@ -475,6 +487,16 @@ 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"
|
||||||
@@ -484,7 +506,7 @@ Item {
|
|||||||
|
|
||||||
text: I18n.tr("Hold Duration")
|
text: I18n.tr("Hold Duration")
|
||||||
options: durationOptions
|
options: durationOptions
|
||||||
visible: SettingsData.powerActionConfirm
|
visible: SettingsData.powerActionConfirm || SettingsData.powerActionConfirmGreeter
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const currentDuration = SettingsData.powerActionHoldDuration;
|
const currentDuration = SettingsData.powerActionHoldDuration;
|
||||||
|
|||||||
@@ -5793,6 +5793,26 @@
|
|||||||
],
|
],
|
||||||
"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