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 powerActionConfirm: true
|
||||
property string customPowerActionLock: ""
|
||||
property string customPowerActionLogout: ""
|
||||
property string customPowerActionSuspend: ""
|
||||
property string customPowerActionHibernate: ""
|
||||
@@ -452,6 +453,7 @@ Singleton {
|
||||
notificationPopupPosition = settings.notificationPopupPosition !== undefined ? settings.notificationPopupPosition : SettingsData.Position.Top
|
||||
osdAlwaysShowValue = settings.osdAlwaysShowValue !== undefined ? settings.osdAlwaysShowValue : false
|
||||
powerActionConfirm = settings.powerActionConfirm !== undefined ? settings.powerActionConfirm : true
|
||||
customPowerActionLock = settings.customPowerActionLock != undefined ? settings.customPowerActionLock : ""
|
||||
customPowerActionLogout = settings.customPowerActionLogout != undefined ? settings.customPowerActionLogout : ""
|
||||
customPowerActionSuspend = settings.customPowerActionSuspend != undefined ? settings.customPowerActionSuspend : ""
|
||||
customPowerActionHibernate = settings.customPowerActionHibernate != undefined ? settings.customPowerActionHibernate : ""
|
||||
@@ -646,6 +648,7 @@ Singleton {
|
||||
"notificationPopupPosition": notificationPopupPosition,
|
||||
"osdAlwaysShowValue": osdAlwaysShowValue,
|
||||
"powerActionConfirm": powerActionConfirm,
|
||||
"customPowerActionLock": customPowerActionLock,
|
||||
"customPowerActionLogout": customPowerActionLogout,
|
||||
"customPowerActionSuspend": customPowerActionSuspend,
|
||||
"customPowerActionHibernate": customPowerActionHibernate,
|
||||
@@ -716,8 +719,8 @@ Singleton {
|
||||
"hideBrightnessSlider", "widgetBackgroundColor", "surfaceBase",
|
||||
"notificationTimeoutLow", "notificationTimeoutNormal", "notificationTimeoutCritical",
|
||||
"notificationPopupPosition", "osdAlwaysShowValue", "powerActionConfirm",
|
||||
"customPowerActionLogout", "customPowerActionSuspend", "customPowerActionHibernate",
|
||||
"customPowerActionReboot", "customPowerActionPowerOff",
|
||||
"customPowerActionLock", "customPowerActionLogout", "customPowerActionSuspend",
|
||||
"customPowerActionHibernate", "customPowerActionReboot", "customPowerActionPowerOff",
|
||||
"updaterUseCustomCommand", "updaterCustomCommand", "updaterTerminalAdditionalParams",
|
||||
"screenPreferences", "animationSpeed", "acMonitorTimeout", "acLockTimeout",
|
||||
"acSuspendTimeout", "acHibernateTimeout", "batteryMonitorTimeout", "batteryLockTimeout",
|
||||
@@ -1713,6 +1716,11 @@ Singleton {
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setCustomPowerActionLock(command) {
|
||||
customPowerActionLock = command;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setCustomPowerActionLogout(command) {
|
||||
customPowerActionLogout = command;
|
||||
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 {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
@@ -19,6 +19,10 @@ Scope {
|
||||
}
|
||||
|
||||
function lock() {
|
||||
if (SettingsData.customPowerActionLock && SettingsData.customPowerActionLock.length > 0) {
|
||||
Quickshell.execDetached(SettingsData.customPowerActionLock.split(" "))
|
||||
return
|
||||
}
|
||||
if (!processingExternalEvent && SettingsData.loginctlLockIntegration && DMSService.isConnected) {
|
||||
DMSService.lockSession(response => {
|
||||
if (response.error) {
|
||||
|
||||
Reference in New Issue
Block a user