mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
ability to turn top bar square and adjust spacing
This commit is contained in:
@@ -75,6 +75,8 @@ Singleton {
|
|||||||
property real cornerRadius: 12
|
property real cornerRadius: 12
|
||||||
property bool notificationOverlayEnabled: false
|
property bool notificationOverlayEnabled: false
|
||||||
property bool topBarAutoHide: false
|
property bool topBarAutoHide: false
|
||||||
|
property real topBarSpacing: 4
|
||||||
|
property bool topBarSquareCorners: false
|
||||||
property int notificationTimeoutLow: 5000
|
property int notificationTimeoutLow: 5000
|
||||||
property int notificationTimeoutNormal: 5000
|
property int notificationTimeoutNormal: 5000
|
||||||
property int notificationTimeoutCritical: 0
|
property int notificationTimeoutCritical: 0
|
||||||
@@ -182,6 +184,8 @@ Singleton {
|
|||||||
notificationTimeoutLow = settings.notificationTimeoutLow !== undefined ? settings.notificationTimeoutLow : 5000;
|
notificationTimeoutLow = settings.notificationTimeoutLow !== undefined ? settings.notificationTimeoutLow : 5000;
|
||||||
notificationTimeoutNormal = settings.notificationTimeoutNormal !== undefined ? settings.notificationTimeoutNormal : 5000;
|
notificationTimeoutNormal = settings.notificationTimeoutNormal !== undefined ? settings.notificationTimeoutNormal : 5000;
|
||||||
notificationTimeoutCritical = settings.notificationTimeoutCritical !== undefined ? settings.notificationTimeoutCritical : 0;
|
notificationTimeoutCritical = settings.notificationTimeoutCritical !== undefined ? settings.notificationTimeoutCritical : 0;
|
||||||
|
topBarSpacing = settings.topBarSpacing !== undefined ? settings.topBarSpacing : 4;
|
||||||
|
topBarSquareCorners = settings.topBarSquareCorners !== undefined ? settings.topBarSquareCorners : false;
|
||||||
applyStoredTheme();
|
applyStoredTheme();
|
||||||
detectAvailableIconThemes();
|
detectAvailableIconThemes();
|
||||||
detectQtTools();
|
detectQtTools();
|
||||||
@@ -256,6 +260,8 @@ Singleton {
|
|||||||
"cornerRadius": cornerRadius,
|
"cornerRadius": cornerRadius,
|
||||||
"notificationOverlayEnabled": notificationOverlayEnabled,
|
"notificationOverlayEnabled": notificationOverlayEnabled,
|
||||||
"topBarAutoHide": topBarAutoHide,
|
"topBarAutoHide": topBarAutoHide,
|
||||||
|
"topBarSpacing": topBarSpacing,
|
||||||
|
"topBarSquareCorners": topBarSquareCorners,
|
||||||
"notificationTimeoutLow": notificationTimeoutLow,
|
"notificationTimeoutLow": notificationTimeoutLow,
|
||||||
"notificationTimeoutNormal": notificationTimeoutNormal,
|
"notificationTimeoutNormal": notificationTimeoutNormal,
|
||||||
"notificationTimeoutCritical": notificationTimeoutCritical
|
"notificationTimeoutCritical": notificationTimeoutCritical
|
||||||
@@ -723,6 +729,16 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setTopBarSpacing(spacing) {
|
||||||
|
topBarSpacing = spacing;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTopBarSquareCorners(enabled) {
|
||||||
|
topBarSquareCorners = enabled;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
function _shq(s) {
|
function _shq(s) {
|
||||||
return "'" + String(s).replace(/'/g, "'\\''") + "'";
|
return "'" + String(s).replace(/'/g, "'\\''") + "'";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -493,6 +493,83 @@ Item {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Top Bar Spacing
|
||||||
|
StyledRect {
|
||||||
|
width: parent.width
|
||||||
|
height: topBarSpacingSection.implicitHeight + Theme.spacingL * 2
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: topBarSpacingSection
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "space_bar"
|
||||||
|
size: Theme.iconSize
|
||||||
|
color: Theme.primary
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Top Bar Spacing"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Gap Around Top Bar (0 = edge-to-edge)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankSlider {
|
||||||
|
width: parent.width
|
||||||
|
height: 24
|
||||||
|
value: SettingsData.topBarSpacing
|
||||||
|
minimum: 0
|
||||||
|
maximum: 32
|
||||||
|
unit: ""
|
||||||
|
showValue: true
|
||||||
|
onSliderValueChanged: (newValue) => {
|
||||||
|
SettingsData.setTopBarSpacing(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
width: parent.width
|
||||||
|
text: "Square Corners"
|
||||||
|
description: "Disable corner radius for the top bar (always square corners)"
|
||||||
|
checked: SettingsData.topBarSquareCorners
|
||||||
|
onToggled: (checked) => {
|
||||||
|
SettingsData.setTopBarSquareCorners(checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// Theme Color
|
// Theme Color
|
||||||
StyledRect {
|
StyledRect {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ PanelWindow {
|
|||||||
property bool reveal: !autoHide || topBarMouseArea.containsMouse
|
property bool reveal: !autoHide || topBarMouseArea.containsMouse
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
implicitHeight: Theme.barHeight - 4
|
implicitHeight: Theme.barHeight - 4 + SettingsData.topBarSpacing
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
let fonts = Qt.fontFamilies()
|
let fonts = Qt.fontFamilies()
|
||||||
@@ -139,7 +139,7 @@ PanelWindow {
|
|||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusiveZone: autoHide ? -1 : Theme.barHeight - 4
|
exclusiveZone: autoHide ? -1 : Theme.barHeight - 4 + SettingsData.topBarSpacing
|
||||||
|
|
||||||
mask: Region {
|
mask: Region {
|
||||||
item: topBarMouseArea
|
item: topBarMouseArea
|
||||||
@@ -147,7 +147,7 @@ PanelWindow {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: topBarMouseArea
|
id: topBarMouseArea
|
||||||
height: root.reveal ? Theme.barHeight - 4 : 4
|
height: root.reveal ? Theme.barHeight - 4 + SettingsData.topBarSpacing : 4
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@@ -180,15 +180,14 @@ PanelWindow {
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 2
|
anchors.topMargin: SettingsData.topBarSpacing
|
||||||
anchors.topMargin: 6
|
|
||||||
anchors.bottomMargin: 0
|
anchors.bottomMargin: 0
|
||||||
anchors.leftMargin: 8
|
anchors.leftMargin: SettingsData.topBarSpacing
|
||||||
anchors.rightMargin: 8
|
anchors.rightMargin: SettingsData.topBarSpacing
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: Theme.cornerRadius
|
radius: SettingsData.topBarSquareCorners ? 0 : Theme.cornerRadius
|
||||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
|
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
|
||||||
Theme.surfaceContainer.b, root.backgroundTransparency)
|
Theme.surfaceContainer.b, root.backgroundTransparency)
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
|
|||||||
Reference in New Issue
Block a user