mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
launcher: in overview mode, no need to check if that bar exists on the target screen
This commit is contained in:
@@ -24,6 +24,7 @@ Item {
|
||||
|
||||
// Pending callback to execute once screen is detected
|
||||
property var pendingCallback: null
|
||||
property bool pendingSkipBarCheck: false
|
||||
|
||||
// Detected screen
|
||||
property var detectedScreen: null
|
||||
@@ -70,7 +71,7 @@ Item {
|
||||
* On single-monitor setups, executes immediately.
|
||||
* On multi-monitor setups, briefly opens an invisible window to detect the screen.
|
||||
*/
|
||||
function withCurrentScreen(callback: var) {
|
||||
function withCurrentScreen(callback: var, skipBarCheck: bool) {
|
||||
if (root.pendingCallback) {
|
||||
Logger.w("CurrentScreenDetector", "Another detection is pending, ignoring new call");
|
||||
return;
|
||||
@@ -86,8 +87,8 @@ Item {
|
||||
let screen = CompositorService.getFocusedScreen();
|
||||
|
||||
if (screen) {
|
||||
// Apply the bar check if configured
|
||||
if (!Settings.data.general.allowPanelsOnScreenWithoutBar) {
|
||||
// Apply the bar check if configured (skip for overlay launcher etc.)
|
||||
if (!skipBarCheck && !Settings.data.general.allowPanelsOnScreenWithoutBar) {
|
||||
const monitors = Settings.data.bar.monitors || [];
|
||||
const hasBar = monitors.length === 0 || monitors.includes(screen.name);
|
||||
if (!hasBar) {
|
||||
@@ -102,6 +103,7 @@ Item {
|
||||
// Fallback: Multi-monitor setup needs async detection via invisible PanelWindow
|
||||
root.detectedScreen = null;
|
||||
root.pendingCallback = callback;
|
||||
root.pendingSkipBarCheck = !!skipBarCheck;
|
||||
screenDetectorLoader.active = true;
|
||||
}
|
||||
|
||||
@@ -114,7 +116,7 @@ Item {
|
||||
|
||||
// Execute pending callback if any
|
||||
if (root.pendingCallback) {
|
||||
if (!Settings.data.general.allowPanelsOnScreenWithoutBar) {
|
||||
if (!root.pendingSkipBarCheck && !Settings.data.general.allowPanelsOnScreenWithoutBar) {
|
||||
// If we explicitly disabled panels on screen without bar, check if bar is configured
|
||||
// for this screen, and fallback to primary screen if necessary
|
||||
var monitors = Settings.data.bar.monitors || [];
|
||||
@@ -129,6 +131,7 @@ Item {
|
||||
// if the callback throws an error
|
||||
var callback = root.pendingCallback;
|
||||
root.pendingCallback = null;
|
||||
root.pendingSkipBarCheck = false;
|
||||
try {
|
||||
callback(root.detectedScreen);
|
||||
} catch (e) {
|
||||
|
||||
@@ -132,7 +132,7 @@ Item {
|
||||
// In another mode -> switch to app mode
|
||||
PanelService.setLauncherSearchText(screen, "");
|
||||
}
|
||||
});
|
||||
}, Settings.data.appLauncher.overviewLayer);
|
||||
}
|
||||
function clipboard() {
|
||||
root.screenDetector.withCurrentScreen(screen => {
|
||||
@@ -148,7 +148,7 @@ Item {
|
||||
// In another mode -> switch to clipboard mode
|
||||
PanelService.setLauncherSearchText(screen, ">clip ");
|
||||
}
|
||||
});
|
||||
}, Settings.data.appLauncher.overviewLayer);
|
||||
}
|
||||
function command() {
|
||||
root.screenDetector.withCurrentScreen(screen => {
|
||||
@@ -168,7 +168,7 @@ Item {
|
||||
// In another mode -> switch to clipboard mode
|
||||
launcherPanel.setSearchText(">cmd ");
|
||||
}
|
||||
});
|
||||
}, Settings.data.appLauncher.overviewLayer);
|
||||
}
|
||||
function emoji() {
|
||||
root.screenDetector.withCurrentScreen(screen => {
|
||||
@@ -184,7 +184,7 @@ Item {
|
||||
// In another mode -> switch to emoji mode
|
||||
PanelService.setLauncherSearchText(screen, ">emoji ");
|
||||
}
|
||||
});
|
||||
}, Settings.data.appLauncher.overviewLayer);
|
||||
}
|
||||
function windows() {
|
||||
root.screenDetector.withCurrentScreen(screen => {
|
||||
@@ -204,7 +204,7 @@ Item {
|
||||
// In another mode -> switch to windows mode
|
||||
launcherPanel.setSearchText(">win ");
|
||||
}
|
||||
});
|
||||
}, Settings.data.appLauncher.overviewLayer);
|
||||
}
|
||||
function settings() {
|
||||
root.screenDetector.withCurrentScreen(screen => {
|
||||
@@ -224,7 +224,7 @@ Item {
|
||||
// In another mode -> switch to settings mode
|
||||
launcherPanel.setSearchText(">settings ");
|
||||
}
|
||||
});
|
||||
}, Settings.data.appLauncher.overviewLayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user