50 lines
1.2 KiB
QML
50 lines
1.2 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import "." as M
|
|
import "../services" as S
|
|
import "../applets" as C
|
|
|
|
M.BarModule {
|
|
id: root
|
|
spacing: S.Theme.moduleSpacing
|
|
opacity: S.Modules.backlight.enable && S.BacklightService.available ? 1 : 0
|
|
visible: opacity > 0
|
|
tooltip: "Brightness: " + percent + "%"
|
|
panelNamespace: "nova-backlight"
|
|
panelTitle: "Brightness"
|
|
panelContentWidth: 200
|
|
panelComponent: Component {
|
|
C.BacklightApplet {
|
|
width: parent.width
|
|
percent: root.percent
|
|
accentColor: root.accentColor
|
|
onSetPercent: pct => S.BacklightService.setPercent(pct)
|
|
}
|
|
}
|
|
|
|
property int percent: S.BacklightService.percent
|
|
property bool _percentInit: false
|
|
|
|
onPercentChanged: {
|
|
if (!_percentInit) {
|
|
_percentInit = true;
|
|
return;
|
|
}
|
|
if (percent > 0)
|
|
flashPanel();
|
|
}
|
|
|
|
WheelHandler {
|
|
onWheel: event => S.BacklightService.adjust(event.angleDelta.y)
|
|
}
|
|
|
|
M.BarIcon {
|
|
icon: "\uF185"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
M.BarLabel {
|
|
label: root.percent + "%"
|
|
minText: "100%"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
}
|