Wallpaper: improved over conditional wallpaper management

- hide all wallpaper settings if feature is disabled
- hide wallpaper selector if feature is disabled
- hide quick access wallpaper if feature is disabled
This commit is contained in:
LemmyCook 2025-09-01 19:58:05 -04:00
parent fac72b257c
commit cb7b1d92c6
3 changed files with 96 additions and 68 deletions

View file

@ -46,6 +46,18 @@ NPanel {
property int requestedTab: SettingsPanel.Tab.General property int requestedTab: SettingsPanel.Tab.General
property int currentTabIndex: 0 property int currentTabIndex: 0
property var tabsModel: []
Connections {
target: Settings.data.wallpaper
function onEnabledChanged() {
updateTabsModel()
}
}
Component.onCompleted: {
updateTabsModel()
}
Component { Component {
id: generalTab id: generalTab
@ -102,75 +114,87 @@ NPanel {
} }
// Order *DOES* matter // Order *DOES* matter
property var tabsModel: [{ function updateTabsModel() {
"id": SettingsPanel.Tab.General, let newTabs = [{
"label": "General", "id": SettingsPanel.Tab.General,
"icon": "tune", "label": "General",
"source": generalTab "icon": "tune",
}, { "source": generalTab
"id": SettingsPanel.Tab.Bar, }, {
"label": "Bar", "id": SettingsPanel.Tab.Bar,
"icon": "web_asset", "label": "Bar",
"source": barTab "icon": "web_asset",
}, { "source": barTab
"id": SettingsPanel.Tab.Launcher, }, {
"label": "Launcher", "id": SettingsPanel.Tab.Launcher,
"icon": "apps", "label": "Launcher",
"source": launcherTab "icon": "apps",
}, { "source": launcherTab
"id": SettingsPanel.Tab.AudioService, }, {
"label": "Audio", "id": SettingsPanel.Tab.AudioService,
"icon": "volume_up", "label": "Audio",
"source": audioTab "icon": "volume_up",
}, { "source": audioTab
"id": SettingsPanel.Tab.Display, }, {
"label": "Display", "id": SettingsPanel.Tab.Display,
"icon": "monitor", "label": "Display",
"source": displayTab "icon": "monitor",
}, { "source": displayTab
"id": SettingsPanel.Tab.Network, }, {
"label": "Network", "id": SettingsPanel.Tab.Network,
"icon": "lan", "label": "Network",
"source": networkTab "icon": "lan",
}, { "source": networkTab
"id": SettingsPanel.Tab.Brightness, }, {
"label": "Brightness", "id": SettingsPanel.Tab.Brightness,
"icon": "brightness_6", "label": "Brightness",
"source": brightnessTab "icon": "brightness_6",
}, { "source": brightnessTab
"id": SettingsPanel.Tab.TimeWeather, }, {
"label": "Time & Weather", "id": SettingsPanel.Tab.TimeWeather,
"icon": "schedule", "label": "Time & Weather",
"source": timeWeatherTab "icon": "schedule",
}, { "source": timeWeatherTab
"id": SettingsPanel.Tab.ColorScheme, }, {
"label": "Color Scheme", "id": SettingsPanel.Tab.ColorScheme,
"icon": "palette", "label": "Color Scheme",
"source": colorSchemeTab "icon": "palette",
}, { "source": colorSchemeTab
"id": SettingsPanel.Tab.Wallpaper, }, {
"label": "Wallpaper", "id": SettingsPanel.Tab.Wallpaper,
"icon": "image", "label": "Wallpaper",
"source": wallpaperTab "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
}]
// 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 // When the panel opens, choose the appropriate tab
onOpened: { onOpened: {
updateTabsModel()
var initialIndex = SettingsPanel.Tab.General var initialIndex = SettingsPanel.Tab.General
if (root.requestedTab !== null) { if (root.requestedTab !== null) {
for (var i = 0; i < root.tabsModel.length; i++) { for (var i = 0; i < root.tabsModel.length; i++) {

View file

@ -12,13 +12,14 @@ ColumnLayout {
NToggle { NToggle {
label: "Enable Wallpaper Management" 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 checked: Settings.data.wallpaper.enabled
onToggled: checked => Settings.data.wallpaper.enabled = checked onToggled: checked => Settings.data.wallpaper.enabled = checked
Layout.bottomMargin: Style.marginL * scaling
} }
ColumnLayout { ColumnLayout {
enabled: Settings.data.wallpaper.enabled visible: Settings.data.wallpaper.enabled
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
Layout.fillWidth: true Layout.fillWidth: true
NTextInput { NTextInput {
@ -77,12 +78,14 @@ ColumnLayout {
} }
NDivider { NDivider {
visible: Settings.data.wallpaper.enabled
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: Style.marginXL * scaling Layout.topMargin: Style.marginXL * scaling
Layout.bottomMargin: Style.marginXL * scaling Layout.bottomMargin: Style.marginXL * scaling
} }
ColumnLayout { ColumnLayout {
visible: Settings.data.wallpaper.enabled
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -47,6 +47,7 @@ NBox {
// Wallpaper // Wallpaper
NIconButton { NIconButton {
visible: Settings.data.wallpaper.enabled
icon: "image" icon: "image"
tooltipText: "Left click: Open wallpaper selector\nRight click: Set random wallpaper" tooltipText: "Left click: Open wallpaper selector\nRight click: Set random wallpaper"
onClicked: { onClicked: {