Tray capsule hidden if empty + formatting

This commit is contained in:
quadbyte 2025-08-19 08:01:59 -04:00
parent 1993e28c18
commit fdf475cabc
3 changed files with 14 additions and 15 deletions

View file

@ -32,17 +32,17 @@ Singleton {
// Needed to only have one NPanel loaded at a time. <--- VERY BROKEN // Needed to only have one NPanel loaded at a time. <--- VERY BROKEN
//property var openPanel: null //property var openPanel: null
// Function to validate monitor configurations // Function to validate monitor configurations
function validateMonitorConfigurations() { function validateMonitorConfigurations() {
var availableScreenNames = [] var availableScreenNames = []
for (var i = 0; i < Quickshell.screens.length; i++) { for (var i = 0; i < Quickshell.screens.length; i++) {
availableScreenNames.push(Quickshell.screens[i].name) availableScreenNames.push(Quickshell.screens[i].name)
} }
Logger.log("Settings", "Available monitors: [" + availableScreenNames.join(", ") + "]") Logger.log("Settings", "Available monitors: [" + availableScreenNames.join(", ") + "]")
Logger.log("Settings", "Configured bar monitors: [" + adapter.bar.monitors.join(", ") + "]") Logger.log("Settings", "Configured bar monitors: [" + adapter.bar.monitors.join(", ") + "]")
// Check bar monitors // Check bar monitors
if (adapter.bar.monitors.length > 0) { if (adapter.bar.monitors.length > 0) {
var hasValidBarMonitor = false var hasValidBarMonitor = false
@ -53,7 +53,8 @@ Singleton {
} }
} }
if (!hasValidBarMonitor) { if (!hasValidBarMonitor) {
Logger.log("Settings", "No configured bar monitors found on system, clearing bar monitor list to show on all screens") Logger.log("Settings",
"No configured bar monitors found on system, clearing bar monitor list to show on all screens")
adapter.bar.monitors = [] adapter.bar.monitors = []
} else { } else {
Logger.log("Settings", "Found valid bar monitors, keeping configuration") Logger.log("Settings", "Found valid bar monitors, keeping configuration")
@ -88,10 +89,10 @@ Singleton {
Logger.log("Settings", "Set current wallpaper", adapter.wallpaper.current) Logger.log("Settings", "Set current wallpaper", adapter.wallpaper.current)
WallpaperService.setCurrentWallpaper(adapter.wallpaper.current, true) WallpaperService.setCurrentWallpaper(adapter.wallpaper.current, true)
} }
// Validate monitor configurations - if none of the configured monitors exist, clear the lists // Validate monitor configurations - if none of the configured monitors exist, clear the lists
validateMonitorConfigurations() validateMonitorConfigurations()
isInitialLoad = false isInitialLoad = false
}) })
} }
@ -108,7 +109,7 @@ Singleton {
property JsonObject bar property JsonObject bar
bar: JsonObject { bar: JsonObject {
property string barPosition: "top" // Possible values: "top", "bottom", "left", "right" property string barPosition: "top" // Possible values: "top", "bottom", "left", "right"
property bool showActiveWindow: true property bool showActiveWindow: true
property bool showSystemInfo: false property bool showSystemInfo: false
property bool showMedia: false property bool showMedia: false
@ -222,7 +223,7 @@ Singleton {
property string fontFamily: "Roboto" // Family for all text property string fontFamily: "Roboto" // Family for all text
} }
// Scaling (not stored as JsonObject) // Scaling (not stored inside JsonObject, or it crashes)
property var monitorsScaling: { property var monitorsScaling: {
} }

View file

@ -43,12 +43,10 @@ NLoader {
} }
margins { margins {
top: (Settings.data.bar.monitors.includes(modelData.name) top: (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0))
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.barPosition === "top" && Settings.data.bar.barPosition === "top" ? Math.floor(Style.barHeight * scaling) : 0
? Math.floor(Style.barHeight * scaling) : 0 bottom: (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0))
bottom: (Settings.data.bar.monitors.includes(modelData.name) && Settings.data.bar.barPosition === "bottom" ? Math.floor(Style.barHeight * scaling) : 0
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.barPosition === "bottom"
? Math.floor(Style.barHeight * scaling) : 0
} }
// Source we want to show only as a ring // Source we want to show only as a ring

View file

@ -12,7 +12,7 @@ import qs.Widgets
Rectangle { Rectangle {
readonly property real itemSize: 24 * scaling readonly property real itemSize: 24 * scaling
visible: Settings.data.bar.showTray visible: Settings.data.bar.showTray && SystemTray.items.length > 0
width: tray.width + Style.marginM * scaling * 2 width: tray.width + Style.marginM * scaling * 2
height: Math.round(Style.capsuleHeight * scaling) height: Math.round(Style.capsuleHeight * scaling)