diff --git a/Components/CustomText.qml b/Components/CustomText.qml index 74347fa..cff8b2d 100644 --- a/Components/CustomText.qml +++ b/Components/CustomText.qml @@ -14,7 +14,7 @@ Text { color: DynamicColors.palette.m3onSurface font.family: Appearance.font.family.sans - font.pointSize: 12 + font.pointSize: Appearance.font.size.normal renderType: Text.NativeRendering textFormat: Text.PlainText diff --git a/Config/Config.qml b/Config/Config.qml index 6638e4e..d5cf35e 100644 --- a/Config/Config.qml +++ b/Config/Config.qml @@ -236,6 +236,7 @@ Singleton { return { weatherLocation: services.weatherLocation, useFahrenheit: services.useFahrenheit, + ddcutilService: services.ddcutilService, useTwelveHourClock: services.useTwelveHourClock, gpuType: services.gpuType, audioIncrement: services.audioIncrement, diff --git a/Config/Services.qml b/Config/Services.qml index 2daf398..e091fa2 100644 --- a/Config/Services.qml +++ b/Config/Services.qml @@ -4,6 +4,7 @@ import QtQuick JsonObject { property real audioIncrement: 0.1 property real brightnessIncrement: 0.1 + property bool ddcutilService: false property string defaultPlayer: "Spotify" property string gpuType: "" property real maxVolume: 1.0 diff --git a/Drawers/Backgrounds.qml b/Drawers/Backgrounds.qml index 7fb4578..352b753 100644 --- a/Drawers/Backgrounds.qml +++ b/Drawers/Backgrounds.qml @@ -1,6 +1,8 @@ import Quickshell import QtQuick import QtQuick.Shapes +import qs.Components +import qs.Config import qs.Modules as Modules import qs.Modules.Notifications as Notifications import qs.Modules.Notifications.Sidebar as Sidebar @@ -20,9 +22,14 @@ Shape { anchors.fill: parent // anchors.margins: 8 - anchors.topMargin: bar.implicitHeight + anchors.topMargin: Config.barConfig.autoHide && !visibilities.bar ? 0 : bar.implicitHeight preferredRendererType: Shape.CurveRenderer + Behavior on anchors.topMargin { + Anim { + } + } + Osd.Background { startX: root.width - root.panels.sidebar.width startY: (root.height - wrapper.height) / 2 - rounding diff --git a/Helpers/Brightness.qml b/Helpers/Brightness.qml index b1e1e15..5e2e7fb 100644 --- a/Helpers/Brightness.qml +++ b/Helpers/Brightness.qml @@ -12,6 +12,7 @@ Singleton { property bool appleDisplayPresent: false property list ddcMonitors: [] + property list ddcServiceMon: [] readonly property list monitors: variants.instances function decreaseBrightness(): void { @@ -55,6 +56,8 @@ Singleton { onMonitorsChanged: { ddcMonitors = []; + ddcServiceMon = []; + ddcServiceProc.running = true; ddcProc.running = true; } @@ -68,7 +71,7 @@ Singleton { } Process { - command: ["sh", "-c", "asdbctl get"] // To avoid warnings if asdbctl is not installed + command: ["sh", "-c", "asdbctl get"] running: true stdout: StdioCollector { @@ -89,6 +92,26 @@ Singleton { } } + Process { + id: ddcServiceProc + + command: ["ddcutil-client", "detect"] + + // running: true + + stdout: StdioCollector { + onStreamFinished: { + const t = text.replace(/\r\n/g, "\n").trim(); + + const output = ("\n" + t).split(/\n(?=display:\s*\d+\s*\n)/).filter(b => b.startsWith("display:")).map(b => ({ + display: Number(b.match(/^display:\s*(\d+)/m)?.[1] ?? -1), + name: (b.match(/^\s*product_name:\s*(.*)$/m)?.[1] ?? "").trim() + })).filter(d => d.display > 0); + root.ddcServiceMon = output; + } + } + } + CustomShortcut { description: "Increase brightness" name: "brightnessUp" @@ -161,10 +184,15 @@ Singleton { property real brightness readonly property string busNum: root.ddcMonitors.find(m => m.connector === modelData.name)?.busNum ?? "" + readonly property string displayNum: root.ddcServiceMon.find(m => m.name === modelData.model)?.display ?? "" readonly property Process initProc: Process { stdout: StdioCollector { onStreamFinished: { - if (monitor.isAppleDisplay) { + if (monitor.isDdcService) { + const output = text.split("\n").filter(o => o.startsWith("vcp_current_value:"))[0].split(":")[1]; + const val = parseInt(output.trim()); + monitor.brightness = val / 100; + } else if (monitor.isAppleDisplay) { const val = parseInt(text.trim()); monitor.brightness = val / 101; } else { @@ -176,6 +204,7 @@ Singleton { } readonly property bool isAppleDisplay: root.appleDisplayPresent && modelData.model.startsWith("StudioDisplay") readonly property bool isDdc: root.ddcMonitors.some(m => m.connector === modelData.name) + readonly property bool isDdcService: Config.services.ddcutilService required property ShellScreen modelData property real queuedBrightness: NaN readonly property Timer timer: Timer { @@ -190,7 +219,9 @@ Singleton { } function initBrightness(): void { - if (isAppleDisplay) + if (isDdcService) + initProc.command = ["ddcutil-client", "-d", displayNum, "getvcp", "10"]; + else if (isAppleDisplay) initProc.command = ["asdbctl", "get"]; else if (isDdc) initProc.command = ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"]; @@ -206,25 +237,28 @@ Singleton { if (Math.round(brightness * 100) === rounded) return; - if (isDdc && timer.running) { + if ((isDdc || isDdcService) && timer.running) { queuedBrightness = value; return; } brightness = value; - if (isAppleDisplay) + if (isDdcService) + Quickshell.execDetached(["ddcutil-client", "-d", displayNum, "setvcp", "10", rounded]); + else if (isAppleDisplay) Quickshell.execDetached(["asdbctl", "set", rounded]); else if (isDdc) Quickshell.execDetached(["ddcutil", "--disable-dynamic-sleep", "--sleep-multiplier", ".1", "--skip-ddc-checks", "-b", busNum, "setvcp", "10", rounded]); else Quickshell.execDetached(["brightnessctl", "s", `${rounded}%`]); - if (isDdc) + if (isDdc || isDdcService) timer.restart(); } Component.onCompleted: initBrightness() onBusNumChanged: initBrightness() + onDisplayNumChanged: initBrightness() } } diff --git a/Helpers/SystemInfo.qml b/Helpers/SystemInfo.qml index 750d3af..c4e3565 100644 --- a/Helpers/SystemInfo.qml +++ b/Helpers/SystemInfo.qml @@ -69,15 +69,12 @@ Singleton { onLoaded: { const up = parseInt(text().split(" ")[0] ?? 0); - const days = Math.floor(up / 86400); - const hours = Math.floor((up % 86400) / 3600); + const hours = Math.floor(up / 3600); const minutes = Math.floor((up % 3600) / 60); let str = ""; - if (days > 0) - str += `${days} day${days === 1 ? "" : "s"}`; if (hours > 0) - str += `${str ? ", " : ""}${hours} hour${hours === 1 ? "" : "s"}`; + str += `${hours} hour${hours === 1 ? "" : "s"}`; if (minutes > 0 || !str) str += `${str ? ", " : ""}${minutes} minute${minutes === 1 ? "" : "s"}`; root.uptime = str; diff --git a/Modules/AudioWidget.qml b/Modules/AudioWidget.qml index 6b56153..80efd85 100644 --- a/Modules/AudioWidget.qml +++ b/Modules/AudioWidget.qml @@ -43,6 +43,7 @@ Item { MaterialIcon { Layout.alignment: Qt.AlignVCenter + animate: true color: Audio.muted ? DynamicColors.palette.m3error : root.textColor font.pointSize: 14 text: Audio.muted ? "volume_off" : "volume_up" @@ -71,6 +72,7 @@ Item { MaterialIcon { Layout.alignment: Qt.AlignVCenter + animate: true color: (Audio.sourceMuted ?? false) ? DynamicColors.palette.m3error : root.textColor font.pointSize: 14 text: Audio.sourceMuted ? "mic_off" : "mic" diff --git a/Modules/Dashboard/Dash/User.qml b/Modules/Dashboard/Dash/User.qml index 3980721..45e8ad8 100644 --- a/Modules/Dashboard/Dash/User.qml +++ b/Modules/Dashboard/Dash/User.qml @@ -82,7 +82,7 @@ Row { colour: DynamicColors.palette.m3tertiary icon: "timer" - text: qsTr("up %1").arg(SystemInfo.uptime) + text: qsTr("%1").arg(SystemInfo.uptime) } } @@ -113,7 +113,7 @@ Row { anchors.left: icon.right anchors.leftMargin: icon.anchors.leftMargin anchors.verticalCenter: icon.verticalCenter - elide: Text.ElideRight + elide: Text.ElideNone font.pointSize: 13 text: `: ${line.text}` width: Config.dashboard.sizes.infoWidth diff --git a/plans/ideas.md b/plans/ideas.md index 085bc59..941e513 100644 --- a/plans/ideas.md +++ b/plans/ideas.md @@ -5,8 +5,6 @@ # Stupid idea's from Daivin - [ ] An on screen pencil to draw on your screen :). -- [ ] Audio module + cava / audio wave ;) ( Don't make it into minecraft blocks - but aan actual wave) -- Probably not planned - [ ] Bluetooth device battery view -- Not planned ( Don't have a bluetooth receiver ) @@ -21,3 +19,5 @@ - [x] Battery icon for Laptops. Broken? - [x] Quick toggle for BT, WiFi (modules in the tray do this too) - [x] Update module: When there is 1 package it still looks extremely off +- [x] Audio module + cava / audio wave ;) ( Don't make it into minecraft blocks + but aan actual wave) -- Probably not planned