1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 15:32:50 -05:00

dankbar: support multiple bars and per-display bars

- Migrate settings to v2
  - Up to 4 bars
  - Per-bar settings instead of global
This commit is contained in:
bbedward
2025-11-22 15:28:06 -05:00
parent 4f32376f22
commit a3a27e07fa
69 changed files with 5567 additions and 3846 deletions

View File

@@ -1,5 +1,4 @@
import QtQuick
import Quickshell.Services.Mpris
import qs.Services
Loader {
@@ -15,6 +14,8 @@ Loader {
property var parentScreen: null
property real widgetThickness: 30
property real barThickness: 48
property real barSpacing: 4
property var barConfig: null
property bool isFirst: false
property bool isLast: false
property real sectionSpacing: 0
@@ -27,9 +28,7 @@ Loader {
readonly property bool orientationMatches: (axis?.isVertical ?? false) === isInColumn
active: orientationMatches &&
getWidgetVisible(widgetId, DgopService.dgopAvailable) &&
(widgetId !== "music" || MprisController.activePlayer !== null)
active: orientationMatches && getWidgetVisible(widgetId, DgopService.dgopAvailable) && (widgetId !== "music" || MprisController.activePlayer !== null)
sourceComponent: getWidgetComponent(widgetId, components)
opacity: getWidgetEnabled(widgetData?.enabled) ? 1 : 0
@@ -67,6 +66,22 @@ Loader {
restoreMode: Binding.RestoreNone
}
Binding {
target: root.item
when: root.item && "barSpacing" in root.item
property: "barSpacing"
value: root.barSpacing
restoreMode: Binding.RestoreNone
}
Binding {
target: root.item
when: root.item && "barConfig" in root.item
property: "barConfig"
value: root.barConfig
restoreMode: Binding.RestoreNone
}
Binding {
target: root.item
when: root.item && "axis" in root.item
@@ -141,33 +156,32 @@ Loader {
onLoaded: {
if (item) {
contentItemReady(item)
contentItemReady(item);
if (axis && "isVertical" in item) {
try {
item.isVertical = axis.isVertical
} catch (e) {
}
item.isVertical = axis.isVertical;
} catch (e) {}
}
if (item.pluginService !== undefined) {
var parts = widgetId.split(":")
var pluginId = parts[0]
var variantId = parts.length > 1 ? parts[1] : null
var parts = widgetId.split(":");
var pluginId = parts[0];
var variantId = parts.length > 1 ? parts[1] : null;
if (item.pluginId !== undefined) {
item.pluginId = pluginId
item.pluginId = pluginId;
}
if (item.variantId !== undefined) {
item.variantId = variantId
item.variantId = variantId;
}
if (item.variantData !== undefined && variantId) {
item.variantData = PluginService.getPluginVariantData(pluginId, variantId)
item.variantData = PluginService.getPluginVariantData(pluginId, variantId);
}
item.pluginService = PluginService
item.pluginService = PluginService;
}
if (item.popoutService !== undefined) {
item.popoutService = PopoutService
item.popoutService = PopoutService;
}
}
}
@@ -203,17 +217,17 @@ Loader {
"colorPicker": components.colorPickerComponent,
"systemUpdate": components.systemUpdateComponent,
"layout": components.layoutComponent
}
};
if (componentMap[widgetId]) {
return componentMap[widgetId]
return componentMap[widgetId];
}
var parts = widgetId.split(":")
var pluginId = parts[0]
var parts = widgetId.split(":");
var pluginId = parts[0];
let pluginMap = PluginService.getWidgetComponents()
return pluginMap[pluginId] || null
let pluginMap = PluginService.getWidgetComponents();
return pluginMap[pluginId] || null;
}
function getWidgetVisible(widgetId, dgopAvailable) {
@@ -224,12 +238,12 @@ Loader {
"gpuTemp": dgopAvailable,
"network_speed_monitor": dgopAvailable,
"layout": CompositorService.isDwl && DwlService.dwlAvailable
}
};
return widgetVisibility[widgetId] ?? true
return widgetVisibility[widgetId] ?? true;
}
function getWidgetEnabled(enabled) {
return enabled !== false
return enabled !== false;
}
}