From 77ce83462dd745926a5106ae252b4aff81d12704 Mon Sep 17 00:00:00 2001 From: Damocles Date: Sun, 12 Apr 2026 16:17:36 +0200 Subject: [PATCH] misc small todos: animations, cursors, ... --- modules/Backlight.qml | 18 ++++++++++++++++-- modules/Battery.qml | 2 ++ modules/Mpris.qml | 1 + modules/Notifications.qml | 2 ++ modules/Temperature.qml | 1 + modules/Volume.qml | 1 + modules/Weather.qml | 10 ++++------ modules/Workspaces.qml | 15 +++++++++++++++ 8 files changed, 42 insertions(+), 8 deletions(-) diff --git a/modules/Backlight.qml b/modules/Backlight.qml index 040dc5a..cd1749e 100644 --- a/modules/Backlight.qml +++ b/modules/Backlight.qml @@ -25,16 +25,30 @@ M.BarSection { adjProc.running = true; } + // Detect backlight device dynamically + property string _blDev: "" + Process { + id: detectBl + running: true + command: ["sh", "-c", "ls /sys/class/backlight/ 2>/dev/null | head -1"] + stdout: StdioCollector { + onStreamFinished: { + const dev = text.trim(); + if (dev) root._blDev = "/sys/class/backlight/" + dev; + } + } + } + FileView { id: current - path: "/sys/class/backlight/intel_backlight/brightness" + path: root._blDev ? root._blDev + "/brightness" : "" watchChanges: true onFileChanged: reload() onLoaded: root._update() } FileView { id: max - path: "/sys/class/backlight/intel_backlight/max_brightness" + path: root._blDev ? root._blDev + "/max_brightness" : "" onLoaded: root._update() } diff --git a/modules/Battery.qml b/modules/Battery.qml index 5505efa..ffd61e7 100644 --- a/modules/Battery.qml +++ b/modules/Battery.qml @@ -19,6 +19,8 @@ M.BarSection { readonly property bool charging: dev?.state === UPowerDeviceState.Charging readonly property color _stateColor: charging ? M.Theme.base0B : pct < 15 ? M.Theme.base08 : pct < 30 ? M.Theme.base09 : M.Theme.base0B + Behavior on _stateColor { ColorAnimation { duration: 300 } } + M.BarIcon { icon: { if (root.charging) diff --git a/modules/Mpris.qml b/modules/Mpris.qml index 7e573dd..333f312 100644 --- a/modules/Mpris.qml +++ b/modules/Mpris.qml @@ -35,6 +35,7 @@ M.BarSection { } TapHandler { + cursorShape: Qt.PointingHandCursor onTapped: root.player?.togglePlaying() } } diff --git a/modules/Notifications.qml b/modules/Notifications.qml index 7e3f76e..faac1d2 100644 --- a/modules/Notifications.qml +++ b/modules/Notifications.qml @@ -55,6 +55,7 @@ M.BarSection { TapHandler { acceptedButtons: Qt.LeftButton + cursorShape: Qt.PointingHandCursor onTapped: { clicker.command = ["swaync-client", "--toggle-panel", "--skip-wait"]; clicker.running = true; @@ -62,6 +63,7 @@ M.BarSection { } TapHandler { acceptedButtons: Qt.RightButton + cursorShape: Qt.PointingHandCursor onTapped: { clicker.command = ["swaync-client", "--toggle-dnd", "--skip-wait"]; clicker.running = true; diff --git a/modules/Temperature.qml b/modules/Temperature.qml index a96c57a..1269dcb 100644 --- a/modules/Temperature.qml +++ b/modules/Temperature.qml @@ -8,6 +8,7 @@ M.BarSection { tooltip: "Temperature: " + root.celsius + "\u00B0C" property int celsius: 0 + Behavior on _stateColor { ColorAnimation { duration: 300 } } readonly property color _stateColor: celsius > 80 ? M.Theme.base08 : celsius > 60 ? M.Theme.base09 : M.Theme.base0C FileView { diff --git a/modules/Volume.qml b/modules/Volume.qml index 9441b78..86c44d4 100644 --- a/modules/Volume.qml +++ b/modules/Volume.qml @@ -30,6 +30,7 @@ M.BarSection { } TapHandler { + cursorShape: Qt.PointingHandCursor onTapped: if (root.sink?.audio) root.sink.audio.muted = !root.sink.audio.muted } diff --git a/modules/Weather.qml b/modules/Weather.qml index 11b002c..0fbc987 100644 --- a/modules/Weather.qml +++ b/modules/Weather.qml @@ -17,10 +17,10 @@ M.BarSection { onStreamFinished: { try { const data = JSON.parse(text); - label.text = data.text ?? ""; + label.icon = data.text ?? ""; root.weatherTooltip = data.tooltip ?? ""; } catch (e) { - label.text = ""; + label.icon = ""; root.weatherTooltip = ""; } } @@ -33,11 +33,9 @@ M.BarSection { onTriggered: proc.running = true } - Text { + M.BarIcon { id: label - color: M.Theme.base05 - font.pixelSize: M.Theme.fontSize - font.family: M.Theme.iconFontFamily + color: M.Theme.base0C anchors.verticalCenter: parent.verticalCenter } } diff --git a/modules/Workspaces.qml b/modules/Workspaces.qml index d4ebd17..86107b4 100644 --- a/modules/Workspaces.qml +++ b/modules/Workspaces.qml @@ -70,10 +70,25 @@ Row { readonly property bool active: modelData.id === root._activeId + HoverHandler { + onHoveredChanged: { + const name = pill.modelData.name || ("Workspace " + pill.modelData.idx); + if (hovered) { + M.FlyoutState.text = name; + M.FlyoutState.itemX = pill.mapToGlobal(pill.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); + M.FlyoutState.screen = QsWindow.window?.screen ?? null; + M.FlyoutState.visible = true; + } else { + M.FlyoutState.visible = false; + } + } + } + width: 20 height: 20 radius: M.Theme.radius color: pill.active ? M.Theme.base0D : M.Theme.base02 + Behavior on color { ColorAnimation { duration: 150 } } Text { anchors.centerIn: parent