dotfiles
bugabingas dorkfiles
owned by bugabinga
brightness: solid-dark drag-to-set bar + active-preset highlight
09b9e5c6ca85dfd184d8060e5ca482360f5b1c97
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Browse filesCompare with HEAD
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changed files (1)
quickshell/nuguland/PopoutHost.qml
Modified2554 2554 property var state: brightnessService
? Util.parseJson(brightnessService.stateJson(), {
2557 + "label":
"Bright",
2558 + "role":
"ui.accent" 2563 + "label":
"Bright",
2564 + "role":
"ui.accent" 2568 + readonly property real level:
Math.max(
0,
Math.
min(
1,
Number(root.state.level
|| 0)))
2569 + function roleColor(role) {
2572 + if (role
=== "warning")
2573 + return root.theme.warning;
2574 + if (role
=== "ui.minor")
2575 + return root.theme.ui.minor;
2576 + return root.theme.ui.accent;
2578 + function applyAt(x, width) {
2579 + root.state
= Util.parseJson(root.brightnessService.setLevel(
Math.
max(
0,
Math.
min(
1, x
/ width))), root.state);
2574 2587 width:
Math.
max(
1, root.width
- 28)
2577 2590 color: root.theme
? root.theme.withAlpha(root.theme.ui.backdrop,
0.88)
: "#242424" 2579 - border.color: root.theme
? root.theme.ui.accent
: "white" 2592 + border.color: root.theme
? root.theme.withAlpha(root.theme.ui.minor,
0.45)
: "white" 2582 2595 anchors.left: parent.left
2583 2596 anchors.top: parent.top
2584 2597 anchors.bottom: parent.bottom
2585 - width: parent.width
* Math.
max(
0,
Math.
min(
1,
Number(root.state.level
|| 0)))
2586 - radius: parent.radius
2587 - color: root.theme
? root.theme.withAlpha(root.theme.ui.accent,
0.55)
: "white" 2598 + anchors.margins:
2 2599 + width:
Math.
max(
0, (parent.width
- 4)
* root.level)
2600 + radius: parent.radius
- 2 2601 + color: root.theme
? root.theme.withAlpha(root.roleColor(root.state.compact
? root.state.compact.role
: "ui.accent"),
0.6)
: "white" 2591 2605 anchors.centerIn: parent
2592 - text:
`${
Math.
round(
Number(root.state.level
|| 0)
* 100)}
%` 2606 + text:
`${
Math.
round(root.level
* 100)}
%` 2593 2607 color: root.theme
? root.theme.content.normal
: "white" 2594 2608 font.family:
"IBM Plex Mono" 2595 - font.pixelSize:
14 2609 + font.pixelSize:
15 2613 + anchors.fill: parent
2614 + onPressed: mouse
=> root.applyAt(mouse.x, width)
2615 + onPositionChanged: mouse
=> {
if (pressed) root.applyAt(mouse.x, width); }
2604 2624 model: [
0.25,
0.5,
0.75,
1]
2606 2626 delegate:
Rectangle {
2627 + required property
var modelData
2628 + readonly property bool
active:
Math.
abs(root.level
- modelData)
< 0.02 2610 - color: root.theme
? root.theme.withAlpha(root.theme.ui.minor,
0.18)
: "#333333" 2612 - border.color: root.theme
? root.theme.ui.focus
: "white" 2633 + color: root.theme
? root.theme.withAlpha(root.theme.ui.backdrop, active
? 0.82 : 0.55)
: "#333333" 2634 + border.width: active
? 2 : 1 2635 + border.color: root.theme
? (active
? root.theme.ui.accent
: root.theme.withAlpha(root.theme.ui.minor,
0.45))
: "white" 2615 2638 anchors.centerIn: parent
2616 - text:
`${
Math.
round(modelData
* 100)}
%` 2639 + text:
`${
Math.
round(parent.modelData
* 100)}
%` 2617 2640 color: root.theme
? root.theme.content.normal
: "white" 2618 2641 font.family:
"IBM Plex Sans" 2619 2642 font.pixelSize:
13 2623 2646 anchors.fill: parent
2624 - onClicked: root.brightnessService.setLevel(modelData)
2647 + onClicked: root.state
= Util.parseJson(root.brightnessService.setLevel(parent.modelData), root.state)