1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

dankbar: add option to disable maximize detection

fixes #895
This commit is contained in:
bbedward
2025-12-04 08:56:04 -05:00
parent 08a97aeff8
commit e1acaaa27c
6 changed files with 390 additions and 207 deletions

View File

@@ -372,7 +372,8 @@ Singleton {
openOnOverview: false, openOnOverview: false,
visible: true, visible: true,
popupGapsAuto: true, popupGapsAuto: true,
popupGapsManual: 4 popupGapsManual: 4,
maximizeDetection: true
} }
] ]

View File

@@ -270,7 +270,8 @@ var SPEC = {
openOnOverview: false, openOnOverview: false,
visible: true, visible: true,
popupGapsAuto: true, popupGapsAuto: true,
popupGapsManual: 4 popupGapsManual: 4,
maximizeDetection: true
}], onChange: "updateBarConfigs" } }], onChange: "updateBarConfigs" }
}; };

View File

@@ -149,6 +149,8 @@ PanelWindow {
property string screenName: modelData.name property string screenName: modelData.name
readonly property bool hasMaximizedToplevel: { readonly property bool hasMaximizedToplevel: {
if (!(barConfig?.maximizeDetection ?? true))
return false;
if (!CompositorService.isHyprland && !CompositorService.isNiri) if (!CompositorService.isHyprland && !CompositorService.isNiri)
return false; return false;

View File

@@ -236,7 +236,8 @@ Item {
openOnOverview: defaultBar.openOnOverview ?? false, openOnOverview: defaultBar.openOnOverview ?? false,
visible: defaultBar.visible ?? true, visible: defaultBar.visible ?? true,
popupGapsAuto: defaultBar.popupGapsAuto ?? true, popupGapsAuto: defaultBar.popupGapsAuto ?? true,
popupGapsManual: defaultBar.popupGapsManual ?? 4 popupGapsManual: defaultBar.popupGapsManual ?? 4,
maximizeDetection: defaultBar.maximizeDetection ?? true
}; };
SettingsData.addBarConfig(newBar); SettingsData.addBarConfig(newBar);
selectedBarId = newId; selectedBarId = newId;
@@ -739,6 +740,17 @@ Item {
} }
} }
SettingsToggleCard {
iconName: "fit_screen"
title: I18n.tr("Maximize Detection")
description: I18n.tr("Remove gaps and border when windows are maximized")
visible: selectedBarConfig?.enabled && (CompositorService.isNiri || CompositorService.isHyprland)
checked: selectedBarConfig?.maximizeDetection ?? true
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
maximizeDetection: checked
})
}
SettingsCard { SettingsCard {
iconName: "space_bar" iconName: "space_bar"
title: I18n.tr("Spacing") title: I18n.tr("Spacing")
@@ -932,34 +944,16 @@ Item {
} }
} }
SettingsCard { SettingsToggleCard {
iconName: "border_style" iconName: "border_style"
title: I18n.tr("Border") title: I18n.tr("Border")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled
SettingsToggleRow {
text: I18n.tr("Enable Border")
checked: selectedBarConfig?.borderEnabled ?? false checked: selectedBarConfig?.borderEnabled ?? false
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
borderEnabled: checked borderEnabled: checked
}) })
}
Column {
width: parent.width
leftPadding: Theme.spacingM
spacing: Theme.spacingM
visible: selectedBarConfig?.borderEnabled ?? false
Rectangle {
width: parent.width - parent.leftPadding
height: 1
color: Theme.outline
opacity: 0.15
}
SettingsButtonGroupRow { SettingsButtonGroupRow {
width: parent.width - parent.parent.leftPadding
text: I18n.tr("Color") text: I18n.tr("Color")
model: ["Surface", "Secondary", "Primary"] model: ["Surface", "Secondary", "Primary"]
currentIndex: { currentIndex: {
@@ -997,8 +991,7 @@ Item {
SettingsSliderRow { SettingsSliderRow {
id: borderOpacitySlider id: borderOpacitySlider
width: parent.width - parent.parent.leftPadding text: I18n.tr("Opacity")
text: I18n.tr("Border Opacity")
value: (selectedBarConfig?.borderOpacity ?? 1.0) * 100 value: (selectedBarConfig?.borderOpacity ?? 1.0) * 100
minimum: 0 minimum: 0
maximum: 100 maximum: 100
@@ -1019,8 +1012,7 @@ Item {
SettingsSliderRow { SettingsSliderRow {
id: borderThicknessSlider id: borderThicknessSlider
width: parent.width - parent.parent.leftPadding text: I18n.tr("Thickness")
text: I18n.tr("Border Thickness")
value: selectedBarConfig?.borderThickness ?? 1 value: selectedBarConfig?.borderThickness ?? 1
minimum: 1 minimum: 1
maximum: 10 maximum: 10
@@ -1039,36 +1031,17 @@ Item {
} }
} }
} }
}
SettingsCard { SettingsToggleCard {
iconName: "highlight" iconName: "highlight"
title: I18n.tr("Widget Outline") title: I18n.tr("Widget Outline")
visible: selectedBarConfig?.enabled visible: selectedBarConfig?.enabled
SettingsToggleRow {
text: I18n.tr("Enable Widget Outline")
checked: selectedBarConfig?.widgetOutlineEnabled ?? false checked: selectedBarConfig?.widgetOutlineEnabled ?? false
onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { onToggled: checked => SettingsData.updateBarConfig(selectedBarId, {
widgetOutlineEnabled: checked widgetOutlineEnabled: checked
}) })
}
Column {
width: parent.width
leftPadding: Theme.spacingM
spacing: Theme.spacingM
visible: selectedBarConfig?.widgetOutlineEnabled ?? false
Rectangle {
width: parent.width - parent.leftPadding
height: 1
color: Theme.outline
opacity: 0.15
}
SettingsButtonGroupRow { SettingsButtonGroupRow {
width: parent.width - parent.parent.leftPadding
text: I18n.tr("Color") text: I18n.tr("Color")
model: ["Surface", "Secondary", "Primary"] model: ["Surface", "Secondary", "Primary"]
currentIndex: { currentIndex: {
@@ -1106,8 +1079,7 @@ Item {
SettingsSliderRow { SettingsSliderRow {
id: widgetOutlineOpacitySlider id: widgetOutlineOpacitySlider
width: parent.width - parent.parent.leftPadding text: I18n.tr("Opacity")
text: I18n.tr("Outline Opacity")
value: (selectedBarConfig?.widgetOutlineOpacity ?? 1.0) * 100 value: (selectedBarConfig?.widgetOutlineOpacity ?? 1.0) * 100
minimum: 0 minimum: 0
maximum: 100 maximum: 100
@@ -1128,8 +1100,7 @@ Item {
SettingsSliderRow { SettingsSliderRow {
id: widgetOutlineThicknessSlider id: widgetOutlineThicknessSlider
width: parent.width - parent.parent.leftPadding text: I18n.tr("Thickness")
text: I18n.tr("Outline Thickness")
value: selectedBarConfig?.widgetOutlineThickness ?? 1 value: selectedBarConfig?.widgetOutlineThickness ?? 1
minimum: 1 minimum: 1
maximum: 10 maximum: 10
@@ -1148,7 +1119,6 @@ Item {
} }
} }
} }
}
SettingsCard { SettingsCard {
iconName: "opacity" iconName: "opacity"
@@ -1198,15 +1168,12 @@ Item {
} }
} }
SettingsCard { SettingsSliderCard {
id: fontScaleSliderCard
iconName: "text_fields" iconName: "text_fields"
title: I18n.tr("Font Scale") title: I18n.tr("Font Scale")
visible: selectedBarConfig?.enabled
SettingsSliderRow {
id: fontScaleSlider
text: I18n.tr("DankBar Font Scale")
description: I18n.tr("Scale DankBar font sizes independently") description: I18n.tr("Scale DankBar font sizes independently")
visible: selectedBarConfig?.enabled
minimum: 50 minimum: 50
maximum: 200 maximum: 200
value: Math.round((selectedBarConfig?.fontScale ?? 1.0) * 100) value: Math.round((selectedBarConfig?.fontScale ?? 1.0) * 100)
@@ -1218,7 +1185,7 @@ Item {
} }
Binding { Binding {
target: fontScaleSlider target: fontScaleSliderCard
property: "value" property: "value"
value: Math.round((selectedBarConfig?.fontScale ?? 1.0) * 100) value: Math.round((selectedBarConfig?.fontScale ?? 1.0) * 100)
restoreMode: Binding.RestoreBinding restoreMode: Binding.RestoreBinding
@@ -1226,5 +1193,4 @@ Item {
} }
} }
} }
}
} }

View File

@@ -0,0 +1,100 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.Common
import qs.Widgets
StyledRect {
id: root
property string tab: ""
property var tags: []
property string title: ""
property string description: ""
property string iconName: ""
property alias value: slider.value
property alias minimum: slider.minimum
property alias maximum: slider.maximum
property alias unit: slider.unit
property int defaultValue: -1
signal sliderValueChanged(int newValue)
width: parent?.width ?? 0
height: Theme.spacingL * 2 + contentColumn.height
radius: Theme.cornerRadius
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
Column {
id: contentColumn
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.spacingL
anchors.rightMargin: Theme.spacingL
spacing: Theme.spacingS
Row {
width: parent.width
spacing: Theme.spacingM
DankIcon {
id: headerIcon
name: root.iconName
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
visible: root.iconName !== ""
}
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
width: parent.width - headerIcon.width - (root.defaultValue >= 0 ? resetButton.width + Theme.spacingS : 0) - Theme.spacingM
StyledText {
text: root.title
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
visible: root.title !== ""
}
StyledText {
text: root.description
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
visible: root.description !== ""
}
}
DankActionButton {
id: resetButton
anchors.verticalCenter: parent.verticalCenter
buttonSize: 36
iconName: "restart_alt"
iconSize: 20
visible: root.defaultValue >= 0 && slider.value !== root.defaultValue
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
iconColor: Theme.surfaceVariantText
onClicked: {
slider.value = root.defaultValue;
root.sliderValueChanged(root.defaultValue);
}
}
}
DankSlider {
id: slider
width: parent.width
height: 32
showValue: true
wheelEnabled: false
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
onSliderValueChanged: newValue => root.sliderValueChanged(newValue)
}
}
}

View File

@@ -0,0 +1,113 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.Common
import qs.Widgets
StyledRect {
id: root
property string tab: ""
property var tags: []
property string title: ""
property string description: ""
property string iconName: ""
property bool checked: false
property bool enabled: true
default property alias content: expandedContent.children
readonly property bool hasContent: expandedContent.children.length > 0
signal toggled(bool checked)
width: parent?.width ?? 0
height: Theme.spacingL * 2 + mainColumn.height
radius: Theme.cornerRadius
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
Column {
id: mainColumn
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.spacingL
anchors.rightMargin: Theme.spacingL
spacing: Theme.spacingM
Item {
width: parent.width
height: headerColumn.height
Column {
id: headerColumn
anchors.left: parent.left
anchors.right: toggleSwitch.left
anchors.rightMargin: Theme.spacingM
spacing: Theme.spacingXS
Row {
spacing: Theme.spacingM
DankIcon {
id: headerIcon
name: root.iconName
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
visible: root.iconName !== ""
}
StyledText {
id: headerText
text: root.title
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
visible: root.title !== ""
}
}
StyledText {
id: descriptionText
text: root.description
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
visible: root.description !== ""
}
}
DankToggle {
id: toggleSwitch
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
hideText: true
checked: root.checked
enabled: root.enabled
onToggled: checked => root.toggled(checked)
}
StateLayer {
anchors.fill: parent
disabled: !root.enabled
stateColor: Theme.primary
cornerRadius: root.radius
onClicked: {
if (!root.enabled)
return;
root.toggled(!root.checked);
}
}
}
Column {
id: expandedContent
width: parent.width
spacing: Theme.spacingM
visible: root.checked && root.hasContent
}
}
}