1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

displays: add configurator for niri, Hyprland, and MangoWC

- Configure position, VRR, orientation, resolution, refresh rate
- Split Display section into Configuration, Gamma, and Widgets
- MangoWC omits VRR because it doesnt have per-display VRR
- HDR configuration not present for Hyprland
This commit is contained in:
bbedward
2025-12-15 16:36:14 -05:00
parent bafe1c5fee
commit 2745116ac5
15 changed files with 2727 additions and 648 deletions

View File

@@ -273,8 +273,8 @@ Item {
anchors {
left: true
top: true
right: root.useSingleWindow ? true : undefined
bottom: root.useSingleWindow ? true : undefined
right: root.useSingleWindow
bottom: root.useSingleWindow
}
WlrLayershell.margins {
@@ -284,8 +284,8 @@ Item {
bottom: 0
}
implicitWidth: root.useSingleWindow ? undefined : root.alignedWidth + (shadowBuffer * 2)
implicitHeight: root.useSingleWindow ? undefined : root.alignedHeight + (shadowBuffer * 2)
implicitWidth: root.useSingleWindow ? 0 : root.alignedWidth + (shadowBuffer * 2)
implicitHeight: root.useSingleWindow ? 0 : root.alignedHeight + (shadowBuffer * 2)
onVisibleChanged: {
if (visible) {

View File

@@ -7,10 +7,11 @@ DankModal {
id: root
property string outputName: ""
property var position: undefined
property var mode: undefined
property var vrr: undefined
property int countdown: 15
property var changes: []
property int countdown: 10
signal confirmed
signal reverted
shouldBeVisible: false
allowStacking: true
@@ -23,23 +24,27 @@ DankModal {
repeat: true
running: root.shouldBeVisible
onTriggered: {
countdown--;
if (countdown <= 0) {
revert();
root.countdown--;
if (root.countdown <= 0) {
root.reverted();
root.close();
}
}
}
onOpened: {
countdown = 15;
countdown = 10;
countdownTimer.start();
}
onClosed: {
onDialogClosed: {
countdownTimer.stop();
}
onBackgroundClicked: revert
onBackgroundClicked: {
root.reverted();
root.close();
}
content: Component {
FocusScope {
@@ -50,12 +55,14 @@ DankModal {
implicitHeight: mainColumn.implicitHeight
Keys.onEscapePressed: event => {
revert();
root.reverted();
root.close();
event.accepted = true;
}
Keys.onReturnPressed: event => {
confirm();
root.confirmed();
root.close();
event.accepted = true;
}
@@ -69,81 +76,42 @@ DankModal {
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
}
StyledText {
text: I18n.tr("Confirm Display Changes")
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
}
Rectangle {
width: parent.width
height: 80
height: 70
radius: Theme.cornerRadius
color: Theme.surfaceContainerHighest
Column {
StyledText {
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
}
text: root.countdown + "s"
font.pixelSize: Theme.fontSizeXLarge * 1.5
color: Theme.primary
font.weight: Font.Bold
}
}
Column {
width: parent.width
spacing: Theme.spacingXS
visible: root.changes.length > 0
StyledText {
text: I18n.tr("Changes:")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceTextMedium
font.weight: Font.Medium
}
Repeater {
model: root.changes
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
StyledText {
required property var modelData
text: modelData
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
@@ -180,7 +148,10 @@ DankModal {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: revert
onClicked: {
root.reverted();
root.close();
}
}
}
@@ -206,7 +177,10 @@ DankModal {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: confirm
onClicked: {
root.confirmed();
root.close();
}
}
Behavior on color {
@@ -228,18 +202,11 @@ DankModal {
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: revert
onClicked: {
root.reverted();
root.close();
}
}
}
}
function confirm() {
displaysTab.confirmChanges();
close();
}
function revert() {
displaysTab.revertChanges();
close();
}
}

View File

@@ -125,13 +125,45 @@ FocusScope {
}
Loader {
id: displaysLoader
id: displayConfigLoader
anchors.fill: parent
active: root.currentIndex === 6
active: root.currentIndex === 24
visible: active
focus: active
sourceComponent: DisplaysTab {}
sourceComponent: DisplayConfigTab {}
onActiveChanged: {
if (active && item) {
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: gammaControlLoader
anchors.fill: parent
active: root.currentIndex === 25
visible: active
focus: active
sourceComponent: GammaControlTab {}
onActiveChanged: {
if (active && item) {
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: displayWidgetsLoader
anchors.fill: parent
active: root.currentIndex === 26
visible: active
focus: active
sourceComponent: DisplayWidgetsTab {}
onActiveChanged: {
if (active && item) {

View File

@@ -58,7 +58,7 @@ FloatingWindow {
objectName: "settingsModal"
title: I18n.tr("Settings", "settings window title")
minimumSize: Qt.size(500, 400)
implicitWidth: 800
implicitWidth: 900
implicitHeight: screen ? Math.min(940, screen.height - 100) : 940
color: Theme.surfaceContainer
visible: false

View File

@@ -144,6 +144,32 @@ Rectangle {
"tabIndex": 2,
"shortcutsOnly": true
},
{
"id": "displays",
"text": I18n.tr("Displays"),
"icon": "monitor",
"collapsedByDefault": true,
"children": [
{
"id": "display_config",
"text": I18n.tr("Configuration") + " (Beta)",
"icon": "display_settings",
"tabIndex": 24
},
{
"id": "display_gamma",
"text": I18n.tr("Gamma Control"),
"icon": "brightness_6",
"tabIndex": 25
},
{
"id": "display_widgets",
"text": I18n.tr("Widgets", "settings_displays"),
"icon": "widgets",
"tabIndex": 26
}
]
},
{
"id": "network",
"text": I18n.tr("Network"),
@@ -157,12 +183,6 @@ Rectangle {
"icon": "computer",
"collapsedByDefault": true,
"children": [
{
"id": "displays",
"text": I18n.tr("Displays"),
"icon": "monitor",
"tabIndex": 6
},
{
"id": "printers",
"text": I18n.tr("Printers"),