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

Compare commits

...

3 Commits

Author SHA1 Message Date
bbedward
69a5566bf9 dankbar: shrink to 0 spacing and no border when maximized surface is
present
2025-12-02 11:22:50 -05:00
Marcus Ramberg
30e5d8b855 core: fix crash on tui startup on nixos after removal of component detection (#881)
```sh
❯ dms
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xb2fbe5]

goroutine 1 [running]:
github.com/AvengeMedia/DankMaterialShell/core/internal/dms.(*Detector).GetDependencyStatus(0x0)
        github.com/AvengeMedia/DankMaterialShell/core/internal/dms/detector.go:56 +0x25
github.com/AvengeMedia/DankMaterialShell/core/internal/dms.(*Detector).GetInstalledComponents(0x421dd1?)
        github.com/AvengeMedia/DankMaterialShell/core/internal/dms/detector.go:120 +0x1f
github.com/AvengeMedia/DankMaterialShell/core/internal/dms.NewModel({_, _})
        github.com/AvengeMedia/DankMaterialShell/core/internal/dms/app.go:108 +0x67
main.runInteractiveMode(0xc0001e3000?, {0xdabb80?, 0x4?, 0xdabae0?})
        github.com/AvengeMedia/DankMaterialShell/core/cmd/dms/commands_root.go:85 +0x85
github.com/spf13/cobra.(*Command).execute(0x1549460, {0xc0000360d0, 0x0, 0x0})
        github.com/spf13/cobra@v1.10.1/command.go:1019 +0xae7
github.com/spf13/cobra.(*Command).ExecuteC(0x1549460)
        github.com/spf13/cobra@v1.10.1/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.10.1/command.go:1071
main.main()
        github.com/AvengeMedia/DankMaterialShell/core/cmd/dms/main.go:41 +0x6a
```
2025-12-02 09:26:06 -05:00
Marcus Ramberg
67ff7726e0 make pre-commit more portable (#880) 2025-12-02 09:25:08 -05:00
5 changed files with 115 additions and 61 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -12,42 +12,42 @@ cd "$REPO_ROOT"
STAGED_CORE_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep '^core/' || true) STAGED_CORE_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep '^core/' || true)
if [[ -n "$STAGED_CORE_FILES" ]]; then if [[ -n "$STAGED_CORE_FILES" ]]; then
echo "Go files staged in core/, running CI checks..." echo "Go files staged in core/, running CI checks..."
cd "$REPO_ROOT/core" cd "$REPO_ROOT/core"
# Format check # Format check
echo " Checking gofmt..." echo " Checking gofmt..."
UNFORMATTED=$(gofmt -s -l . 2>/dev/null || true) UNFORMATTED=$(gofmt -s -l . 2>/dev/null || true)
if [[ -n "$UNFORMATTED" ]]; then if [[ -n "$UNFORMATTED" ]]; then
echo "The following files are not formatted:" echo "The following files are not formatted:"
echo "$UNFORMATTED" echo "$UNFORMATTED"
echo "" echo ""
echo "Run: cd core && gofmt -s -w ." echo "Run: cd core && gofmt -s -w ."
exit 1 exit 1
fi fi
# golangci-lint # golangci-lint
if command -v golangci-lint &>/dev/null; then if command -v golangci-lint &>/dev/null; then
echo " Running golangci-lint..." echo " Running golangci-lint..."
golangci-lint run ./... golangci-lint run ./...
else else
echo " Warning: golangci-lint not installed, skipping lint" echo " Warning: golangci-lint not installed, skipping lint"
echo " Install: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" echo " Install: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"
fi fi
# Tests # Tests
echo " Running tests..." echo " Running tests..."
go test ./... > /dev/null go test ./... >/dev/null
# Build checks # Build checks
echo " Building..." echo " Building..."
mkdir -p bin mkdir -p bin
go build -buildvcs=false -o bin/dms ./cmd/dms go build -buildvcs=false -o bin/dms ./cmd/dms
go build -buildvcs=false -o bin/dms-distro -tags distro_binary ./cmd/dms go build -buildvcs=false -o bin/dms-distro -tags distro_binary ./cmd/dms
go build -buildvcs=false -o bin/dankinstall ./cmd/dankinstall go build -buildvcs=false -o bin/dankinstall ./cmd/dankinstall
echo "All Go CI checks passed!" echo "All Go CI checks passed!"
cd "$REPO_ROOT" cd "$REPO_ROOT"
fi fi
# ============================================================================= # =============================================================================

View File

@@ -105,14 +105,19 @@ type MenuItem struct {
func NewModel(version string) Model { func NewModel(version string) Model {
detector, _ := NewDetector() detector, _ := NewDetector()
dependencies := detector.GetInstalledComponents() var dependencies []DependencyInfo
var hyprlandInstalled, niriInstalled bool
var err error
if detector != nil {
dependencies = detector.GetInstalledComponents()
// Use the proper detection method for both window managers // Use the proper detection method for both window managers
hyprlandInstalled, niriInstalled, err := detector.GetWindowManagerStatus() hyprlandInstalled, niriInstalled, err = detector.GetWindowManagerStatus()
if err != nil { if err != nil {
// Fallback to false if detection fails // Fallback to false if detection fails
hyprlandInstalled = false hyprlandInstalled = false
niriInstalled = false niriInstalled = false
}
} }
updateToggles := make(map[string]bool) updateToggles := make(map[string]bool)

View File

@@ -109,6 +109,9 @@ func (m Model) renderAboutView() string {
b.WriteString(normalStyle.Render("Components:")) b.WriteString(normalStyle.Render("Components:"))
b.WriteString("\n") b.WriteString("\n")
if len(m.dependencies) == 0 {
b.WriteString(normalStyle.Render("\n Component detection not supported on this platform."))
}
for _, dep := range m.dependencies { for _, dep := range m.dependencies {
status := "✗" status := "✗"
if dep.Status == 1 { if dep.Status == 1 {

View File

@@ -1,6 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Shapes import QtQuick.Shapes
import qs.Common import qs.Common
import qs.Services
Item { Item {
id: root id: root
@@ -13,7 +14,7 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
readonly property bool gothEnabled: barConfig?.gothCornersEnabled ?? false readonly property bool gothEnabled: (barConfig?.gothCornersEnabled ?? false) && !barWindow.hasMaximizedToplevel
anchors.leftMargin: -(gothEnabled && axis.isVertical && axis.edge === "right" ? barWindow._wingR : 0) anchors.leftMargin: -(gothEnabled && axis.isVertical && axis.edge === "right" ? barWindow._wingR : 0)
anchors.rightMargin: -(gothEnabled && axis.isVertical && axis.edge === "left" ? barWindow._wingR : 0) anchors.rightMargin: -(gothEnabled && axis.isVertical && axis.edge === "left" ? barWindow._wingR : 0)
anchors.topMargin: -(gothEnabled && !axis.isVertical && axis.edge === "bottom" ? barWindow._wingR : 0) anchors.topMargin: -(gothEnabled && !axis.isVertical && axis.edge === "bottom" ? barWindow._wingR : 0)
@@ -25,8 +26,31 @@ Item {
readonly property bool isLeft: barPos === SettingsData.Position.Left readonly property bool isLeft: barPos === SettingsData.Position.Left
readonly property bool isRight: barPos === SettingsData.Position.Right readonly property bool isRight: barPos === SettingsData.Position.Right
readonly property real wing: gothEnabled ? barWindow._wingR : 0 property real wing: gothEnabled ? barWindow._wingR : 0
readonly property real rt: (barConfig?.squareCorners ?? false) ? 0 : Theme.cornerRadius
Behavior on wing {
enabled: root.width > 0 && root.height > 0
NumberAnimation {
duration: Theme.shortDuration
easing.type: Easing.OutCubic
}
}
property real rt: {
if (barConfig?.squareCorners ?? false)
return 0;
if (barWindow.hasMaximizedToplevel)
return 0;
return Theme.cornerRadius;
}
Behavior on rt {
enabled: root.width > 0 && root.height > 0
NumberAnimation {
duration: Theme.shortDuration
easing.type: Easing.OutCubic
}
}
readonly property string mainPath: generatePathForPosition(width, height) readonly property string mainPath: generatePathForPosition(width, height)
readonly property string borderFullPath: generateBorderFullPath(width, height) readonly property string borderFullPath: generateBorderFullPath(width, height)
@@ -36,18 +60,18 @@ Item {
property bool borderEdgePathCorrectShape: false property bool borderEdgePathCorrectShape: false
onMainPathChanged: { onMainPathChanged: {
if (width > 0 && height > 0){ if (width > 0 && height > 0) {
root:mainPathCorrectShape = true; root: mainPathCorrectShape = true;
} }
} }
onBorderFullPathChanged: { onBorderFullPathChanged: {
if (width > 0 && height > 0){ if (width > 0 && height > 0) {
root:borderFullPathCorrectShape = true; root: borderFullPathCorrectShape = true;
} }
} }
onBorderEdgePathChanged: { onBorderEdgePathChanged: {
if (width > 0 && height > 0){ if (width > 0 && height > 0) {
root:borderEdgePathCorrectShape = true; root: borderEdgePathCorrectShape = true;
} }
} }
@@ -70,7 +94,6 @@ Item {
} }
} }
Loader { Loader {
id: barShape id: barShape
anchors.fill: parent anchors.fill: parent
@@ -91,13 +114,14 @@ Item {
} }
} }
Loader { Loader {
id: barBorder id: barBorder
anchors.fill: parent anchors.fill: parent
active: borderFullPathCorrectShape && borderEdgePathCorrectShape active: borderFullPathCorrectShape && borderEdgePathCorrectShape
readonly property real borderThickness: Math.max(1, barConfig?.borderThickness ?? 1) readonly property real _scale: CompositorService.getScreenScale(barWindow.screen)
readonly property real inset: showFullBorder ? Math.ceil(borderThickness / 2) : borderThickness / 2 readonly property real borderThickness: Theme.px(Math.max(1, barConfig?.borderThickness ?? 1), _scale)
readonly property real inset: borderThickness / 2
readonly property string borderColorKey: barConfig?.borderColor || "surfaceText" readonly property string borderColorKey: barConfig?.borderColor || "surfaceText"
readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary
readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0) readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0)
@@ -106,7 +130,7 @@ Item {
id: barBorderShape id: barBorderShape
anchors.fill: parent anchors.fill: parent
preferredRendererType: Shape.CurveRenderer preferredRendererType: Shape.CurveRenderer
visible: barConfig?.borderEnabled ?? false visible: (barConfig?.borderEnabled ?? false) && !barWindow.hasMaximizedToplevel
ShapePath { ShapePath {
fillColor: "transparent" fillColor: "transparent"

View File

@@ -147,6 +147,29 @@ PanelWindow {
readonly property real _dpr: CompositorService.getScreenScale(barWindow.screen) readonly property real _dpr: CompositorService.getScreenScale(barWindow.screen)
property string screenName: modelData.name property string screenName: modelData.name
readonly property bool hasMaximizedToplevel: {
if (!CompositorService.isHyprland && !CompositorService.isNiri)
return false;
const filtered = CompositorService.filterCurrentWorkspace(CompositorService.sortedToplevels, screenName);
for (let i = 0; i < filtered.length; i++) {
if (filtered[i]?.maximized)
return true;
}
return false;
}
property real effectiveSpacing: hasMaximizedToplevel ? 0 : (barConfig?.spacing ?? 4)
Behavior on effectiveSpacing {
enabled: barWindow.visible
NumberAnimation {
duration: Theme.shortDuration
easing.type: Easing.OutCubic
}
}
readonly property int notificationCount: NotificationService.notifications.length readonly property int notificationCount: NotificationService.notifications.length
readonly property real effectiveBarThickness: Math.max(barWindow.widgetThickness + (barConfig?.innerPadding ?? 4) + 4, Theme.barHeight - 4 - (8 - (barConfig?.innerPadding ?? 4))) readonly property real effectiveBarThickness: Math.max(barWindow.widgetThickness + (barConfig?.innerPadding ?? 4) + 4, Theme.barHeight - 4 - (8 - (barConfig?.innerPadding ?? 4)))
readonly property real widgetThickness: Math.max(20, 26 + (barConfig?.innerPadding ?? 4) * 0.6) readonly property real widgetThickness: Math.max(20, 26 + (barConfig?.innerPadding ?? 4) * 0.6)
@@ -247,8 +270,8 @@ PanelWindow {
} }
screen: modelData screen: modelData
implicitHeight: !isVertical ? Theme.px(effectiveBarThickness + (barConfig?.spacing ?? 4) + ((barConfig?.gothCornersEnabled ?? false) ? _wingR : 0), _dpr) : 0 implicitHeight: !isVertical ? Theme.px(effectiveBarThickness + effectiveSpacing + ((barConfig?.gothCornersEnabled ?? false) && !hasMaximizedToplevel ? _wingR : 0), _dpr) : 0
implicitWidth: isVertical ? Theme.px(effectiveBarThickness + (barConfig?.spacing ?? 4) + ((barConfig?.gothCornersEnabled ?? false) ? _wingR : 0), _dpr) : 0 implicitWidth: isVertical ? Theme.px(effectiveBarThickness + effectiveSpacing + ((barConfig?.gothCornersEnabled ?? false) && !hasMaximizedToplevel ? _wingR : 0), _dpr) : 0
color: "transparent" color: "transparent"
property var nativeInhibitor: null property var nativeInhibitor: null
@@ -359,7 +382,6 @@ PanelWindow {
target: SessionData target: SessionData
} }
readonly property int barPos: barConfig?.position ?? 0 readonly property int barPos: barConfig?.position ?? 0
anchors.top: !isVertical ? (barPos === SettingsData.Position.Top) : true anchors.top: !isVertical ? (barPos === SettingsData.Position.Top) : true
@@ -367,12 +389,12 @@ PanelWindow {
anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left) anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left)
anchors.right: !isVertical ? true : (barPos === SettingsData.Position.Right) anchors.right: !isVertical ? true : (barPos === SettingsData.Position.Right)
exclusiveZone: (!(barConfig?.visible ?? true) || topBarCore.autoHide) ? -1 : (barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4) + (barConfig?.bottomGap ?? 0)) exclusiveZone: (!(barConfig?.visible ?? true) || topBarCore.autoHide) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (barConfig?.bottomGap ?? 0))
Item { Item {
id: inputMask id: inputMask
readonly property int barThickness: Theme.px(barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4), barWindow._dpr) readonly property int barThickness: Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr)
readonly property bool inOverviewWithShow: CompositorService.isNiri && NiriService.inOverview && (barConfig?.openOnOverview ?? false) readonly property bool inOverviewWithShow: CompositorService.isNiri && NiriService.inOverview && (barConfig?.openOnOverview ?? false)
readonly property bool effectiveVisible: (barConfig?.visible ?? true) || inOverviewWithShow readonly property bool effectiveVisible: (barConfig?.visible ?? true) || inOverviewWithShow
@@ -510,8 +532,8 @@ PanelWindow {
id: topBarMouseArea id: topBarMouseArea
y: !barWindow.isVertical ? (barPos === SettingsData.Position.Bottom ? parent.height - height : 0) : 0 y: !barWindow.isVertical ? (barPos === SettingsData.Position.Bottom ? parent.height - height : 0) : 0
x: barWindow.isVertical ? (barPos === SettingsData.Position.Right ? parent.width - width : 0) : 0 x: barWindow.isVertical ? (barPos === SettingsData.Position.Right ? parent.width - width : 0) : 0
height: !barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4), barWindow._dpr) : undefined height: !barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr) : undefined
width: barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4), barWindow._dpr) : undefined width: barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr) : undefined
anchors { anchors {
left: !barWindow.isVertical ? parent.left : (barPos === SettingsData.Position.Left ? parent.left : undefined) left: !barWindow.isVertical ? parent.left : (barPos === SettingsData.Position.Left ? parent.left : undefined)
right: !barWindow.isVertical ? parent.right : (barPos === SettingsData.Position.Right ? parent.right : undefined) right: !barWindow.isVertical ? parent.right : (barPos === SettingsData.Position.Right ? parent.right : undefined)
@@ -549,7 +571,7 @@ PanelWindow {
Item { Item {
id: barUnitInset id: barUnitInset
property int spacingPx: Theme.px(barConfig?.spacing ?? 4, barWindow._dpr) property int spacingPx: Theme.px(barWindow.effectiveSpacing, barWindow._dpr)
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "left" ? spacingPx : 0) anchors.leftMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "left" ? spacingPx : 0)
anchors.rightMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "right" ? spacingPx : 0) anchors.rightMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "right" ? spacingPx : 0)