misc small todos: animations, cursors, ...

This commit is contained in:
Damocles 2026-04-12 16:17:36 +02:00
parent 3a8b2d5b11
commit 77ce83462d
8 changed files with 42 additions and 8 deletions

View file

@ -25,16 +25,30 @@ M.BarSection {
adjProc.running = true; 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 { FileView {
id: current id: current
path: "/sys/class/backlight/intel_backlight/brightness" path: root._blDev ? root._blDev + "/brightness" : ""
watchChanges: true watchChanges: true
onFileChanged: reload() onFileChanged: reload()
onLoaded: root._update() onLoaded: root._update()
} }
FileView { FileView {
id: max id: max
path: "/sys/class/backlight/intel_backlight/max_brightness" path: root._blDev ? root._blDev + "/max_brightness" : ""
onLoaded: root._update() onLoaded: root._update()
} }

View file

@ -19,6 +19,8 @@ M.BarSection {
readonly property bool charging: dev?.state === UPowerDeviceState.Charging 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 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 { M.BarIcon {
icon: { icon: {
if (root.charging) if (root.charging)

View file

@ -35,6 +35,7 @@ M.BarSection {
} }
TapHandler { TapHandler {
cursorShape: Qt.PointingHandCursor
onTapped: root.player?.togglePlaying() onTapped: root.player?.togglePlaying()
} }
} }

View file

@ -55,6 +55,7 @@ M.BarSection {
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onTapped: { onTapped: {
clicker.command = ["swaync-client", "--toggle-panel", "--skip-wait"]; clicker.command = ["swaync-client", "--toggle-panel", "--skip-wait"];
clicker.running = true; clicker.running = true;
@ -62,6 +63,7 @@ M.BarSection {
} }
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
cursorShape: Qt.PointingHandCursor
onTapped: { onTapped: {
clicker.command = ["swaync-client", "--toggle-dnd", "--skip-wait"]; clicker.command = ["swaync-client", "--toggle-dnd", "--skip-wait"];
clicker.running = true; clicker.running = true;

View file

@ -8,6 +8,7 @@ M.BarSection {
tooltip: "Temperature: " + root.celsius + "\u00B0C" tooltip: "Temperature: " + root.celsius + "\u00B0C"
property int celsius: 0 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 readonly property color _stateColor: celsius > 80 ? M.Theme.base08 : celsius > 60 ? M.Theme.base09 : M.Theme.base0C
FileView { FileView {

View file

@ -30,6 +30,7 @@ M.BarSection {
} }
TapHandler { TapHandler {
cursorShape: Qt.PointingHandCursor
onTapped: if (root.sink?.audio) onTapped: if (root.sink?.audio)
root.sink.audio.muted = !root.sink.audio.muted root.sink.audio.muted = !root.sink.audio.muted
} }

View file

@ -17,10 +17,10 @@ M.BarSection {
onStreamFinished: { onStreamFinished: {
try { try {
const data = JSON.parse(text); const data = JSON.parse(text);
label.text = data.text ?? ""; label.icon = data.text ?? "";
root.weatherTooltip = data.tooltip ?? ""; root.weatherTooltip = data.tooltip ?? "";
} catch (e) { } catch (e) {
label.text = ""; label.icon = "";
root.weatherTooltip = ""; root.weatherTooltip = "";
} }
} }
@ -33,11 +33,9 @@ M.BarSection {
onTriggered: proc.running = true onTriggered: proc.running = true
} }
Text { M.BarIcon {
id: label id: label
color: M.Theme.base05 color: M.Theme.base0C
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }

View file

@ -70,10 +70,25 @@ Row {
readonly property bool active: modelData.id === root._activeId 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 width: 20
height: 20 height: 20
radius: M.Theme.radius radius: M.Theme.radius
color: pill.active ? M.Theme.base0D : M.Theme.base02 color: pill.active ? M.Theme.base0D : M.Theme.base02
Behavior on color { ColorAnimation { duration: 150 } }
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent