From 19be4c6bbbad0e45983c71e099d1ec0dfb44ea73 Mon Sep 17 00:00:00 2001 From: bbedward Date: Sun, 13 Jul 2025 11:48:25 -0400 Subject: [PATCH] Configurable widget displays --- Common/Prefs.qml | 59 ++++++++++++++++++++++++++++++++++++++- Widgets/SettingsPopup.qml | 53 +++++++++++++++++++++++++++++++++++ Widgets/TopBar/TopBar.qml | 9 +++++- 3 files changed, 119 insertions(+), 2 deletions(-) diff --git a/Common/Prefs.qml b/Common/Prefs.qml index 1c8ef839..44662ef4 100644 --- a/Common/Prefs.qml +++ b/Common/Prefs.qml @@ -19,6 +19,14 @@ Singleton { property bool nightModeEnabled: false property string profileImage: "" + // Widget visibility preferences for TopBar + property bool showFocusedWindow: true + property bool showWeather: true + property bool showMusic: true + property bool showClipboard: true + property bool showSystemResources: true + property bool showSystemTray: true + Component.onCompleted: loadSettings() @@ -59,6 +67,12 @@ Singleton { useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false profileImage = settings.profileImage !== undefined ? settings.profileImage : "" + showFocusedWindow = settings.showFocusedWindow !== undefined ? settings.showFocusedWindow : true + showWeather = settings.showWeather !== undefined ? settings.showWeather : true + showMusic = settings.showMusic !== undefined ? settings.showMusic : true + showClipboard = settings.showClipboard !== undefined ? settings.showClipboard : true + showSystemResources = settings.showSystemResources !== undefined ? settings.showSystemResources : true + showSystemTray = settings.showSystemTray !== undefined ? settings.showSystemTray : true console.log("Loaded settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "lightMode:", isLightMode, "transparency:", topBarTransparency, "recentApps:", recentlyUsedApps.length) applyStoredTheme() @@ -82,7 +96,13 @@ Singleton { use24HourClock, useFahrenheit, nightModeEnabled, - profileImage + profileImage, + showFocusedWindow, + showWeather, + showMusic, + showClipboard, + showSystemResources, + showSystemTray }, null, 2)) console.log("Saving settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "lightMode:", isLightMode, "transparency:", topBarTransparency, "recentApps:", recentlyUsedApps.length) } @@ -200,4 +220,41 @@ Singleton { profileImage = imageUrl saveSettings() } + + // Widget visibility setters + function setShowFocusedWindow(enabled) { + console.log("Prefs setShowFocusedWindow called - showFocusedWindow:", enabled) + showFocusedWindow = enabled + saveSettings() + } + + function setShowWeather(enabled) { + console.log("Prefs setShowWeather called - showWeather:", enabled) + showWeather = enabled + saveSettings() + } + + function setShowMusic(enabled) { + console.log("Prefs setShowMusic called - showMusic:", enabled) + showMusic = enabled + saveSettings() + } + + function setShowClipboard(enabled) { + console.log("Prefs setShowClipboard called - showClipboard:", enabled) + showClipboard = enabled + saveSettings() + } + + function setShowSystemResources(enabled) { + console.log("Prefs setShowSystemResources called - showSystemResources:", enabled) + showSystemResources = enabled + saveSettings() + } + + function setShowSystemTray(enabled) { + console.log("Prefs setShowSystemTray called - showSystemTray:", enabled) + showSystemTray = enabled + saveSettings() + } } \ No newline at end of file diff --git a/Widgets/SettingsPopup.qml b/Widgets/SettingsPopup.qml index 87394d47..f83e5eea 100644 --- a/Widgets/SettingsPopup.qml +++ b/Widgets/SettingsPopup.qml @@ -328,6 +328,59 @@ PanelWindow { } } + // Widget Visibility Settings + SettingsSection { + title: "Top Bar Widgets" + iconName: "widgets" + + content: Column { + width: parent.width + spacing: Theme.spacingM + + SettingsToggle { + text: "Focused Window" + description: "Show the currently focused application in the top bar" + checked: Prefs.showFocusedWindow + onToggled: (checked) => Prefs.setShowFocusedWindow(checked) + } + + SettingsToggle { + text: "Weather Widget" + description: "Display weather information in the top bar" + checked: Prefs.showWeather + onToggled: (checked) => Prefs.setShowWeather(checked) + } + + SettingsToggle { + text: "Media Controls" + description: "Show currently playing media in the top bar" + checked: Prefs.showMusic + onToggled: (checked) => Prefs.setShowMusic(checked) + } + + SettingsToggle { + text: "Clipboard Button" + description: "Show clipboard access button in the top bar" + checked: Prefs.showClipboard + onToggled: (checked) => Prefs.setShowClipboard(checked) + } + + SettingsToggle { + text: "System Resources" + description: "Display CPU and RAM usage indicators" + checked: Prefs.showSystemResources + onToggled: (checked) => Prefs.setShowSystemResources(checked) + } + + SettingsToggle { + text: "System Tray" + description: "Show system tray icons in the top bar" + checked: Prefs.showSystemTray + onToggled: (checked) => Prefs.setShowSystemTray(checked) + } + } + } + // Display Settings SettingsSection { title: "Display & Appearance" diff --git a/Widgets/TopBar/TopBar.qml b/Widgets/TopBar/TopBar.qml index 733c85b8..3bb05531 100644 --- a/Widgets/TopBar/TopBar.qml +++ b/Widgets/TopBar/TopBar.qml @@ -159,6 +159,7 @@ PanelWindow { FocusedAppWidget { anchors.verticalCenter: parent.verticalCenter + visible: Prefs.showFocusedWindow } } @@ -179,6 +180,7 @@ PanelWindow { anchors.rightMargin: Theme.spacingS activePlayer: topBar.activePlayer hasActiveMedia: topBar.hasActiveMedia + visible: Prefs.showMusic && topBar.hasActiveMedia onClicked: { if (topBar.shellRoot) { @@ -201,6 +203,7 @@ PanelWindow { weatherCode: topBar.weatherCode weatherTemp: topBar.weatherTemp weatherTempF: topBar.weatherTempF + visible: Prefs.showWeather onClicked: { if (topBar.shellRoot) { @@ -222,6 +225,7 @@ PanelWindow { SystemTrayWidget { anchors.verticalCenter: parent.verticalCenter + visible: Prefs.showSystemTray onMenuRequested: (menu, item, x, y) => { topBar.currentTrayMenu = menu topBar.currentTrayItem = item @@ -239,6 +243,7 @@ PanelWindow { radius: Theme.cornerRadius color: clipboardArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.08) anchors.verticalCenter: parent.verticalCenter + visible: Prefs.showClipboard Text { anchors.centerIn: parent @@ -275,10 +280,12 @@ PanelWindow { // System Monitor Widgets CpuMonitorWidget { anchors.verticalCenter: parent.verticalCenter + visible: Prefs.showSystemResources } RamMonitorWidget { - anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenter: parent.verticalCenter + visible: Prefs.showSystemResources } NotificationCenterButton {