extract OsdSection base component from Volume and Backlight modules

This commit is contained in:
Damocles 2026-04-23 23:29:50 +02:00
parent e50dd155fa
commit 2ec24e3075
4 changed files with 33 additions and 34 deletions

View file

@ -4,17 +4,15 @@ import "." as M
import "../services" as S
import "../applets" as C
M.BarSection {
M.OsdSection {
id: root
spacing: S.Theme.moduleSpacing
opacity: S.Modules.backlight.enable && S.BacklightService.available ? 1 : 0
visible: opacity > 0
tooltip: ""
_panelHovered: hoverPanel.panelHovered
property int percent: S.BacklightService.percent
property bool _osdActive: false
property bool _percentInit: false
readonly property bool _showPanel: root._hovered || hoverPanel.panelHovered || _osdActive
onPercentChanged: {
if (!_percentInit) {
@ -22,18 +20,7 @@ M.BarSection {
return;
}
if (percent > 0)
_flashPanel();
}
function _flashPanel() {
_osdActive = true;
_osdTimer.restart();
}
Timer {
id: _osdTimer
interval: 1500
onTriggered: root._osdActive = false
flashPanel();
}
WheelHandler {