bartab-overhaul: initial commit
This commit is contained in:
parent
835f88d71e
commit
57448f100c
16 changed files with 905 additions and 76 deletions
|
|
@ -188,13 +188,33 @@ NBox {
|
|||
colorBgHover: Qt.alpha(Color.mOnPrimary, Style.opacityLight)
|
||||
colorFgHover: Color.mOnPrimary
|
||||
onClicked: {
|
||||
var dialog = Qt.createComponent("BarWidgetSettingsDialog.qml").createObject(root, {
|
||||
"widgetIndex": index,
|
||||
"widgetData": modelData,
|
||||
"widgetId": modelData.id,
|
||||
"parent": Overlay.overlay
|
||||
})
|
||||
dialog.open()
|
||||
var component = Qt.createComponent(Qt.resolvedUrl("BarWidgetSettingsDialog.qml"))
|
||||
function instantiateAndOpen() {
|
||||
var dialog = component.createObject(root, {
|
||||
"widgetIndex": index,
|
||||
"widgetData": modelData,
|
||||
"widgetId": modelData.id,
|
||||
"parent": Overlay.overlay
|
||||
})
|
||||
if (dialog) {
|
||||
dialog.open()
|
||||
} else {
|
||||
Logger.error("BarSectionEditor", "Failed to create settings dialog instance")
|
||||
}
|
||||
}
|
||||
if (component.status === Component.Ready) {
|
||||
instantiateAndOpen()
|
||||
} else if (component.status === Component.Error) {
|
||||
Logger.error("BarSectionEditor", component.errorString())
|
||||
} else {
|
||||
component.statusChanged.connect(function () {
|
||||
if (component.status === Component.Ready) {
|
||||
instantiateAndOpen()
|
||||
} else if (component.status === Component.Error) {
|
||||
Logger.error("BarSectionEditor", component.errorString())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,26 @@ Popup {
|
|||
return customButtonSettings
|
||||
} else if (settingsPopup.widgetId === "Spacer") {
|
||||
return spacerSettings
|
||||
} else if (settingsPopup.widgetId === "Workspace") {
|
||||
return workspaceSettings
|
||||
} else if (settingsPopup.widgetId === "SystemMonitor") {
|
||||
return systemMonitorSettings
|
||||
} else if (settingsPopup.widgetId === "ActiveWindow") {
|
||||
return activeWindowSettings
|
||||
} else if (settingsPopup.widgetId === "MediaMini") {
|
||||
return mediaMiniSettings
|
||||
} else if (settingsPopup.widgetId === "Clock") {
|
||||
return clockSettings
|
||||
} else if (settingsPopup.widgetId === "Volume") {
|
||||
return volumeSettings
|
||||
} else if (settingsPopup.widgetId === "Microphone") {
|
||||
return microphoneSettings
|
||||
} else if (settingsPopup.widgetId === "NotificationHistory") {
|
||||
return notificationHistorySettings
|
||||
} else if (settingsPopup.widgetId === "Brightness") {
|
||||
return brightnessSettings
|
||||
} else if (settingsPopup.widgetId === "SidePanelToggle") {
|
||||
return sidePanelToggleSettings
|
||||
}
|
||||
// Add more widget settings components here as needed
|
||||
return null
|
||||
|
|
@ -104,6 +124,279 @@ Popup {
|
|||
}
|
||||
}
|
||||
|
||||
// SidePanelToggle settings component
|
||||
Component {
|
||||
id: sidePanelToggleSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueUseDistroLogo: settingsPopup.widgetData.useDistroLogo
|
||||
!== undefined ? settingsPopup.widgetData.useDistroLogo : BarWidgetRegistry.widgetMetadata["SidePanelToggle"].useDistroLogo
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.useDistroLogo = valueUseDistroLogo
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Use distro logo instead of icon"
|
||||
checked: valueUseDistroLogo
|
||||
onToggled: checked => valueUseDistroLogo = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Brightness settings component
|
||||
Component {
|
||||
id: brightnessSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: settingsPopup.widgetData.alwaysShowPercentage
|
||||
!== undefined ? settingsPopup.widgetData.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Brightness"].alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NotificationHistory settings component
|
||||
Component {
|
||||
id: notificationHistorySettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueShowUnreadBadge: settingsPopup.widgetData.showUnreadBadge
|
||||
!== undefined ? settingsPopup.widgetData.showUnreadBadge : BarWidgetRegistry.widgetMetadata["NotificationHistory"].showUnreadBadge
|
||||
property bool valueHideWhenZero: settingsPopup.widgetData.hideWhenZero
|
||||
!== undefined ? settingsPopup.widgetData.hideWhenZero : BarWidgetRegistry.widgetMetadata["NotificationHistory"].hideWhenZero
|
||||
// Stage DND locally; commit on Save
|
||||
property bool valueDoNotDisturbGlobal: Settings.data.notifications.doNotDisturb
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showUnreadBadge = valueShowUnreadBadge
|
||||
settings.hideWhenZero = valueHideWhenZero
|
||||
Settings.data.notifications.doNotDisturb = valueDoNotDisturbGlobal
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show unread badge"
|
||||
checked: valueShowUnreadBadge
|
||||
onToggled: checked => valueShowUnreadBadge = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Hide badge when zero"
|
||||
checked: valueHideWhenZero
|
||||
onToggled: checked => valueHideWhenZero = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Do Not Disturb (notifications)"
|
||||
description: "Toggle notifications 'Do Not Disturb'"
|
||||
checked: valueDoNotDisturbGlobal
|
||||
onToggled: checked => valueDoNotDisturbGlobal = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Microphone settings component
|
||||
Component {
|
||||
id: microphoneSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: settingsPopup.widgetData.alwaysShowPercentage
|
||||
!== undefined ? settingsPopup.widgetData.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Microphone"].alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Volume settings component
|
||||
Component {
|
||||
id: volumeSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: settingsPopup.widgetData.alwaysShowPercentage
|
||||
!== undefined ? settingsPopup.widgetData.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Volume"].alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clock settings component
|
||||
Component {
|
||||
id: clockSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueShowDate: settingsPopup.widgetData.showDate
|
||||
!== undefined ? settingsPopup.widgetData.showDate : BarWidgetRegistry.widgetMetadata["Clock"].showDate
|
||||
property bool valueUse12h: settingsPopup.widgetData.use12HourClock
|
||||
!== undefined ? settingsPopup.widgetData.use12HourClock : BarWidgetRegistry.widgetMetadata["Clock"].use12HourClock
|
||||
property bool valueShowSeconds: settingsPopup.widgetData.showSeconds
|
||||
!== undefined ? settingsPopup.widgetData.showSeconds : BarWidgetRegistry.widgetMetadata["Clock"].showSeconds
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showDate = valueShowDate
|
||||
settings.use12HourClock = valueUse12h
|
||||
settings.showSeconds = valueShowSeconds
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show date next to time"
|
||||
checked: valueShowDate
|
||||
onToggled: checked => valueShowDate = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Use 12-hour clock"
|
||||
checked: valueUse12h
|
||||
onToggled: checked => valueUse12h = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show seconds"
|
||||
checked: valueShowSeconds
|
||||
onToggled: checked => valueShowSeconds = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MediaMini settings component
|
||||
Component {
|
||||
id: mediaMiniSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueShowAlbumArt: settingsPopup.widgetData.showAlbumArt
|
||||
!== undefined ? settingsPopup.widgetData.showAlbumArt : BarWidgetRegistry.widgetMetadata["MediaMini"].showAlbumArt
|
||||
property bool valueShowVisualizer: settingsPopup.widgetData.showVisualizer
|
||||
!== undefined ? settingsPopup.widgetData.showVisualizer : BarWidgetRegistry.widgetMetadata["MediaMini"].showVisualizer
|
||||
property string valueVisualizerType: settingsPopup.widgetData.visualizerType
|
||||
|| BarWidgetRegistry.widgetMetadata["MediaMini"].visualizerType
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showAlbumArt = valueShowAlbumArt
|
||||
settings.showVisualizer = valueShowVisualizer
|
||||
settings.visualizerType = valueVisualizerType
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show album art"
|
||||
checked: valueShowAlbumArt
|
||||
onToggled: checked => valueShowAlbumArt = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show visualizer"
|
||||
checked: valueShowVisualizer
|
||||
onToggled: checked => valueShowVisualizer = checked
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
label: "Visualizer type"
|
||||
description: "Select the visualizer style"
|
||||
preferredWidth: 180 * scaling
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "linear"
|
||||
name: "Linear"
|
||||
}
|
||||
ListElement {
|
||||
key: "mirrored"
|
||||
name: "Mirrored"
|
||||
}
|
||||
ListElement {
|
||||
key: "wave"
|
||||
name: "Wave"
|
||||
}
|
||||
}
|
||||
currentKey: valueVisualizerType
|
||||
onSelected: key => valueVisualizerType = key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ActiveWindow settings component
|
||||
Component {
|
||||
id: activeWindowSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local, editable state
|
||||
property bool valueShowIcon: settingsPopup.widgetData.showIcon
|
||||
!== undefined ? settingsPopup.widgetData.showIcon : BarWidgetRegistry.widgetMetadata["ActiveWindow"].showIcon
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showIcon = valueShowIcon
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showIcon
|
||||
Layout.fillWidth: true
|
||||
label: "Show app icon"
|
||||
checked: valueShowIcon
|
||||
onToggled: checked => valueShowIcon = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CustomButton settings component
|
||||
Component {
|
||||
id: customButtonSettings
|
||||
|
|
@ -183,4 +476,103 @@ Popup {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace settings component
|
||||
Component {
|
||||
id: workspaceSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.labelMode = labelModeCombo.currentKey
|
||||
return settings
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
id: labelModeCombo
|
||||
Layout.fillWidth: true
|
||||
preferredWidth: 180 * scaling
|
||||
label: "Label Mode"
|
||||
description: "Choose how to label workspace pills."
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "none"
|
||||
name: "None"
|
||||
}
|
||||
ListElement {
|
||||
key: "index"
|
||||
name: "Index"
|
||||
}
|
||||
ListElement {
|
||||
key: "name"
|
||||
name: "Name"
|
||||
}
|
||||
}
|
||||
currentKey: settingsPopup.widgetData.labelMode || BarWidgetRegistry.widgetMetadata["Workspace"].labelMode
|
||||
onSelected: key => labelModeCombo.currentKey = key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SystemMonitor settings component
|
||||
Component {
|
||||
id: systemMonitorSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local, editable state for checkboxes
|
||||
property bool valueShowCpuUsage: settingsPopup.widgetData.showCpuUsage
|
||||
!== undefined ? settingsPopup.widgetData.showCpuUsage : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showCpuUsage
|
||||
property bool valueShowCpuTemp: settingsPopup.widgetData.showCpuTemp
|
||||
!== undefined ? settingsPopup.widgetData.showCpuTemp : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showCpuTemp
|
||||
property bool valueShowMemoryUsage: settingsPopup.widgetData.showMemoryUsage
|
||||
!== undefined ? settingsPopup.widgetData.showMemoryUsage : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showMemoryUsage
|
||||
property bool valueShowNetworkStats: settingsPopup.widgetData.showNetworkStats
|
||||
!== undefined ? settingsPopup.widgetData.showNetworkStats : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showNetworkStats
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showCpuUsage = valueShowCpuUsage
|
||||
settings.showCpuTemp = valueShowCpuTemp
|
||||
settings.showMemoryUsage = valueShowMemoryUsage
|
||||
settings.showNetworkStats = valueShowNetworkStats
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showCpuUsage
|
||||
Layout.fillWidth: true
|
||||
label: "CPU usage"
|
||||
checked: valueShowCpuUsage
|
||||
onToggled: checked => valueShowCpuUsage = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showCpuTemp
|
||||
Layout.fillWidth: true
|
||||
label: "CPU temperature"
|
||||
checked: valueShowCpuTemp
|
||||
onToggled: checked => valueShowCpuTemp = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showMemoryUsage
|
||||
Layout.fillWidth: true
|
||||
label: "Memory usage"
|
||||
checked: valueShowMemoryUsage
|
||||
onToggled: checked => valueShowMemoryUsage = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showNetworkStats
|
||||
Layout.fillWidth: true
|
||||
label: "Network traffic"
|
||||
checked: valueShowNetworkStats
|
||||
onToggled: checked => valueShowNetworkStats = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,56 +71,13 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Show Active Window's Icon"
|
||||
description: "Display the app icon next to the title of the currently focused window."
|
||||
checked: Settings.data.bar.showActiveWindowIcon
|
||||
onToggled: checked => Settings.data.bar.showActiveWindowIcon = checked
|
||||
}
|
||||
|
||||
// Keep Battery toggle here for now (cannot test per-widget yet)
|
||||
NToggle {
|
||||
label: "Show Battery Percentage"
|
||||
description: "Display battery percentage at all times."
|
||||
checked: Settings.data.bar.alwaysShowBatteryPercentage
|
||||
onToggled: checked => Settings.data.bar.alwaysShowBatteryPercentage = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Show Network Statistics"
|
||||
description: "Display network upload and download speeds in the system monitor."
|
||||
checked: Settings.data.bar.showNetworkStats
|
||||
onToggled: checked => Settings.data.bar.showNetworkStats = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Replace SidePanel toggle with distro logo"
|
||||
description: "Show distro logo instead of the SidePanel toggle button in the bar."
|
||||
checked: Settings.data.bar.useDistroLogo
|
||||
onToggled: checked => {
|
||||
Settings.data.bar.useDistroLogo = checked
|
||||
}
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
label: "Show Workspaces Labels"
|
||||
description: "Show the workspace name or index within the workspace indicator."
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "none"
|
||||
name: "None"
|
||||
}
|
||||
ListElement {
|
||||
key: "index"
|
||||
name: "Index"
|
||||
}
|
||||
ListElement {
|
||||
key: "name"
|
||||
name: "Name"
|
||||
}
|
||||
}
|
||||
currentKey: Settings.data.bar.showWorkspaceLabel
|
||||
onSelected: key => Settings.data.bar.showWorkspaceLabel = key
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue