mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 04:09:15 -04:00
d08c7c5e55
- share modal and launcher ownership handling - recover missing background and blur layers
42 lines
1.2 KiB
QML
42 lines
1.2 KiB
QML
pragma Singleton
|
|
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell
|
|
import QtQuick
|
|
|
|
Singleton {
|
|
id: modalManager
|
|
|
|
signal closeAllModalsExcept(var excludedModal)
|
|
signal modalChanged
|
|
|
|
property var currentModalsByScreen: ({})
|
|
|
|
function openModal(modal) {
|
|
PopoutManager.screenshotActive = false;
|
|
const screenName = modal.effectiveScreen?.name ?? "unknown";
|
|
currentModalsByScreen[screenName] = modal;
|
|
modalChanged();
|
|
Qt.callLater(() => {
|
|
if (!modal.allowStacking)
|
|
closeAllModalsExcept(modal);
|
|
if (!modal.keepPopoutsOpen)
|
|
PopoutManager.closeAllPopouts();
|
|
TrayMenuManager.closeAllMenus();
|
|
});
|
|
}
|
|
|
|
function isCurrentModal(modal, screenName) {
|
|
const name = screenName || modal?.effectiveScreen?.name || "unknown";
|
|
return currentModalsByScreen[name] === modal;
|
|
}
|
|
|
|
function closeModal(modal) {
|
|
const screenName = modal.effectiveScreen?.name ?? "unknown";
|
|
if (currentModalsByScreen[screenName] === modal) {
|
|
delete currentModalsByScreen[screenName];
|
|
modalChanged();
|
|
}
|
|
}
|
|
}
|