diff --git a/Modules/SettingsPanel/SettingsPanel.qml b/Modules/SettingsPanel/SettingsPanel.qml index 896bb1f..4dfcfad 100644 --- a/Modules/SettingsPanel/SettingsPanel.qml +++ b/Modules/SettingsPanel/SettingsPanel.qml @@ -46,6 +46,18 @@ NPanel { property int requestedTab: SettingsPanel.Tab.General property int currentTabIndex: 0 + property var tabsModel: [] + + Connections { + target: Settings.data.wallpaper + function onEnabledChanged() { + updateTabsModel() + } + } + + Component.onCompleted: { + updateTabsModel() + } Component { id: generalTab @@ -102,75 +114,87 @@ NPanel { } // Order *DOES* matter - property var tabsModel: [{ - "id": SettingsPanel.Tab.General, - "label": "General", - "icon": "tune", - "source": generalTab - }, { - "id": SettingsPanel.Tab.Bar, - "label": "Bar", - "icon": "web_asset", - "source": barTab - }, { - "id": SettingsPanel.Tab.Launcher, - "label": "Launcher", - "icon": "apps", - "source": launcherTab - }, { - "id": SettingsPanel.Tab.AudioService, - "label": "Audio", - "icon": "volume_up", - "source": audioTab - }, { - "id": SettingsPanel.Tab.Display, - "label": "Display", - "icon": "monitor", - "source": displayTab - }, { - "id": SettingsPanel.Tab.Network, - "label": "Network", - "icon": "lan", - "source": networkTab - }, { - "id": SettingsPanel.Tab.Brightness, - "label": "Brightness", - "icon": "brightness_6", - "source": brightnessTab - }, { - "id": SettingsPanel.Tab.TimeWeather, - "label": "Time & Weather", - "icon": "schedule", - "source": timeWeatherTab - }, { - "id": SettingsPanel.Tab.ColorScheme, - "label": "Color Scheme", - "icon": "palette", - "source": colorSchemeTab - }, { - "id": SettingsPanel.Tab.Wallpaper, - "label": "Wallpaper", - "icon": "image", - "source": wallpaperTab - }, { - "id": SettingsPanel.Tab.WallpaperSelector, - "label": "Wallpaper Selector", - "icon": "wallpaper_slideshow", - "source": wallpaperSelectorTab - }, { - "id": SettingsPanel.Tab.ScreenRecorder, - "label": "Screen Recorder", - "icon": "videocam", - "source": screenRecorderTab - }, { - "id": SettingsPanel.Tab.About, - "label": "About", - "icon": "info", - "source": aboutTab - }] + function updateTabsModel() { + let newTabs = [{ + "id": SettingsPanel.Tab.General, + "label": "General", + "icon": "tune", + "source": generalTab + }, { + "id": SettingsPanel.Tab.Bar, + "label": "Bar", + "icon": "web_asset", + "source": barTab + }, { + "id": SettingsPanel.Tab.Launcher, + "label": "Launcher", + "icon": "apps", + "source": launcherTab + }, { + "id": SettingsPanel.Tab.AudioService, + "label": "Audio", + "icon": "volume_up", + "source": audioTab + }, { + "id": SettingsPanel.Tab.Display, + "label": "Display", + "icon": "monitor", + "source": displayTab + }, { + "id": SettingsPanel.Tab.Network, + "label": "Network", + "icon": "lan", + "source": networkTab + }, { + "id": SettingsPanel.Tab.Brightness, + "label": "Brightness", + "icon": "brightness_6", + "source": brightnessTab + }, { + "id": SettingsPanel.Tab.TimeWeather, + "label": "Time & Weather", + "icon": "schedule", + "source": timeWeatherTab + }, { + "id": SettingsPanel.Tab.ColorScheme, + "label": "Color Scheme", + "icon": "palette", + "source": colorSchemeTab + }, { + "id": SettingsPanel.Tab.Wallpaper, + "label": "Wallpaper", + "icon": "image", + "source": wallpaperTab + }] + // Only add the Wallpaper Selector tab if the feature is enabled + if (Settings.data.wallpaper.enabled) { + newTabs.push({ + "id": SettingsPanel.Tab.WallpaperSelector, + "label": "Wallpaper Selector", + "icon": "wallpaper_slideshow", + "source": wallpaperSelectorTab + }) + } + + newTabs.push({ + "id": SettingsPanel.Tab.ScreenRecorder, + "label": "Screen Recorder", + "icon": "videocam", + "source": screenRecorderTab + }, { + "id": SettingsPanel.Tab.About, + "label": "About", + "icon": "info", + "source": aboutTab + }) + + root.tabsModel = newTabs // Assign the generated list to the model + } // When the panel opens, choose the appropriate tab onOpened: { + updateTabsModel() + var initialIndex = SettingsPanel.Tab.General if (root.requestedTab !== null) { for (var i = 0; i < root.tabsModel.length; i++) { diff --git a/Modules/SettingsPanel/Tabs/WallpaperTab.qml b/Modules/SettingsPanel/Tabs/WallpaperTab.qml index 6696e8d..fcf715b 100644 --- a/Modules/SettingsPanel/Tabs/WallpaperTab.qml +++ b/Modules/SettingsPanel/Tabs/WallpaperTab.qml @@ -12,13 +12,14 @@ ColumnLayout { NToggle { label: "Enable Wallpaper Management" - description: "Let Quickshell manage your wallpaper. Disable this if you use an external wallpaper daemon like swww." + description: "Manage wallpapers with Noctalia. (Uncheck if you prefer using another application)." checked: Settings.data.wallpaper.enabled onToggled: checked => Settings.data.wallpaper.enabled = checked + Layout.bottomMargin: Style.marginL * scaling } ColumnLayout { - enabled: Settings.data.wallpaper.enabled + visible: Settings.data.wallpaper.enabled spacing: Style.marginL * scaling Layout.fillWidth: true NTextInput { @@ -77,12 +78,14 @@ ColumnLayout { } NDivider { + visible: Settings.data.wallpaper.enabled Layout.fillWidth: true Layout.topMargin: Style.marginXL * scaling Layout.bottomMargin: Style.marginXL * scaling } ColumnLayout { + visible: Settings.data.wallpaper.enabled spacing: Style.marginL * scaling Layout.fillWidth: true diff --git a/Modules/SidePanel/Cards/UtilitiesCard.qml b/Modules/SidePanel/Cards/UtilitiesCard.qml index 11ecced..6c8ce28 100644 --- a/Modules/SidePanel/Cards/UtilitiesCard.qml +++ b/Modules/SidePanel/Cards/UtilitiesCard.qml @@ -47,6 +47,7 @@ NBox { // Wallpaper NIconButton { + visible: Settings.data.wallpaper.enabled icon: "image" tooltipText: "Left click: Open wallpaper selector\nRight click: Set random wallpaper" onClicked: {