extract OsdSection base component from Volume and Backlight modules
This commit is contained in:
parent
e50dd155fa
commit
2ec24e3075
4 changed files with 33 additions and 34 deletions
|
|
@ -5,10 +5,10 @@ import "." as M
|
|||
import "../services" as S
|
||||
import "../applets" as C
|
||||
|
||||
M.BarSection {
|
||||
M.OsdSection {
|
||||
id: root
|
||||
spacing: S.Theme.moduleSpacing
|
||||
tooltip: ""
|
||||
_panelHovered: hoverPanel.panelHovered
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [Pipewire.defaultAudioSink, ...root._streamList]
|
||||
|
|
@ -40,36 +40,22 @@ M.BarSection {
|
|||
return streams;
|
||||
}
|
||||
|
||||
property bool _osdActive: false
|
||||
property bool _volumeInit: false
|
||||
property bool _mutedInit: false
|
||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
||||
readonly property bool _showPanel: _anyHover || _osdActive
|
||||
|
||||
onVolumeChanged: {
|
||||
if (!_volumeInit) {
|
||||
_volumeInit = true;
|
||||
return;
|
||||
}
|
||||
_flashPanel();
|
||||
flashPanel();
|
||||
}
|
||||
onMutedChanged: {
|
||||
if (!_mutedInit) {
|
||||
_mutedInit = true;
|
||||
return;
|
||||
}
|
||||
_flashPanel();
|
||||
}
|
||||
|
||||
function _flashPanel() {
|
||||
_osdActive = true;
|
||||
_osdTimer.restart();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _osdTimer
|
||||
interval: 1500
|
||||
onTriggered: root._osdActive = false
|
||||
flashPanel();
|
||||
}
|
||||
|
||||
M.BarIcon {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue