diff --git a/Components/CustomListView.qml b/Components/CustomListView.qml index ec9b9c6..0b8d618 100644 --- a/Components/CustomListView.qml +++ b/Components/CustomListView.qml @@ -6,7 +6,7 @@ ListView { property bool doneFakeFlick - interactive: !Visibilities.getForActive().isDrawing + interactive: !Visibilities.getForActive()?.isDrawing maximumFlickVelocity: 3000 rebound: Transition { diff --git a/Components/StateLayer.qml b/Components/StateLayer.qml index d3eab5b..2a5d8c8 100644 --- a/Components/StateLayer.qml +++ b/Components/StateLayer.qml @@ -52,7 +52,7 @@ MouseArea { anchors.fill: parent cursorShape: !enabled ? undefined : Qt.PointingHandCursor - enabled: parent.enabled && !Visibilities.getForActive().isDrawing + enabled: parent.enabled && !Visibilities.getForActive()?.isDrawing hoverEnabled: true Behavior on stateOpacity { diff --git a/Drawers/Interactions.qml b/Drawers/Interactions.qml index b254194..c72f55f 100644 --- a/Drawers/Interactions.qml +++ b/Drawers/Interactions.qml @@ -311,17 +311,6 @@ Item { } } - function onUtilitiesChanged() { - if (root.visibilities.utilities) { - const inUtilitiesArea = root.inBottomPanel(root.panels.utilities, root.mouseX, root.mouseY); - if (!inUtilitiesArea) { - root.utilitiesShortcutActive = true; - } - } else { - root.utilitiesShortcutActive = false; - } - } - target: root.visibilities } } diff --git a/Drawers/Regions.qml b/Drawers/Regions.qml index ff7a655..e5c3757 100644 --- a/Drawers/Regions.qml +++ b/Drawers/Regions.qml @@ -38,7 +38,6 @@ Region { R { panel: root.panels.osdWrapper width: panel.width * (1 - root.panels.osd.offsetScale) + root.borderThickness - x: root.win.width - width } R { diff --git a/Drawers/Windows.qml b/Drawers/Windows.qml index a714e67..23f9028 100644 --- a/Drawers/Windows.qml +++ b/Drawers/Windows.qml @@ -26,7 +26,7 @@ CustomWindow { if (focusGrab.active) return 0; - if (monitor?.lastIpcObject.specialWorkspace?.name || monitor?.activeWorkspace.lastIpcObject.windows > 0) + if (monitor?.lastIpcObject.specialWorkspace?.name || monitor?.activeWorkspace?.lastIpcObject.windows > 0) return 0; return 100; @@ -162,14 +162,6 @@ CustomWindow { Component.onCompleted: Visibilities.load(root.screen, this) } - IpcHandler { - function toggleLauncher(fix: string): void { - visibilities.launcher = !visibilities.launcher; - } - - target: "visibilities" - } - Binding { property: "bar" target: visibilities diff --git a/Helpers/Brightness.qml b/Helpers/Brightness.qml index f7b3a8b..83b5fae 100644 --- a/Helpers/Brightness.qml +++ b/Helpers/Brightness.qml @@ -11,8 +11,13 @@ Singleton { id: root property bool appleDisplayPresent: false + readonly property var ddcMonitorMap: { + const map = {}; + for (const m of ddcMonitors) + map[m.connector] = m; + return map; + } property list ddcMonitors: [] - property list ddcServiceMon: [] readonly property list monitors: variants.instances function decreaseBrightness(): void { @@ -56,8 +61,6 @@ Singleton { onMonitorsChanged: { ddcMonitors = []; - ddcServiceMon = []; - ddcServiceProc.running = true; ddcProc.running = true; } @@ -92,26 +95,6 @@ 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" @@ -183,16 +166,12 @@ Singleton { id: monitor 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 string busNum: ddcInfo?.busNum ?? "" + readonly property var ddcInfo: root.ddcMonitorMap[modelData.name] ?? null readonly property Process initProc: Process { stdout: StdioCollector { onStreamFinished: { - 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) { + if (monitor.isAppleDisplay) { const val = parseInt(text.trim()); monitor.brightness = val / 101; } else { @@ -203,12 +182,11 @@ 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 + readonly property bool isDdc: ddcInfo !== null required property ShellScreen modelData property real queuedBrightness: NaN readonly property Timer timer: Timer { - interval: 500 + interval: 400 onTriggered: { if (!isNaN(monitor.queuedBrightness)) { @@ -219,9 +197,7 @@ Singleton { } function initBrightness(): void { - if (isDdcService) - initProc.command = ["ddcutil-client", "-d", displayNum, "getvcp", "10"]; - else if (isAppleDisplay) + if (isAppleDisplay) initProc.command = ["asdbctl", "get"]; else if (isDdc) initProc.command = ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"]; @@ -237,28 +213,25 @@ Singleton { if (Math.round(brightness * 100) === rounded) return; - if ((isDdc || isDdcService) && timer.running) { + if (isDdc && timer.running) { queuedBrightness = value; return; } brightness = value; - if (isDdcService) - Quickshell.execDetached(["ddcutil-client", "-d", displayNum, "setvcp", "10", rounded]); - else if (isAppleDisplay) + 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 || isDdcService) + if (isDdc) timer.restart(); } Component.onCompleted: initBrightness() onBusNumChanged: initBrightness() - onDisplayNumChanged: initBrightness() } } diff --git a/Modules/Osd/Content.qml b/Modules/Osd/Content.qml index fca3fc2..01a108b 100644 --- a/Modules/Osd/Content.qml +++ b/Modules/Osd/Content.qml @@ -102,15 +102,13 @@ Item { to: 1.0 value: root.brightness - onPressedChanged: { - if (!pressed) { - if (Config.osd.allMonBrightness) { - for (const mon of Brightness.monitors) { - mon.setBrightness(value); - } - } else { - root.monitor?.setBrightness(value); + onMoved: { + if (Config.osd.allMonBrightness) { + for (const mon of Brightness.monitors) { + mon.setBrightness(value); } + } else { + root.monitor?.setBrightness(value); } } } diff --git a/Modules/Polkit/Polkit.qml b/Modules/Polkit/Polkit.qml index 9b50509..cb575e2 100644 --- a/Modules/Polkit/Polkit.qml +++ b/Modules/Polkit/Polkit.qml @@ -28,9 +28,7 @@ Scope { visible: false Connections { - target: root - - onShouldShowChanged: { + function onShouldShowChanged(): void { if (root.shouldShow) { panelWindow.visible = true; openAnim.start(); @@ -38,6 +36,8 @@ Scope { closeAnim.start(); } } + + target: root } Anim { diff --git a/Modules/Wallpaper/WallBackground.qml b/Modules/Wallpaper/WallBackground.qml index abe2c35..32c58b7 100644 --- a/Modules/Wallpaper/WallBackground.qml +++ b/Modules/Wallpaper/WallBackground.qml @@ -12,10 +12,10 @@ Item { id: root property bool completed - property real cropHeight: displayData.height ?? 1.0 - property real cropWidth: displayData.width ?? 1.0 - property real cropX: displayData.x ?? 0.0 - property real cropY: displayData.y ?? 0.0 + property real cropHeight: displayData?.height ?? 1.0 + property real cropWidth: displayData?.width ?? 1.0 + property real cropX: displayData?.x ?? 0.0 + property real cropY: displayData?.y ?? 0.0 property WallpaperImage current readonly property var displayData: Wallpapers.getCrop(screen.name) required property ShellScreen screen