Settings: completed migration of old settings on startup

This commit is contained in:
LemmyCook 2025-09-07 22:55:28 -04:00
parent 517c7c97d4
commit 5a1231a17e
4 changed files with 83 additions and 50 deletions

View file

@ -109,23 +109,53 @@ Singleton {
continue
}
_migrateWidget(widget)
migrateWidget(widget)
Logger.log("Settings", JSON.stringify(widget))
}
}
}
// -----------------------------------------------------
function _migrateWidget(widget) {
function migrateWidget(widget) {
Logger.log("Settings", `Migrating '${widget.id}' widget`)
switch (widget.id) {
case "ActiveWindow":
widget.showIcon = adapter.bar.showActiveWindowIcon
break
case "Battery":
widget.alwaysShowPercentage = adapter.bar.alwaysShowBatteryPercentage
break
case "Brightness":
widget.alwaysShowPercentage = BarWidgetRegistry.widgetMetadata[widget.id].alwaysShowPercentage
break
case "Clock":
widget.showDate = adapter.location.showDateWithClock
widget.use12HourClock = adapter.location.use12HourClock
widget.reverseDayMonth = adapter.location.reverseDayMonth
widget.showSeconds = BarWidgetRegistry.widgetMetadata[widget.id].showSeconds
break
case "MediaMini":
widget.showAlbumArt = adapter.audio.showMiniplayerAlbumArt
widget.showVisualizer = adapter.audio.showMiniplayerCava
widget.visualizerType = BarWidgetRegistry.widgetMetadata[widget.id].visualizerType
break
case "NotificationHistory":
widget.showUnreadBadge = BarWidgetRegistry.widgetMetadata[widget.id].showUnreadBadge
widget.hideWhenZero = BarWidgetRegistry.widgetMetadata[widget.id].hideWhenZero
break
case "SidePanelToggle":
widget.useDistroLogo = adapter.bar.useDistroLogo
break
case "SystemMonitor":
widget.showNetworkStats = adapter.bar.showNetworkStats
break
case "Volume":
widget.alwaysShowPercentage = BarWidgetRegistry.widgetMetadata[widget.id].alwaysShowPercentage
break
case "Workspace":
widget.labelMode = adapter.bar.showWorkspaceLabel
break
}
}
// -----------------------------------------------------
@ -204,13 +234,14 @@ Singleton {
// bar
property JsonObject bar: JsonObject {
property string position: "top" // "top" or "bottom"
property real backgroundOpacity: 1.0
property list<string> monitors: []
property bool showActiveWindowIcon: true // TODO: delete
property bool alwaysShowBatteryPercentage: false // TODO: delete
property bool showNetworkStats: false // TODO: delete
property real backgroundOpacity: 1.0
property bool useDistroLogo: false // TODO: delete
property string showWorkspaceLabel: "none" // TODO: delete
property list<string> monitors: []
// Widget configuration for modular bar system
property JsonObject widgets
@ -265,6 +296,7 @@ Singleton {
property JsonObject location: JsonObject {
property string name: defaultLocation
property bool useFahrenheit: false
property bool reverseDayMonth: false // TODO: delete
property bool use12HourClock: false // TODO: delete
property bool showDateWithClock: false // TODO: delete
@ -334,21 +366,21 @@ Singleton {
// audio
property JsonObject audio: JsonObject {
property bool showMiniplayerAlbumArt: false // TODO: delete
property bool showMiniplayerCava: false // TODO: delete
property string visualizerType: "linear"
property int volumeStep: 5
property int cavaFrameRate: 60
// MPRIS controls
property string visualizerType: "linear"
property list<string> mprisBlacklist: []
property string preferredPlayer: ""
property bool showMiniplayerAlbumArt: false // TODO: delete
property bool showMiniplayerCava: false // TODO: delete
}
// ui
property JsonObject ui: JsonObject {
property string fontDefault: "Roboto" // Default font for all text
property string fontFixed: "DejaVu Sans Mono" // Fixed width font for terminal
property string fontBillboard: "Inter" // Large bold font for clocks and prominent displays
property string fontDefault: "Roboto"
property string fontFixed: "DejaVu Sans Mono"
property string fontBillboard: "Inter"
property list<var> monitorsScaling: []
property bool idleInhibitorEnabled: false
}

View file

@ -12,11 +12,6 @@ RowLayout {
id: root
property ShellScreen screen
property real scaling: 1.0
readonly property real minWidth: 160
readonly property real maxWidth: 400
Layout.alignment: Qt.AlignVCenter
spacing: Style.marginS * scaling
visible: getTitle() !== ""
// Widget properties passed from Bar.qml for per-instance settings
property string widgetId: ""
@ -38,6 +33,12 @@ RowLayout {
readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : widgetMetadata.showIcon
readonly property real minWidth: 160
readonly property real maxWidth: 400
Layout.alignment: Qt.AlignVCenter
spacing: Style.marginS * scaling
visible: getTitle() !== ""
function getTitle() {
return CompositorService.focusedWindowTitle !== "(No active window)" ? CompositorService.focusedWindowTitle : ""
}

View file

@ -29,7 +29,7 @@ ColumnLayout {
}
NCheckbox {
label: "Show date next to time"
label: "Show date"
checked: valueShowDate
onToggled: checked => valueShowDate = checked
}

View file

@ -38,17 +38,6 @@ Singleton {
})
property var widgetMetadata: ({
"CustomButton": {
"allowUserSettings": true,
"icon": "favorite",
"leftClickExec": "",
"rightClickExec": "",
"middleClickExec": ""
},
"Spacer": {
"allowUserSettings": true,
"width": 20
},
"ActiveWindow": {
"allowUserSettings": true,
"showIcon": true
@ -58,6 +47,37 @@ Singleton {
"alwaysShowPercentage": false,
"warningThreshold": 30
},
"Brightness": {
"allowUserSettings": true,
"alwaysShowPercentage": false
},
"Clock": {
"allowUserSettings": true,
"showDate": false,
"use12HourClock": false,
"showSeconds": false,
"reverseDayMonth": true
},
"CustomButton": {
"allowUserSettings": true,
"icon": "favorite",
"leftClickExec": "",
"rightClickExec": "",
"middleClickExec": ""
},
"Microphone": {
"allowUserSettings": true,
"alwaysShowPercentage": false
},
"NotificationHistory": {
"allowUserSettings": true,
"showUnreadBadge": true,
"hideWhenZero": false
},
"Spacer": {
"allowUserSettings": true,
"width": 20
},
"SystemMonitor": {
"allowUserSettings": true,
"showCpuUsage": true,
@ -75,33 +95,13 @@ Singleton {
"showVisualizer": false,
"visualizerType": "linear"
},
"Clock": {
"allowUserSettings": true,
"showDate": false,
"use12HourClock": false,
"showSeconds": false,
"reverseDayMonth": true
},
"Volume": {
"allowUserSettings": true,
"alwaysShowPercentage": false
},
"Microphone": {
"allowUserSettings": true,
"alwaysShowPercentage": false
},
"Brightness": {
"allowUserSettings": true,
"alwaysShowPercentage": false
},
"SidePanelToggle": {
"allowUserSettings": true,
"useDistroLogo": false
},
"NotificationHistory": {
"Volume": {
"allowUserSettings": true,
"showUnreadBadge": true,
"hideWhenZero": false
"alwaysShowPercentage": false
}
})