1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00
Files
DankMaterialShell/quickshell/Modules/Settings/LockScreenTab.qml
bbedward d9d6ab5776 settings: add search
- because tabs arent loaded at runtime, we have to have a separate index
- Less ideal, but functional enough for now
2025-12-26 19:19:47 -05:00

224 lines
9.9 KiB
QML

import QtQuick
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets
Item {
id: root
DankFlickable {
anchors.fill: parent
clip: true
contentHeight: mainColumn.height + Theme.spacingXL
contentWidth: width
Column {
id: mainColumn
topPadding: 4
width: Math.min(550, parent.width - Theme.spacingL * 2)
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.spacingXL
SettingsCard {
width: parent.width
iconName: "lock"
title: I18n.tr("Lock Screen layout")
settingKey: "lockLayout"
SettingsToggleRow {
text: I18n.tr("Show Power Actions", "Enable power action icon on the lock screen window")
checked: SettingsData.lockScreenShowPowerActions
onToggled: checked => SettingsData.set("lockScreenShowPowerActions", checked)
}
SettingsToggleRow {
text: I18n.tr("Show System Icons", "Enable system status icons on the lock screen window")
checked: SettingsData.lockScreenShowSystemIcons
onToggled: checked => SettingsData.set("lockScreenShowSystemIcons", checked)
}
SettingsToggleRow {
text: I18n.tr("Show System Time", "Enable system time display on the lock screen window")
checked: SettingsData.lockScreenShowTime
onToggled: checked => SettingsData.set("lockScreenShowTime", checked)
}
SettingsToggleRow {
text: I18n.tr("Show System Date", "Enable system date display on the lock screen window")
checked: SettingsData.lockScreenShowDate
onToggled: checked => SettingsData.set("lockScreenShowDate", checked)
}
SettingsToggleRow {
text: I18n.tr("Show Profile Image", "Enable profile image display on the lock screen window")
checked: SettingsData.lockScreenShowProfileImage
onToggled: checked => SettingsData.set("lockScreenShowProfileImage", checked)
}
SettingsToggleRow {
text: I18n.tr("Show Password Field", "Enable password field display on the lock screen window")
description: I18n.tr("If the field is hidden, it will appear as soon as a key is pressed.")
checked: SettingsData.lockScreenShowPasswordField
onToggled: checked => SettingsData.set("lockScreenShowPasswordField", checked)
}
}
SettingsCard {
width: parent.width
iconName: "lock"
title: I18n.tr("Lock Screen behaviour")
settingKey: "lockBehavior"
StyledText {
text: I18n.tr("loginctl not available - lock integration requires DMS socket connection")
font.pixelSize: Theme.fontSizeSmall
color: Theme.warning
visible: !SessionService.loginctlAvailable
width: parent.width
wrapMode: Text.Wrap
}
SettingsToggleRow {
text: I18n.tr("Enable loginctl lock integration")
description: I18n.tr("Bind lock screen to dbus signals from loginctl. Disable if using an external lock screen")
checked: SessionService.loginctlAvailable && SettingsData.loginctlLockIntegration
enabled: SessionService.loginctlAvailable
onToggled: checked => {
if (!SessionService.loginctlAvailable)
return;
SettingsData.set("loginctlLockIntegration", checked);
}
}
SettingsToggleRow {
text: I18n.tr("Lock before suspend")
description: I18n.tr("Automatically lock the screen when the system prepares to suspend")
checked: SettingsData.lockBeforeSuspend
visible: SessionService.loginctlAvailable && SettingsData.loginctlLockIntegration
onToggled: checked => SettingsData.set("lockBeforeSuspend", checked)
}
SettingsToggleRow {
text: I18n.tr("Enable fingerprint authentication")
description: I18n.tr("Use fingerprint reader for lock screen authentication (requires enrolled fingerprints)")
checked: SettingsData.enableFprint
visible: SettingsData.fprintdAvailable
onToggled: checked => SettingsData.set("enableFprint", checked)
}
}
SettingsCard {
width: parent.width
iconName: "monitor"
title: I18n.tr("Lock Screen Display")
settingKey: "lockDisplay"
visible: Quickshell.screens.length > 1
StyledText {
text: I18n.tr("Choose which monitor shows the lock screen interface. Other monitors will display a solid color for OLED burn-in protection.")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.Wrap
}
SettingsDropdownRow {
id: lockScreenMonitorDropdown
text: I18n.tr("Active Lock Screen Monitor")
options: {
var opts = [I18n.tr("All Monitors")];
var screens = Quickshell.screens;
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 {
width: parent.width
spacing: Theme.spacingM
visible: SettingsData.lockScreenActiveMonitor !== "all"
Column {
width: parent.width - inactiveColorPreview.width - Theme.spacingM
spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: I18n.tr("Inactive Monitor Color")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
}
StyledText {
text: I18n.tr("Color displayed on monitors without the lock screen")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.Wrap
}
}
Rectangle {
id: inactiveColorPreview
width: 48
height: 48
radius: Theme.cornerRadius
color: SettingsData.lockScreenInactiveColor
border.color: Theme.outline
border.width: 1
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
if (!PopoutService.colorPickerModal)
return;
PopoutService.colorPickerModal.selectedColor = SettingsData.lockScreenInactiveColor;
PopoutService.colorPickerModal.pickerTitle = I18n.tr("Inactive Monitor Color");
PopoutService.colorPickerModal.onColorSelectedCallback = function (selectedColor) {
SettingsData.set("lockScreenInactiveColor", selectedColor);
};
PopoutService.colorPickerModal.show();
}
}
}
}
}
}
}
}