57 lines
1.4 KiB
QML
57 lines
1.4 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import "." as M
|
|
import "../services" as S
|
|
import "../applets" as C
|
|
|
|
M.OsdSection {
|
|
id: root
|
|
spacing: S.Theme.moduleSpacing
|
|
opacity: S.Modules.backlight.enable && S.BacklightService.available ? 1 : 0
|
|
visible: opacity > 0
|
|
_panelHovered: hoverPanel.panelHovered
|
|
|
|
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.HoverPanel {
|
|
id: hoverPanel
|
|
showPanel: root._showPanel
|
|
screen: QsWindow.window?.screen ?? null
|
|
anchorItem: root
|
|
accentColor: root.accentColor
|
|
panelNamespace: "nova-backlight"
|
|
panelTitle: "Brightness"
|
|
contentWidth: 200
|
|
|
|
C.BacklightApplet {
|
|
width: parent.width
|
|
percent: root.percent
|
|
accentColor: root.accentColor
|
|
onSetPercent: pct => S.BacklightService.setPercent(pct)
|
|
}
|
|
}
|
|
|
|
M.BarIcon {
|
|
icon: "\uF185"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
M.BarLabel {
|
|
label: root.percent + "%"
|
|
minText: "100%"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
}
|