mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-02 11:38:30 -04:00
c554d973ef
Fixes #2737
38 lines
860 B
QML
38 lines
860 B
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
|
|
QtObject {
|
|
id: root
|
|
|
|
property var _entries: []
|
|
readonly property bool active: _entries.length > 0
|
|
readonly property var focusWindows: _entries.map(entry => entry.focusWindow).filter(window => window)
|
|
|
|
signal closeRequested
|
|
|
|
function setActive(owner, active, focusWindow) {
|
|
if (!owner)
|
|
return;
|
|
const next = _entries.filter(entry => entry.owner !== owner);
|
|
if (active) {
|
|
next.push({
|
|
"owner": owner,
|
|
"focusWindow": focusWindow ?? null
|
|
});
|
|
}
|
|
_entries = next;
|
|
}
|
|
|
|
function unregister(owner) {
|
|
setActive(owner, false, null);
|
|
}
|
|
|
|
function closeAll() {
|
|
if (_entries.length === 0)
|
|
return;
|
|
closeRequested();
|
|
_entries = [];
|
|
}
|
|
}
|