1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

parser fix

This commit is contained in:
bbedward
2025-09-18 18:22:37 -04:00
parent bc446dabaf
commit 32f3e579e7
2 changed files with 80 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Effects import QtQuick.Effects
import QtQuick.Shapes
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Services.Mpris import Quickshell.Services.Mpris
@@ -22,6 +23,12 @@ PanelWindow {
property var modelData property var modelData
property var notepadVariants: null property var notepadVariants: null
property bool wingtipsEnabled: true
property real wingtipsRadius: 12
readonly property real _wingR: Math.max(0, Math.min(wingtipsRadius, effectiveBarHeight))
readonly property color _bgColor: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, topBarCore.backgroundTransparency)
readonly property color _tintColor: Qt.rgba(Theme.surfaceTint.r, Theme.surfaceTint.g, Theme.surfaceTint.b, 0.04)
signal colorPickerRequested() signal colorPickerRequested()
function getNotepadInstanceForScreen() { function getNotepadInstanceForScreen() {
@@ -41,7 +48,7 @@ PanelWindow {
readonly property real widgetHeight: Math.max(20, 26 + SettingsData.topBarInnerPadding * 0.6) readonly property real widgetHeight: Math.max(20, 26 + SettingsData.topBarInnerPadding * 0.6)
screen: modelData screen: modelData
implicitHeight: effectiveBarHeight + SettingsData.topBarSpacing implicitHeight: effectiveBarHeight + SettingsData.topBarSpacing + (wingtipsEnabled ? _wingR : 0)
color: "transparent" color: "transparent"
Component.onCompleted: { Component.onCompleted: {
const fonts = Qt.fontFamilies() const fonts = Qt.fontFamilies()
@@ -132,7 +139,7 @@ PanelWindow {
exclusiveZone: (!SettingsData.topBarVisible || topBarCore.autoHide) ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing + SettingsData.topBarBottomGap exclusiveZone: (!SettingsData.topBarVisible || topBarCore.autoHide) ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing + SettingsData.topBarBottomGap
mask: Region { mask: Region {
item: topBarMouseArea item: barCanvas
} }
Item { Item {
@@ -248,44 +255,80 @@ PanelWindow {
anchors.leftMargin: SettingsData.topBarSpacing anchors.leftMargin: SettingsData.topBarSpacing
anchors.rightMargin: SettingsData.topBarSpacing anchors.rightMargin: SettingsData.topBarSpacing
Rectangle { Item {
id: barBackground
anchors.fill: parent anchors.fill: parent
radius: SettingsData.topBarSquareCorners ? 0 : Theme.cornerRadius anchors.bottomMargin: -(root.wingtipsEnabled ? root._wingR : 0)
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, topBarCore.backgroundTransparency)
layer.enabled: true
Rectangle { Canvas {
id: barCanvas
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(Theme.surfaceTint.r, Theme.surfaceTint.g, Theme.surfaceTint.b, 0.04) antialiasing: true
radius: parent.radius renderTarget: Canvas.FramebufferObject
SequentialAnimation on opacity { property real mainHeight: height - (root.wingtipsEnabled ? root._wingR : 0)
running: false property real wingRadius: root.wingtipsEnabled ? root._wingR : 0
loops: Animation.Infinite property real topRadius: SettingsData.topBarSquareCorners ? 0 : Theme.cornerRadius
NumberAnimation { onPaint: {
to: 0.08 const ctx = getContext("2d")
duration: Theme.extraLongDuration const W = width, H = barCanvas.mainHeight, R = barCanvas.wingRadius, RT = barCanvas.topRadius
easing.type: Theme.standardEasing
ctx.reset()
ctx.clearRect(0, 0, W, height)
function tracePath() {
ctx.beginPath()
ctx.moveTo(RT, 0)
ctx.lineTo(W - RT, 0)
ctx.arcTo(W, 0, W, RT, RT)
ctx.lineTo(W, H)
if (R > 0) {
ctx.lineTo(W, H + R)
ctx.arc(W - R, H + R, R, 0, -Math.PI / 2, true)
ctx.lineTo(R, H)
ctx.arc(R, H + R, R, -Math.PI / 2, -Math.PI, true)
ctx.lineTo(0, H + R)
}
ctx.lineTo(0, RT)
ctx.arcTo(0, 0, RT, 0, RT)
ctx.closePath()
} }
NumberAnimation { ctx.fillStyle = root._bgColor
to: 0.02 tracePath()
duration: Theme.extraLongDuration ctx.fill()
easing.type: Theme.standardEasing
} ctx.fillStyle = root._tintColor
tracePath()
ctx.fill()
}
layer.enabled: true
layer.samples: 4
layer.effect: MultiEffect {
shadowEnabled: true
shadowHorizontalOffset: 0
shadowVerticalOffset: 4
shadowBlur: 0.5
shadowColor: Qt.rgba(0, 0, 0, 0.15)
shadowOpacity: 0.15
} }
} }
layer.effect: MultiEffect {
shadowEnabled: true
shadowHorizontalOffset: 0
shadowVerticalOffset: 4
shadowBlur: 0.5 // radius/32, adjusted for visual match
shadowColor: Qt.rgba(0, 0, 0, 0.15)
shadowOpacity: 0.15
}
} }
}
Item {
anchors.fill: parent
anchors.topMargin: SettingsData.topBarSpacing
anchors.bottomMargin: 0
anchors.leftMargin: SettingsData.topBarSpacing
anchors.rightMargin: SettingsData.topBarSpacing
Item { Item {
id: topBarContent id: topBarContent
@@ -1037,6 +1080,7 @@ PanelWindow {
} }
} }
} }
} }
} }

View File

@@ -467,29 +467,21 @@ Singleton {
Process { Process {
id: getCurrentWifiInfo id: getCurrentWifiInfo
command: root.wifiInterface ? lowPriorityCmd.concat(["nmcli", "-t", "-f", "IN-USE,SIGNAL,SSID", "device", "wifi", "list", "ifname", root.wifiInterface, "--rescan", "no"]) : [] command: root.wifiInterface ? lowPriorityCmd.concat(["nmcli", "-t", "-f", "ACTIVE,SIGNAL,SSID", "device", "wifi", "list", "ifname", root.wifiInterface, "--rescan", "no"]) : []
running: false running: false
stdout: SplitParser { stdout: SplitParser {
splitMarker: "\n" splitMarker: "\n"
onRead: line => { onRead: line => {
if (line.startsWith("*:")) { if (line.startsWith("yes:")) {
const rest = line.substring(2) const rest = line.substring(2)
const parts = root.splitNmcliFields(rest) const parts = root.splitNmcliFields(rest)
if (parts.length >= 2) { if (parts.length >= 2) {
const signal = parseInt(parts[0]) const signal = parseInt(parts[1])
console.log("Current WiFi signal strength:", signal)
root.wifiSignalStrength = isNaN(signal) ? 0 : signal root.wifiSignalStrength = isNaN(signal) ? 0 : signal
root.currentWifiSSID = parts.slice(1).join(":") root.currentWifiSSID = parts.slice(1).join(":")
} console.log("Current WiFi SSID:", root.currentWifiSSID)
return
}
if (line.startsWith("yes:")) {
const rest = line.substring(4)
const parts = root.splitNmcliFields(rest)
if (parts.length >= 2) {
root.currentWifiSSID = parts[0]
const signal = parseInt(parts[1])
root.wifiSignalStrength = isNaN(signal) ? 0 : signal
} }
return return
} }