Taskbar: Add settings.

This commit is contained in:
Leopold Luley
2025-09-29 00:59:02 +02:00
parent e6b0be77e7
commit b1f7ae5d9a
5 changed files with 79 additions and 3 deletions
@@ -133,7 +133,8 @@ Popup {
"Spacer": "WidgetSettings/SpacerSettings.qml",
"SystemMonitor": "WidgetSettings/SystemMonitorSettings.qml",
"Volume": "WidgetSettings/VolumeSettings.qml",
"Workspace": "WidgetSettings/WorkspaceSettings.qml"
"Workspace": "WidgetSettings/WorkspaceSettings.qml",
"Taskbar": "WidgetSettings/TaskbarSettings.qml"
}
const source = widgetSettingsMap[widgetId]
@@ -0,0 +1,43 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qs.Commons
import qs.Widgets
import qs.Services
ColumnLayout {
id: root
spacing: Style.marginM * scaling
// Properties to receive data from parent
property var widgetData: null
property var widgetMetadata: null
// Local state
property bool valueOnlyActiveWorkspaces: widgetData.onlyActiveWorkspaces !== undefined ? widgetData.onlyActiveWorkspaces : widgetMetadata.onlyActiveWorkspaces
property bool valueOnlySameOutput: widgetData.onlySameOutput !== undefined ? widgetData.onlySameOutput : widgetMetadata.onlySameOutput
function saveSettings() {
var settings = Object.assign({}, widgetData || {})
settings.onlySameOutput = valueOnlySameOutput
settings.onlyActiveWorkspaces = valueOnlyActiveWorkspaces
console.log(JSON.stringify(settings))
return settings
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.taskbar.only-same-output.label")
description: I18n.tr("bar.widget-settings.taskbar.only-same-output.description")
checked: root.valueOnlySameOutput
onToggled: checked => root.valueOnlySameOutput = checked
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.taskbar.only-active-workspaces.label")
description: I18n.tr("bar.widget-settings.taskbar.only-active-workspaces.description")
checked: root.valueOnlyActiveWorkspaces
onToggled: checked => root.valueOnlyActiveWorkspaces = checked
}
}