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 currentTabIndex: 0
property var tabsModel: []
Connections {
target: Settings.data.wallpaper
function onEnabledChanged() {
updateTabsModel()
}
}
Component.onCompleted: {
updateTabsModel()
}
Component {
id: generalTab
@ -102,7 +114,8 @@ NPanel {
}
// Order *DOES* matter
property var tabsModel: [{
function updateTabsModel() {
let newTabs = [{
"id": SettingsPanel.Tab.General,
"label": "General",
"icon": "tune",
@ -152,12 +165,19 @@ NPanel {
"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",
@ -167,10 +187,14 @@ NPanel {
"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++) {

View file

@ -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

View file

@ -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: {