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;
}
// 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()
}

View file

@ -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)

View file

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

View file

@ -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;

View file

@ -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 {

View file

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

View file

@ -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
}
}

View file

@ -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