1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-08 06:28:27 -04:00

feat: lockscreen screen filter (#2740)

this makes use of the existing getFilteredScreens function to allow
users to specify which displays the lockscreen should appear on. prior
to this change, it was "all" or just one.
This commit is contained in:
Scott McKendry
2026-07-05 03:04:59 +12:00
committed by GitHub
parent 52ed719489
commit 7b1c542585
6 changed files with 26 additions and 68 deletions
+11 -1
View File
@@ -889,7 +889,6 @@ Singleton {
readonly property bool greeterU2fReady: Processes.greeterU2fReady readonly property bool greeterU2fReady: Processes.greeterU2fReady
readonly property string greeterU2fReason: Processes.greeterU2fReason readonly property string greeterU2fReason: Processes.greeterU2fReason
readonly property string greeterU2fSource: Processes.greeterU2fSource readonly property string greeterU2fSource: Processes.greeterU2fSource
property string lockScreenActiveMonitor: "all"
property string lockScreenInactiveColor: "#000000" property string lockScreenInactiveColor: "#000000"
property int lockScreenNotificationMode: 0 property int lockScreenNotificationMode: 0
property bool lockScreenVideoEnabled: false property bool lockScreenVideoEnabled: false
@@ -1745,6 +1744,17 @@ Singleton {
} }
} }
if (obj?.lockScreenActiveMonitor !== undefined) {
var oldVal = obj.lockScreenActiveMonitor;
if (oldVal && oldVal !== "all") {
if (!obj.screenPreferences) obj.screenPreferences = {};
if (obj.screenPreferences.lockScreen === undefined) {
obj.screenPreferences.lockScreen = [oldVal];
}
}
delete obj.lockScreenActiveMonitor;
}
Store.parse(root, obj); Store.parse(root, obj);
if (obj?.directionalAnimationMode === 3 && frameMode !== "connected") if (obj?.directionalAnimationMode === 3 && frameMode !== "connected")
@@ -451,7 +451,6 @@ var SPEC = {
maxFprintTries: { def: 15 }, maxFprintTries: { def: 15 },
enableU2f: { def: false, onChange: "scheduleAuthApply" }, enableU2f: { def: false, onChange: "scheduleAuthApply" },
u2fMode: { def: "or" }, u2fMode: { def: "or" },
lockScreenActiveMonitor: { def: "all" },
lockScreenInactiveColor: { def: "#000000" }, lockScreenInactiveColor: { def: "#000000" },
lockScreenNotificationMode: { def: 0 }, lockScreenNotificationMode: { def: 0 },
lockScreenVideoEnabled: { def: false }, lockScreenVideoEnabled: { def: false },
+1 -3
View File
@@ -196,9 +196,7 @@ Scope {
property bool isActiveScreen: { property bool isActiveScreen: {
if (Quickshell.screens.length <= 1) if (Quickshell.screens.length <= 1)
return true; return true;
if (SettingsData.lockScreenActiveMonitor === "all") return SettingsData.getFilteredScreens("lockScreen").includes(screen);
return true;
return currentScreenName === SettingsData.lockScreenActiveMonitor;
} }
color: isActiveScreen ? "transparent" : SettingsData.lockScreenInactiveColor color: isActiveScreen ? "transparent" : SettingsData.lockScreenInactiveColor
+13 -44
View File
@@ -398,64 +398,33 @@ Item {
iconName: "monitor" iconName: "monitor"
title: I18n.tr("Lock Screen Display") title: I18n.tr("Lock Screen Display")
settingKey: "lockDisplay" settingKey: "lockDisplay"
visible: Quickshell.screens.length > 1
StyledText { StyledText {
text: I18n.tr("Choose which monitor shows the lock screen interface. Other monitors will display a solid color for OLED burn-in protection.") text: I18n.tr("Choose which monitors show the lock screen interface. Other monitors will display a solid color for OLED burn-in protection.")
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
width: parent.width width: parent.width
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
SettingsDropdownRow { SettingsDisplayPicker {
id: lockScreenMonitorDropdown width: parent.width
settingKey: "lockScreenActiveMonitor" displayPreferences: SettingsData.screenPreferences?.lockScreen || ["all"]
tags: ["lock", "screen", "monitor", "display", "active"] onPreferencesChanged: prefs => {
text: I18n.tr("Active Lock Screen Monitor") var p = SettingsData.screenPreferences || {};
options: { var updated = Object.assign({}, p);
var opts = [I18n.tr("All Monitors")]; updated["lockScreen"] = prefs;
var screens = Quickshell.screens; SettingsData.set("screenPreferences", updated);
for (var i = 0; i < screens.length; i++) {
opts.push(SettingsData.getScreenDisplayName(screens[i]));
}
return opts;
}
Component.onCompleted: {
if (SettingsData.lockScreenActiveMonitor === "all") {
currentValue = I18n.tr("All Monitors");
return;
}
var screens = Quickshell.screens;
for (var i = 0; i < screens.length; i++) {
if (screens[i].name === SettingsData.lockScreenActiveMonitor) {
currentValue = SettingsData.getScreenDisplayName(screens[i]);
return;
}
}
currentValue = I18n.tr("All Monitors");
}
onValueChanged: value => {
if (value === I18n.tr("All Monitors")) {
SettingsData.set("lockScreenActiveMonitor", "all");
return;
}
var screens = Quickshell.screens;
for (var i = 0; i < screens.length; i++) {
if (SettingsData.getScreenDisplayName(screens[i]) === value) {
SettingsData.set("lockScreenActiveMonitor", screens[i].name);
return;
}
}
} }
} }
Row { Row {
width: parent.width width: parent.width
spacing: Theme.spacingM spacing: Theme.spacingM
visible: SettingsData.lockScreenActiveMonitor !== "all" visible: {
var prefs = SettingsData.screenPreferences?.lockScreen;
return Array.isArray(prefs) && !prefs.includes("all") && prefs.length > 0;
}
Column { Column {
width: parent.width - inactiveColorPreview.width - Theme.spacingM width: parent.width - inactiveColorPreview.width - Theme.spacingM
@@ -80,7 +80,7 @@ Item {
width: parent.width width: parent.width
text: SettingsData.getScreenDisplayName(modelData) text: SettingsData.getScreenDisplayName(modelData)
description: modelData.width + "×" + modelData.height description: modelData.width + "×" + modelData.height + " • " + (SettingsData.displayNameMode === "system" ? (modelData.model || I18n.tr("Unknown Model")) : modelData.name)
checked: localChecked checked: localChecked
onToggled: isChecked => { onToggled: isChecked => {
var prefs = JSON.parse(JSON.stringify(root.displayPreferences)); var prefs = JSON.parse(JSON.stringify(root.displayPreferences));
@@ -4579,23 +4579,6 @@
"zenbrowser" "zenbrowser"
] ]
}, },
{
"section": "lockScreenActiveMonitor",
"label": "Active Lock Screen Monitor",
"tabIndex": 11,
"category": "Lock Screen",
"keywords": [
"active",
"display",
"lock",
"lockscreen",
"login",
"monitor",
"password",
"screen",
"security"
]
},
{ {
"section": "lockScreenVideoCycling", "section": "lockScreenVideoCycling",
"label": "Automatic Cycling", "label": "Automatic Cycling",
@@ -4747,7 +4730,6 @@
"tabIndex": 11, "tabIndex": 11,
"category": "Lock Screen", "category": "Lock Screen",
"keywords": [ "keywords": [
"active",
"display", "display",
"lock", "lock",
"lockscreen", "lockscreen",