mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
launcher v2: reset visibility on screen change
This commit is contained in:
@@ -17,6 +17,7 @@ Item {
|
|||||||
property alias spotlightContent: launcherContent
|
property alias spotlightContent: launcherContent
|
||||||
property bool openedFromOverview: false
|
property bool openedFromOverview: false
|
||||||
property bool isClosing: false
|
property bool isClosing: false
|
||||||
|
property bool _windowEnabled: true
|
||||||
|
|
||||||
readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab
|
readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab
|
||||||
readonly property var effectiveScreen: launcherWindow.screen
|
readonly property var effectiveScreen: launcherWindow.screen
|
||||||
@@ -197,27 +198,41 @@ Item {
|
|||||||
Connections {
|
Connections {
|
||||||
target: Quickshell
|
target: Quickshell
|
||||||
function onScreensChanged() {
|
function onScreensChanged() {
|
||||||
if (!launcherWindow.screen)
|
if (Quickshell.screens.length === 0)
|
||||||
return;
|
return;
|
||||||
const currentScreenName = launcherWindow.screen.name;
|
|
||||||
let screenStillExists = false;
|
const screen = launcherWindow.screen;
|
||||||
for (let i = 0; i < Quickshell.screens.length; i++) {
|
const screenName = screen?.name;
|
||||||
if (Quickshell.screens[i].name === currentScreenName) {
|
|
||||||
screenStillExists = true;
|
let needsReset = !screen || !screenName;
|
||||||
break;
|
if (!needsReset) {
|
||||||
|
needsReset = true;
|
||||||
|
for (let i = 0; i < Quickshell.screens.length; i++) {
|
||||||
|
if (Quickshell.screens[i].name === screenName) {
|
||||||
|
needsReset = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (screenStillExists)
|
|
||||||
|
if (!needsReset)
|
||||||
return;
|
return;
|
||||||
const newScreen = CompositorService.getFocusedScreen();
|
|
||||||
if (newScreen)
|
const newScreen = CompositorService.getFocusedScreen() ?? Quickshell.screens[0];
|
||||||
launcherWindow.screen = newScreen;
|
if (!newScreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
root._windowEnabled = false;
|
||||||
|
launcherWindow.screen = newScreen;
|
||||||
|
Qt.callLater(() => {
|
||||||
|
root._windowEnabled = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: launcherWindow
|
id: launcherWindow
|
||||||
visible: true
|
visible: root._windowEnabled
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user