Bar Widgets FrontEnd: Simplified access to editable widget settings

This commit is contained in:
LemmyCook 2025-09-07 22:23:45 -04:00
parent 45af873a6f
commit 517c7c97d4
17 changed files with 135 additions and 105 deletions

View file

@ -12,10 +12,14 @@ Item {
property ShellScreen screen
property real scaling: 1.0
// Widget properties passed from Bar.qml for per-instance settings
property string widgetId: ""
property string barSection: ""
property int sectionWidgetIndex: 0
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) {
@ -26,8 +30,9 @@ Item {
}
return {}
}
readonly property bool userAlwaysShowPercentage: (widgetSettings.alwaysShowPercentage
!== undefined) ? widgetSettings.alwaysShowPercentage : ((Settings.data.bar.alwaysShowBatteryPercentage !== undefined) ? Settings.data.bar.alwaysShowBatteryPercentage : BarWidgetRegistry.widgetMetadata["Volume"].alwaysShowPercentage)
readonly property bool alwaysShowPercentage: (widgetSettings.alwaysShowPercentage
!== undefined) ? widgetSettings.alwaysShowPercentage : widgetMetadata.alwaysShowPercentage
// Used to avoid opening the pill on Quickshell startup
property bool firstVolumeReceived: false
@ -76,7 +81,7 @@ Item {
collapsedIconColor: Color.mOnSurface
autoHide: false // Important to be false so we can hover as long as we want
text: Math.floor(AudioService.volume * 100) + "%"
forceOpen: userAlwaysShowPercentage
forceOpen: alwaysShowPercentage
tooltipText: "Volume: " + Math.round(AudioService.volume * 100)
+ "%\nLeft click for advanced settings.\nScroll up/down to change volume.\nRight click to toggle mute."