1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

Re-add padding as option

This commit is contained in:
bbedward
2025-07-21 20:43:23 -04:00
parent c47ecf8fb0
commit 1854395a0c
4 changed files with 65 additions and 26 deletions

View File

@@ -9,7 +9,18 @@ Rectangle {
property string screenName: ""
property int currentWorkspace: getDisplayActiveWorkspace()
property var workspaceList: getDisplayWorkspaces()
property var workspaceList: {
var baseList = getDisplayWorkspaces();
return Prefs.showWorkspacePadding ? padWorkspaces(baseList) : baseList;
}
function padWorkspaces(list) {
var padded = list.slice();
while (padded.length < 3) {
padded.push(-1); // Use -1 as a placeholder
}
return padded;
}
function getDisplayWorkspaces() {
if (!NiriWorkspaceService.niriAvailable || NiriWorkspaceService.allWorkspaces.length === 0)
@@ -44,7 +55,7 @@ Rectangle {
return 1;
}
width: workspaceRow.implicitWidth + Theme.spacingL * 2
width: Prefs.showWorkspacePadding ? Math.max(120, workspaceRow.implicitWidth + Theme.spacingL * 2) : workspaceRow.implicitWidth + Theme.spacingL * 2
height: 30
radius: Theme.cornerRadiusLarge
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08)
@@ -52,7 +63,7 @@ Rectangle {
Connections {
function onAllWorkspacesChanged() {
root.workspaceList = root.getDisplayWorkspaces();
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces();
root.currentWorkspace = root.getDisplayActiveWorkspace();
}
@@ -62,7 +73,7 @@ Rectangle {
function onNiriAvailableChanged() {
if (NiriWorkspaceService.niriAvailable) {
root.workspaceList = root.getDisplayWorkspaces();
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces();
root.currentWorkspace = root.getDisplayActiveWorkspace();
}
}
@@ -70,6 +81,18 @@ Rectangle {
target: NiriWorkspaceService
}
// Force update when padding preference changes
Connections {
function onShowWorkspacePaddingChanged() {
// Force re-evaluation by updating the property
var baseList = root.getDisplayWorkspaces();
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(baseList) : baseList;
}
target: Prefs
}
Row {
id: workspaceRow
@@ -88,13 +111,13 @@ Rectangle {
width: isActive ? Theme.spacingXL + Theme.spacingM : Theme.spacingL + Theme.spacingXS
height: Theme.spacingL
radius: height / 2
color: isActive ? Theme.primary : isPlaceholder ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.12) : isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
color: isActive ? Theme.primary : isPlaceholder ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.06) : isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
hoverEnabled: !isPlaceholder
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
enabled: !isPlaceholder
onClicked: {
if (!isPlaceholder) {
@@ -113,15 +136,6 @@ Rectangle {
font.bold: isActive && !isPlaceholder
}
// If not showing index, show a subtle dot for placeholders
Rectangle {
visible: isPlaceholder && !Prefs.showWorkspaceIndex
anchors.centerIn: parent
width: Theme.spacingXS
height: Theme.spacingXS
radius: Theme.spacingXS / 2
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.18)
}
Behavior on width {
NumberAnimation {