bartab-overhaul: initial commit

This commit is contained in:
Ly-sec 2025-09-07 14:48:20 +02:00
parent 835f88d71e
commit 57448f100c
16 changed files with 905 additions and 76 deletions

View file

@ -16,6 +16,19 @@ Item {
property int sectionWidgetIndex: 0
property int sectionWidgetsCount: 0
property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) {
return widgets[sectionWidgetIndex]
}
}
return {}
}
readonly property bool userAlwaysShowPercentage: (widgetSettings.alwaysShowPercentage
!== undefined) ? widgetSettings.alwaysShowPercentage : ((Settings.data.bar.alwaysShowBatteryPercentage !== undefined) ? Settings.data.bar.alwaysShowBatteryPercentage : BarWidgetRegistry.widgetMetadata["Volume"].alwaysShowPercentage)
// Used to avoid opening the pill on Quickshell startup
property bool firstVolumeReceived: false
property int wheelAccumulator: 0
@ -54,6 +67,23 @@ Item {
}
}
Component.onCompleted: {
try {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) {
if (widgets[sectionWidgetIndex].alwaysShowPercentage === undefined
&& Settings.data.bar.alwaysShowBatteryPercentage !== undefined) {
widgets[sectionWidgetIndex].alwaysShowPercentage = Settings.data.bar.alwaysShowBatteryPercentage
}
}
}
} catch (e) {
}
}
NPill {
id: pill
@ -63,6 +93,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
tooltipText: "Volume: " + Math.round(AudioService.volume * 100)
+ "%\nLeft click for advanced settings.\nScroll up/down to change volume.\nRight click to toggle mute."