Notch mode gets two more module lists, notch.innerLeft and notch.innerRight: spots right beside the notch at the same distance on both sides. They follow the notch's edges as it springs wider for media, never draw pills (plugins and the tray drop theirs there), and fade out while the notch is open or widened. Picking a module for one of the four side spots in Settings -> Notch moves it there from the others. Caffeine and Night Light are now bar modules too; Night Light polls its state every 30 s while only the bar watches it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.6 KiB
QML
50 lines
1.6 KiB
QML
import QtQuick
|
|
import "../core"
|
|
import "../theme"
|
|
// A bar module that is one glyph switching something on and off (Caffeine,
|
|
// Night Light). Lit in the accent colour while on. `bare` (the spots beside
|
|
// the notch) drops the pill and keeps only a soft hover circle.
|
|
Item {
|
|
id: root
|
|
property string glyph
|
|
property bool on: false
|
|
property bool bare: false
|
|
property string tip: ""
|
|
signal clicked
|
|
implicitWidth: ModuleRegistry.pillHeight
|
|
implicitHeight: ModuleRegistry.pillHeight
|
|
opacity: enabled ? 1 : 0.45
|
|
GlassPill {
|
|
anchors.fill: parent
|
|
visible: !root.bare
|
|
}
|
|
Rectangle {
|
|
anchors.centerIn: parent
|
|
width: parent.height - 6
|
|
height: width
|
|
radius: width / 2
|
|
color: root.on ? Qt.alpha(Theme.accent, 0.16) : Theme.hover
|
|
opacity: area.containsMouse || root.on ? 1 : 0
|
|
Behavior on opacity { NumberAnimation { duration: Theme.duration / 2 } }
|
|
}
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: root.glyph
|
|
color: root.on ? Theme.accent : Theme.text
|
|
font.pixelSize: Math.round(root.height * 0.46)
|
|
Behavior on color { ColorAnimation { duration: Theme.duration } }
|
|
}
|
|
scale: area.pressed ? 1 - 0.06 * Theme.intensity : 1
|
|
Behavior on scale { NumberAnimation { duration: Theme.duration / 2; easing.type: Easing.OutCubic } }
|
|
MouseArea {
|
|
id: area
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: root.clicked()
|
|
}
|
|
Accessible.role: Accessible.CheckBox
|
|
Accessible.name: root.tip
|
|
Accessible.checked: root.on
|
|
}
|