mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
lock: allow custom lock command
This commit is contained in:
@@ -238,6 +238,7 @@ Singleton {
|
|||||||
property bool osdAlwaysShowValue: false
|
property bool osdAlwaysShowValue: false
|
||||||
|
|
||||||
property bool powerActionConfirm: true
|
property bool powerActionConfirm: true
|
||||||
|
property string customPowerActionLock: ""
|
||||||
property string customPowerActionLogout: ""
|
property string customPowerActionLogout: ""
|
||||||
property string customPowerActionSuspend: ""
|
property string customPowerActionSuspend: ""
|
||||||
property string customPowerActionHibernate: ""
|
property string customPowerActionHibernate: ""
|
||||||
@@ -452,6 +453,7 @@ Singleton {
|
|||||||
notificationPopupPosition = settings.notificationPopupPosition !== undefined ? settings.notificationPopupPosition : SettingsData.Position.Top
|
notificationPopupPosition = settings.notificationPopupPosition !== undefined ? settings.notificationPopupPosition : SettingsData.Position.Top
|
||||||
osdAlwaysShowValue = settings.osdAlwaysShowValue !== undefined ? settings.osdAlwaysShowValue : false
|
osdAlwaysShowValue = settings.osdAlwaysShowValue !== undefined ? settings.osdAlwaysShowValue : false
|
||||||
powerActionConfirm = settings.powerActionConfirm !== undefined ? settings.powerActionConfirm : true
|
powerActionConfirm = settings.powerActionConfirm !== undefined ? settings.powerActionConfirm : true
|
||||||
|
customPowerActionLock = settings.customPowerActionLock != undefined ? settings.customPowerActionLock : ""
|
||||||
customPowerActionLogout = settings.customPowerActionLogout != undefined ? settings.customPowerActionLogout : ""
|
customPowerActionLogout = settings.customPowerActionLogout != undefined ? settings.customPowerActionLogout : ""
|
||||||
customPowerActionSuspend = settings.customPowerActionSuspend != undefined ? settings.customPowerActionSuspend : ""
|
customPowerActionSuspend = settings.customPowerActionSuspend != undefined ? settings.customPowerActionSuspend : ""
|
||||||
customPowerActionHibernate = settings.customPowerActionHibernate != undefined ? settings.customPowerActionHibernate : ""
|
customPowerActionHibernate = settings.customPowerActionHibernate != undefined ? settings.customPowerActionHibernate : ""
|
||||||
@@ -646,6 +648,7 @@ Singleton {
|
|||||||
"notificationPopupPosition": notificationPopupPosition,
|
"notificationPopupPosition": notificationPopupPosition,
|
||||||
"osdAlwaysShowValue": osdAlwaysShowValue,
|
"osdAlwaysShowValue": osdAlwaysShowValue,
|
||||||
"powerActionConfirm": powerActionConfirm,
|
"powerActionConfirm": powerActionConfirm,
|
||||||
|
"customPowerActionLock": customPowerActionLock,
|
||||||
"customPowerActionLogout": customPowerActionLogout,
|
"customPowerActionLogout": customPowerActionLogout,
|
||||||
"customPowerActionSuspend": customPowerActionSuspend,
|
"customPowerActionSuspend": customPowerActionSuspend,
|
||||||
"customPowerActionHibernate": customPowerActionHibernate,
|
"customPowerActionHibernate": customPowerActionHibernate,
|
||||||
@@ -716,8 +719,8 @@ Singleton {
|
|||||||
"hideBrightnessSlider", "widgetBackgroundColor", "surfaceBase",
|
"hideBrightnessSlider", "widgetBackgroundColor", "surfaceBase",
|
||||||
"notificationTimeoutLow", "notificationTimeoutNormal", "notificationTimeoutCritical",
|
"notificationTimeoutLow", "notificationTimeoutNormal", "notificationTimeoutCritical",
|
||||||
"notificationPopupPosition", "osdAlwaysShowValue", "powerActionConfirm",
|
"notificationPopupPosition", "osdAlwaysShowValue", "powerActionConfirm",
|
||||||
"customPowerActionLogout", "customPowerActionSuspend", "customPowerActionHibernate",
|
"customPowerActionLock", "customPowerActionLogout", "customPowerActionSuspend",
|
||||||
"customPowerActionReboot", "customPowerActionPowerOff",
|
"customPowerActionHibernate", "customPowerActionReboot", "customPowerActionPowerOff",
|
||||||
"updaterUseCustomCommand", "updaterCustomCommand", "updaterTerminalAdditionalParams",
|
"updaterUseCustomCommand", "updaterCustomCommand", "updaterTerminalAdditionalParams",
|
||||||
"screenPreferences", "animationSpeed", "acMonitorTimeout", "acLockTimeout",
|
"screenPreferences", "animationSpeed", "acMonitorTimeout", "acLockTimeout",
|
||||||
"acSuspendTimeout", "acHibernateTimeout", "batteryMonitorTimeout", "batteryLockTimeout",
|
"acSuspendTimeout", "acHibernateTimeout", "batteryMonitorTimeout", "batteryLockTimeout",
|
||||||
@@ -1713,6 +1716,11 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCustomPowerActionLock(command) {
|
||||||
|
customPowerActionLock = command;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
function setCustomPowerActionLogout(command) {
|
function setCustomPowerActionLogout(command) {
|
||||||
customPowerActionLogout = command;
|
customPowerActionLogout = command;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|||||||
@@ -391,6 +391,38 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Command or script to run instead of the standard lock procedure")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: customLockCommand
|
||||||
|
width: parent.width
|
||||||
|
height: 48
|
||||||
|
placeholderText: "/usr/bin/myLock.sh"
|
||||||
|
backgroundColor: Theme.surfaceVariant
|
||||||
|
normalBorderColor: Theme.primarySelected
|
||||||
|
focusedBorderColor: Theme.primary
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (SettingsData.customPowerActionLock) {
|
||||||
|
text = SettingsData.customPowerActionLock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextEdited: {
|
||||||
|
SettingsData.setCustomPowerActionLock(text.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ Scope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function lock() {
|
function lock() {
|
||||||
|
if (SettingsData.customPowerActionLock && SettingsData.customPowerActionLock.length > 0) {
|
||||||
|
Quickshell.execDetached(SettingsData.customPowerActionLock.split(" "))
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!processingExternalEvent && SettingsData.loginctlLockIntegration && DMSService.isConnected) {
|
if (!processingExternalEvent && SettingsData.loginctlLockIntegration && DMSService.isConnected) {
|
||||||
DMSService.lockSession(response => {
|
DMSService.lockSession(response => {
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user