Shell: Improved init sequence, IPC: null safety for panels toggle.

This commit is contained in:
ItsLemmy
2025-11-06 14:50:28 -05:00
parent 95d3772292
commit 0bf2564ea2
2 changed files with 54 additions and 53 deletions
+7 -7
View File
@@ -30,7 +30,7 @@ Item {
function toggle() {
root.withTargetScreen(screen => {
var settingsPanel = PanelService.getPanel("settingsPanel", screen)
settingsPanel.toggle()
settingsPanel?.toggle()
})
}
}
@@ -72,21 +72,21 @@ Item {
function toggle() {
root.withTargetScreen(screen => {
var launcherPanel = PanelService.getPanel("launcherPanel", screen)
launcherPanel.toggle()
launcherPanel?.toggle()
})
}
function clipboard() {
root.withTargetScreen(screen => {
var launcherPanel = PanelService.getPanel("launcherPanel", screen)
launcherPanel.setSearchText(">clip ")
launcherPanel.toggle()
launcherPanel?.toggle()
})
}
function calculator() {
root.withTargetScreen(screen => {
var launcherPanel = PanelService.getPanel("launcherPanel", screen)
launcherPanel.setSearchText(">calc ")
launcherPanel.toggle()
launcherPanel?.toggle()
})
}
}
@@ -176,7 +176,7 @@ Item {
function toggle() {
root.withTargetScreen(screen => {
var sessionMenuPanel = PanelService.getPanel("sessionMenuPanel", screen)
sessionMenuPanel.toggle()
sessionMenuPanel?.toggle()
})
}
@@ -194,7 +194,7 @@ Item {
// Will attempt to open the panel next to the bar button if any.
controlCenterPanel.toggle(null, "ControlCenter")
} else {
controlCenterPanel.toggle()
controlCenterPanel?.toggle()
}
})
}
@@ -207,7 +207,7 @@ Item {
if (Settings.data.wallpaper.enabled) {
root.withTargetScreen(screen => {
var wallpaperPanel = PanelService.getPanel("wallpaperPanel", screen)
wallpaperPanel.toggle()
wallpaperPanel?.toggle()
})
}
}
+47 -46
View File
@@ -99,69 +99,70 @@ ShellRoot {
}
}
// IPCService is treated as a service
// but it's actually an Item that needs to exists in the shell.
// IPCService is treated as a service but it's actually an
// Item that needs to exists in the shell.
IPCService {}
}
}
// ------------------------------
// MainScreen for each screen (manages bar + all panels)
// Wrapped in Loader to optimize memory - only loads when screen needs it
Variants {
model: Quickshell.screens
delegate: Item {
required property ShellScreen modelData
// ------------------------------
// MainScreen for each screen (manages bar + all panels)
// Wrapped in Loader to optimize memory - only loads when screen needs it
Variants {
model: Quickshell.screens
delegate: Item {
required property ShellScreen modelData
property bool shouldBeActive: {
if (!i18nLoaded || !settingsLoaded || !modelData || !modelData.name)
Logger.d("Shell", "MainScreen activated for", modelData?.name)
return true
}
property bool shouldBeActive: {
if (!modelData || !modelData.name)
Logger.d("Shell", "MainScreen activated for", modelData?.name)
return true
}
property bool windowLoaded: false
property bool windowLoaded: false
Loader {
id: windowLoader
active: parent.shouldBeActive
asynchronous: false
Loader {
id: windowLoader
active: parent.shouldBeActive
asynchronous: false
property ShellScreen loaderScreen: modelData
property ShellScreen loaderScreen: modelData
onLoaded: {
// Signal that window is loaded so exclusion zone can be created
parent.windowLoaded = true
}
onLoaded: {
// Signal that window is loaded so exclusion zone can be created
parent.windowLoaded = true
}
sourceComponent: MainScreen {
screen: windowLoader.loaderScreen
}
}
sourceComponent: MainScreen {
screen: windowLoader.loaderScreen
}
}
// BarExclusionZone - created after MainScreen has fully loaded
// Disabled when bar is hidden or not configured for this screen
Loader {
active: {
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.isVisible)
return false
// BarExclusionZone - created after MainScreen has fully loaded
// Disabled when bar is hidden or not configured for this screen
Loader {
active: {
if (!parent.windowLoaded || !parent.shouldBeActive || !BarService.isVisible)
return false
// Check if bar is configured for this screen
var monitors = Settings.data.bar.monitors || []
return monitors.length === 0 || monitors.includes(modelData?.name)
}
asynchronous: false
// Check if bar is configured for this screen
var monitors = Settings.data.bar.monitors || []
return monitors.length === 0 || monitors.includes(modelData?.name)
}
asynchronous: false
sourceComponent: BarExclusionZone {
screen: modelData
}
sourceComponent: BarExclusionZone {
screen: modelData
}
onLoaded: {
Logger.d("Shell", "BarExclusionZone created for", modelData?.name)
onLoaded: {
Logger.d("Shell", "BarExclusionZone created for", modelData?.name)
}
}
}
}
}
}
// Setup Wizard - Auto Kick start
Connections {
target: Settings
function onSettingsLoaded() {