mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
misc spacing improvements
This commit is contained in:
246
Modals/DisplayConfirmationModal.qml
Normal file
246
Modals/DisplayConfirmationModal.qml
Normal file
@@ -0,0 +1,246 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Modals.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
DankModal {
|
||||
id: root
|
||||
|
||||
property string outputName: ""
|
||||
property var position: undefined
|
||||
property var mode: undefined
|
||||
property var vrr: undefined
|
||||
property int countdown: 15
|
||||
|
||||
shouldBeVisible: false
|
||||
allowStacking: true
|
||||
width: 420
|
||||
height: contentLoader.item ? contentLoader.item.implicitHeight + Theme.spacingM * 2 : 200
|
||||
|
||||
Timer {
|
||||
id: countdownTimer
|
||||
interval: 1000
|
||||
repeat: true
|
||||
running: root.shouldBeVisible
|
||||
onTriggered: {
|
||||
countdown--
|
||||
if (countdown <= 0) {
|
||||
revert()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
countdown = 15
|
||||
countdownTimer.start()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
countdownTimer.stop()
|
||||
}
|
||||
|
||||
onBackgroundClicked: revert
|
||||
|
||||
content: Component {
|
||||
FocusScope {
|
||||
id: confirmContent
|
||||
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
implicitHeight: mainColumn.implicitHeight
|
||||
|
||||
Keys.onEscapePressed: event => {
|
||||
revert()
|
||||
event.accepted = true
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: event => {
|
||||
confirm()
|
||||
event.accepted = true
|
||||
}
|
||||
|
||||
Column {
|
||||
id: mainColumn
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
anchors.topMargin: Theme.spacingM
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Confirm Display Changes")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Display settings for ") + outputName
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 80
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceContainerHighest
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: 4
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Reverting in:")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: countdown + "s"
|
||||
font.pixelSize: Theme.fontSizeXLarge * 1.5
|
||||
color: Theme.primary
|
||||
font.weight: Font.Bold
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Changes:")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
StyledText {
|
||||
visible: position !== undefined && position !== null
|
||||
text: I18n.tr("Position: ") + (position ? position.x + ", " + position.y : "")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
visible: mode !== undefined && mode !== null && mode !== ""
|
||||
text: I18n.tr("Mode: ") + (mode || "")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
visible: vrr !== undefined && vrr !== null
|
||||
text: I18n.tr("VRR: ") + (vrr ? I18n.tr("Enabled") : I18n.tr("Disabled"))
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 36
|
||||
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Rectangle {
|
||||
width: Math.max(70, revertText.contentWidth + Theme.spacingM * 2)
|
||||
height: 36
|
||||
radius: Theme.cornerRadius
|
||||
color: revertArea.containsMouse ? Theme.surfaceTextHover : "transparent"
|
||||
border.color: Theme.surfaceVariantAlpha
|
||||
border.width: 1
|
||||
|
||||
StyledText {
|
||||
id: revertText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: I18n.tr("Revert")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: revertArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: revert
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Math.max(80, confirmText.contentWidth + Theme.spacingM * 2)
|
||||
height: 36
|
||||
radius: Theme.cornerRadius
|
||||
color: confirmArea.containsMouse ? Qt.darker(Theme.primary, 1.1) : Theme.primary
|
||||
|
||||
StyledText {
|
||||
id: confirmText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: I18n.tr("Keep Changes")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.background
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: confirmArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: confirm
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.topMargin: Theme.spacingM
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
iconName: "close"
|
||||
iconSize: Theme.iconSize - 4
|
||||
iconColor: Theme.surfaceText
|
||||
onClicked: revert
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
displaysTab.confirmChanges()
|
||||
close()
|
||||
}
|
||||
|
||||
function revert() {
|
||||
displaysTab.revertChanges()
|
||||
close()
|
||||
}
|
||||
}
|
||||
@@ -18,13 +18,6 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Battery not detected - only AC power settings available")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
visible: !BatteryService.batteryAvailable
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: lockScreenSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -287,6 +280,7 @@ Item {
|
||||
text: I18n.tr("Suspend behavior")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
leftPadding: Theme.spacingM
|
||||
}
|
||||
|
||||
DankButtonGroup {
|
||||
|
||||
@@ -37,7 +37,7 @@ Singleton {
|
||||
readonly property int suspendTimeout: isOnBattery ? SettingsData.batterySuspendTimeout : SettingsData.acSuspendTimeout
|
||||
readonly property int suspendBehavior: isOnBattery ? SettingsData.batterySuspendBehavior : SettingsData.acSuspendBehavior
|
||||
|
||||
readonly property bool mediaPlaying: MprisController.activePlayer !== null
|
||||
readonly property bool mediaPlaying: MprisController.activePlayer !== null && MprisController.activePlayer.isPlaying
|
||||
|
||||
onMonitorTimeoutChanged: _rearmIdleMonitors()
|
||||
onLockTimeoutChanged: _rearmIdleMonitors()
|
||||
@@ -62,6 +62,36 @@ Singleton {
|
||||
requestMonitorOn()
|
||||
}
|
||||
|
||||
function createMediaInhibitor() {
|
||||
if (!idleInhibitorAvailable) {
|
||||
return
|
||||
}
|
||||
|
||||
if (mediaInhibitor) {
|
||||
mediaInhibitor.destroy()
|
||||
mediaInhibitor = null
|
||||
}
|
||||
|
||||
const inhibitorString = `
|
||||
import QtQuick
|
||||
import Quickshell.Wayland
|
||||
|
||||
IdleInhibitor {
|
||||
active: false
|
||||
}
|
||||
`
|
||||
|
||||
mediaInhibitor = Qt.createQmlObject(inhibitorString, root, "IdleService.MediaInhibitor")
|
||||
mediaInhibitor.active = Qt.binding(() => root.mediaPlaying)
|
||||
}
|
||||
|
||||
function destroyMediaInhibitor() {
|
||||
if (mediaInhibitor) {
|
||||
mediaInhibitor.destroy()
|
||||
mediaInhibitor = null
|
||||
}
|
||||
}
|
||||
|
||||
function createIdleMonitors() {
|
||||
if (!idleMonitorAvailable) {
|
||||
console.info("IdleService: IdleMonitor not available, skipping creation")
|
||||
@@ -112,18 +142,8 @@ Singleton {
|
||||
}
|
||||
})
|
||||
|
||||
if (idleInhibitorAvailable) {
|
||||
const inhibitorString = `
|
||||
import QtQuick
|
||||
import Quickshell.Wayland
|
||||
|
||||
IdleInhibitor {
|
||||
active: false
|
||||
}
|
||||
`
|
||||
|
||||
mediaInhibitor = Qt.createQmlObject(inhibitorString, root, "IdleService.MediaInhibitor")
|
||||
mediaInhibitor.active = Qt.binding(() => root.idleInhibitorAvailable && SettingsData.preventIdleForMedia && root.mediaPlaying)
|
||||
if (SettingsData.preventIdleForMedia) {
|
||||
createMediaInhibitor()
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("IdleService: Error creating IdleMonitors:", e)
|
||||
@@ -154,6 +174,17 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onPreventIdleForMediaChanged() {
|
||||
if (SettingsData.preventIdleForMedia) {
|
||||
createMediaInhibitor()
|
||||
} else {
|
||||
destroyMediaInhibitor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!idleMonitorAvailable) {
|
||||
console.warn("IdleService: IdleMonitor not available - power management disabled. This requires a newer version of Quickshell.")
|
||||
|
||||
@@ -398,13 +398,13 @@
|
||||
{
|
||||
"term": "Automatically lock after",
|
||||
"context": "Automatically lock after",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:176",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:169",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Automatically lock the screen when the system prepares to suspend",
|
||||
"context": "Automatically lock the screen when the system prepares to suspend",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:95",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:88",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -449,16 +449,10 @@
|
||||
"reference": "Modules/Settings/DankBarTab.qml:133",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Battery not detected - only AC power settings available",
|
||||
"context": "Battery not detected - only AC power settings available",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:22",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Bind lock screen to dbus signals from loginctl. Disable if using an external lock screen",
|
||||
"context": "Bind lock screen to dbus signals from loginctl. Disable if using an external lock screen",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:82",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:75",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -734,37 +728,37 @@
|
||||
{
|
||||
"term": "Command or script to run instead of the standard hibernate procedure",
|
||||
"context": "Command or script to run instead of the standard hibernate procedure",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:514",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:508",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Command or script to run instead of the standard lock procedure",
|
||||
"context": "Command or script to run instead of the standard lock procedure",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:418",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:412",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Command or script to run instead of the standard logout procedure",
|
||||
"context": "Command or script to run instead of the standard logout procedure",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:450",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:444",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Command or script to run instead of the standard power off procedure",
|
||||
"context": "Command or script to run instead of the standard power off procedure",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:578",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:572",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Command or script to run instead of the standard reboot procedure",
|
||||
"context": "Command or script to run instead of the standard reboot procedure",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:546",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:540",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Command or script to run instead of the standard suspend procedure",
|
||||
"context": "Command or script to run instead of the standard suspend procedure",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:482",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:476",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -980,7 +974,7 @@
|
||||
{
|
||||
"term": "Custom Power Actions",
|
||||
"context": "Custom Power Actions",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:404",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:398",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -1352,13 +1346,13 @@
|
||||
{
|
||||
"term": "Enable fingerprint authentication",
|
||||
"context": "Enable fingerprint authentication",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:103",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:96",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Enable loginctl lock integration",
|
||||
"context": "Enable loginctl lock integration",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:81",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:74",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -1832,13 +1826,13 @@
|
||||
{
|
||||
"term": "Idle Settings",
|
||||
"context": "Idle Settings",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:138",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:131",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Idle monitoring not supported - requires newer Quickshell version",
|
||||
"context": "Idle monitoring not supported - requires newer Quickshell version",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:325",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:319",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -1874,7 +1868,7 @@
|
||||
{
|
||||
"term": "Inhibit idle timeout when audio or video is playing",
|
||||
"context": "Inhibit idle timeout when audio or video is playing",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:164",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:157",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -2054,7 +2048,7 @@
|
||||
{
|
||||
"term": "Lock Screen",
|
||||
"context": "Lock Screen",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:54",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:47",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -2066,7 +2060,7 @@
|
||||
{
|
||||
"term": "Lock before suspend",
|
||||
"context": "Lock before suspend",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:94",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:87",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -2840,7 +2834,7 @@
|
||||
{
|
||||
"term": "Power Action Confirmation",
|
||||
"context": "Power Action Confirmation",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:360",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:354",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -2870,7 +2864,7 @@
|
||||
{
|
||||
"term": "Prevent idle for media",
|
||||
"context": "Prevent idle for media",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:163",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:156",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -3020,7 +3014,7 @@
|
||||
{
|
||||
"term": "Request confirmation on power off, restart, suspend, hibernate and logout actions",
|
||||
"context": "Request confirmation on power off, restart, suspend, hibernate and logout actions",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:371",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:365",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -3284,7 +3278,7 @@
|
||||
{
|
||||
"term": "Show Confirmation on Power Actions",
|
||||
"context": "Show Confirmation on Power Actions",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:370",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:364",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -3302,7 +3296,7 @@
|
||||
{
|
||||
"term": "Show Power Actions",
|
||||
"context": "Show Power Actions",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:64",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:57",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -3368,7 +3362,7 @@
|
||||
{
|
||||
"term": "Show power, restart, and logout buttons on the lock screen",
|
||||
"context": "Show power, restart, and logout buttons on the lock screen",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:65",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:58",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -3524,13 +3518,13 @@
|
||||
{
|
||||
"term": "Suspend behavior",
|
||||
"context": "Suspend behavior",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:287",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:280",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Suspend system after",
|
||||
"context": "Suspend system after",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:250",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:243",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -3800,7 +3794,7 @@
|
||||
{
|
||||
"term": "Turn off monitors after",
|
||||
"context": "Turn off monitors after",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:213",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:206",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -3908,7 +3902,7 @@
|
||||
{
|
||||
"term": "Use fingerprint reader for lock screen authentication (requires enrolled fingerprints)",
|
||||
"context": "Use fingerprint reader for lock screen authentication (requires enrolled fingerprints)",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:104",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:97",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
@@ -4172,7 +4166,7 @@
|
||||
{
|
||||
"term": "loginctl not available - lock integration requires DMS socket connection",
|
||||
"context": "loginctl not available - lock integration requires DMS socket connection",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:71",
|
||||
"reference": "Modals/Settings/PowerSettings.qml:64",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
|
||||
@@ -524,13 +524,6 @@
|
||||
"reference": "",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Battery not detected - only AC power settings available",
|
||||
"translation": "",
|
||||
"context": "",
|
||||
"reference": "",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"term": "Bind lock screen to dbus signals from loginctl. Disable if using an external lock screen",
|
||||
"translation": "",
|
||||
|
||||
Reference in New Issue
Block a user