bars: update island & dbar defaults

This commit is contained in:
purian23
2026-10-13 17:31:07 -04:00
parent 12feb8068b
commit 39b41fb880
17 changed files with 82 additions and 60 deletions
+11 -4
View File
@@ -38,14 +38,16 @@ function coversScreen(config, screen, screens, displayNameMode) {
function islandMetrics(config, defaults) {
const value = key => config?.[key] ?? defaults[key];
const reserve = Math.max(24, Math.min(128, value("islandReserveThickness")));
const strip = Math.max(24, Math.min(128, value("islandReserveThickness")));
const compact = Math.max(24, Math.min(72, value("islandCompactThickness")));
const gap = value("islandNotch") ? 0 : Math.max(0, Math.min(48, value("islandOuterGap")));
const thickness = Math.max(strip, gap + compact);
// The default reservation follows the pill; any other value is reserved as set.
return {
reserve,
reserve: value("islandReserveThickness") === defaults.islandReserveThickness ? thickness : strip,
compact,
gap,
thickness: Math.max(reserve, gap + compact)
thickness
};
}
@@ -53,6 +55,10 @@ function islandThickness(config, defaults) {
return islandMetrics(config, defaults).thickness;
}
function islandReserve(config, defaults) {
return islandMetrics(config, defaults).reserve;
}
function isIsland(config) {
return config.island === true || config.dot === true;
}
@@ -138,7 +144,8 @@ function resolveScreen(inputs, screen, options) {
const thickness = kind === "island" ? input.islandThickness : frameStyled ? Math.round(Math.round(options.frameBarSize * (screen.scale || 1)) / (screen.scale || 1)) : input.barThickness + spacing + (config.bottomGap ?? 0);
const paintedThickness = thickness + (kind !== "island" && !frameStyled ? input.wingSize ?? 0 : 0);
const reserves = kind === "island" ? !(input.islandFloating ?? config.islandFloating) : config.visible !== false && (!config.autoHide || frameStyled);
const contribution = reserves ? Math.max(0, rowOffset + thickness - reservation) : 0;
const reserved = kind === "island" ? Math.min(thickness, input.islandReserve) : thickness;
const contribution = reserves ? Math.max(0, rowOffset + reserved - reservation) : 0;
instances.push({
key: JSON.stringify([screen.name, config.id]),
screenName: screen.name,
+4
View File
@@ -996,6 +996,10 @@ Singleton {
function islandStripThickness(bc) {
return LayoutResolver.islandThickness(islandSettings(bc), islandDefaultsFor(bc));
}
function islandReserveThickness(bc) {
return LayoutResolver.islandReserve(islandSettings(bc), islandDefaultsFor(bc));
}
readonly property var _islandHomeGroupIds: ["workspaces", "media", "clock", "weather", "status", "volume", "brightness", "notifications", "privacy"]
readonly property var _islandHomeLayoutDefault: [
{
+3 -2
View File
@@ -21,10 +21,11 @@ Singleton {
readonly property var primaryBar: SettingsData.getPrimaryBarConfig()
readonly property var layouts: screens.map(screen => Resolver.resolveScreen(SettingsData.barConfigs.map(config => ({
config,
barThickness: Theme.barThickness(config.innerPadding ?? 4, screen.scale),
barThickness: Theme.barThickness(config.innerPadding ?? 2, screen.scale),
wingSize: config.gothCornersEnabled && root.barSpansEdge(config) ? Math.max(0, config.gothCornerRadiusOverride ? config.gothCornerRadiusValue ?? 12 : Theme.windowRadius) : 0,
popupThickness: Theme.barThickness(Resolver.option(config, "innerPadding", root.primaryBar, 4), screen.scale),
popupThickness: Theme.barThickness(Resolver.option(config, "innerPadding", root.primaryBar, 2), screen.scale),
islandThickness: Resolver.islandThickness(SettingsData.islandSettings(config), SettingsData.islandDefaultsFor(config)),
islandReserve: Resolver.islandReserve(SettingsData.islandSettings(config), SettingsData.islandDefaultsFor(config)),
islandFloating: SettingsData.islandSetting(config, "islandFloating"),
islandPlacement: SettingsData.islandFreePlacement(config) ? "free" : "edge",
islandSatellites: SettingsData.islandSetting(config, "islandSatellitesEnabled")
+1 -1
View File
@@ -1508,7 +1508,7 @@ var LOCAL_SPEC = {
centerWidgets: ["music", "clock", "weather"],
rightWidgets: ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"],
spacing: 4,
innerPadding: 4,
innerPadding: 2,
barInsetPadding: -1,
barLengthPadding: 0,
barLengthMode: "full",
+1 -1
View File
@@ -44,7 +44,7 @@ DModal {
customPosition: {
if (parentBounds.width > 0) {
const bar = SettingsData.getPrimaryBarConfig();
const effectiveBarThickness = Theme.barThickness(bar?.innerPadding ?? 4, CompositorService.getScreenScale(parentScreen));
const effectiveBarThickness = Theme.barThickness(bar?.innerPadding ?? 2, CompositorService.getScreenScale(parentScreen));
const barExclusionZone = effectiveBarThickness + (bar?.spacing ?? 4) + (bar?.bottomGap ?? 0);
const barPosition = bar?.position ?? SettingsData.Position.Top;
const screenW = parentScreen?.width ?? 1920;
+4 -4
View File
@@ -53,7 +53,7 @@ Item {
return palette === "bright" ? Theme.surfaceBright : palette === "dim" ? Theme.surfaceDim : _hostSurface;
}
readonly property real islandSatelliteOpacity: isIsland ? SettingsData.islandSatelliteTransparency(barConfig) : 1
readonly property real islandChromePad: isIsland ? Theme.snap((barConfig?.innerPadding ?? 4) + Theme.spacingXS, _dpr) : 0
readonly property real islandChromePad: isIsland ? Theme.snap((barConfig?.innerPadding ?? 2) + Theme.spacingXS, _dpr) : 0
readonly property real islandChromeInset: islandSatelliteBackground ? islandChromePad : 0
readonly property real islandSatelliteSweep: islandSatelliteBackground && SettingsData.islandSetting(barConfig, "islandSatelliteGothCorners") ? islandGothRadius : 0
readonly property real islandFlareClearance: ((islandHost?.notch ?? false) ? islandHost.surface.joinRadius * 2.5 : 0) + islandSatelliteSweep
@@ -677,7 +677,7 @@ Item {
}
readonly property int notificationCount: NotificationService.notifications.length
readonly property real effectiveBarThickness: (FrameTransitionState.effectiveFrameEnabled && usesFrameBarChrome) ? SettingsData.frameBarSize : Theme.barThickness(barConfig?.innerPadding ?? 4, _dpr)
readonly property real effectiveBarThickness: (FrameTransitionState.effectiveFrameEnabled && usesFrameBarChrome) ? SettingsData.frameBarSize : Theme.barThickness(barConfig?.innerPadding ?? 2, _dpr)
readonly property real effectiveBarLengthPadding: {
if (barLengthMode === "percent") {
const percent = Math.min(100, Math.max(10, barConfig?.barLengthPercent ?? 80));
@@ -722,7 +722,7 @@ Item {
onTriggered: barWindow._fitSettled = true
}
readonly property bool effectiveOpenOnOverview: (FrameTransitionState.effectiveFrameEnabled && usesFrameBarChrome) ? SettingsData.frameShowOnOverview : (barConfig?.openOnOverview ?? false)
readonly property real widgetThickness: Theme.barWidgetThickness(barConfig?.innerPadding ?? 4, _dpr)
readonly property real widgetThickness: Theme.barWidgetThickness(barConfig?.innerPadding ?? 2, _dpr)
readonly property bool hasAdjacentTopBar: isVertical && ShellLayout.adjacentBar(screen, "top", barConfig) !== null
readonly property bool hasAdjacentBottomBar: isVertical && ShellLayout.adjacentBar(screen, "bottom", barConfig) !== null
@@ -780,7 +780,7 @@ Item {
readonly property bool reserveExclusiveWhenAutoHidden: FrameTransitionState.effectiveFrameEnabled && usesFrameBarChrome && !!barWindow.screen && SettingsData.isScreenInPreferences(barWindow.screen, SettingsData.frameScreenPreferences)
readonly property real surfaceExclusiveZone: isIsland ? ((islandFree || (islandHost?.floating ?? false)) ? 0 : islandStripThickness) : (!(barConfig?.visible ?? true) || (topBarCore.autoHide && !barWindow.reserveExclusiveWhenAutoHidden)) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (usesFrameBarChrome ? 0 : (barConfig?.bottomGap ?? 0)))
readonly property real surfaceExclusiveZone: isIsland ? ((islandFree || (islandHost?.floating ?? false)) ? 0 : SettingsData.islandReserveThickness(barConfig)) : (!(barConfig?.visible ?? true) || (topBarCore.autoHide && !barWindow.reserveExclusiveWhenAutoHidden)) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (usesFrameBarChrome ? 0 : (barConfig?.bottomGap ?? 0)))
readonly property alias inputMaskItem: inputMask
+1 -1
View File
@@ -125,7 +125,7 @@ Item {
}
property bool _animateFrameInsets: false
readonly property real innerPadding: barConfig?.innerPadding ?? 4
readonly property real innerPadding: barConfig?.innerPadding ?? 2
readonly property real outlineThickness: (barConfig?.widgetOutlineEnabled ?? false) ? (barConfig?.widgetOutlineThickness ?? 1) : 0
readonly property real _edgeBaseMargin: Math.max(Theme.spacingXS, innerPadding * 0.8)
readonly property bool _hasBarWindow: barWindow !== undefined && barWindow !== null
@@ -22,7 +22,7 @@ DPopout {
triggerScreen = screen;
root.screen = screen;
storedBarThickness = barThickness !== undefined ? barThickness : Theme.barThickness(SettingsData.getPrimaryBarConfig()?.innerPadding ?? 4, 1);
storedBarThickness = barThickness !== undefined ? barThickness : Theme.barThickness(SettingsData.getPrimaryBarConfig()?.innerPadding ?? 2, 1);
storedBarSpacing = barSpacing !== undefined ? barSpacing : 4;
storedBarConfig = barConfig;
@@ -49,7 +49,7 @@ BasePill {
if (barThickness > 0 && barSpacing > 0) {
return barThickness + barSpacing;
}
return Theme.barThickness(barConfig?.innerPadding ?? 4, CompositorService.getScreenScale(parentScreen)) + (barConfig?.spacing ?? 4);
return Theme.barThickness(barConfig?.innerPadding ?? 2, CompositorService.getScreenScale(parentScreen)) + (barConfig?.spacing ?? 4);
}
readonly property var barBounds: {
@@ -139,7 +139,6 @@ Item {
readonly property bool isVertical: !root.dotMode && SettingsData.islandVertical(root.barConfig)
readonly property string edge: root.freeMode ? (root.isVertical ? "left" : "top") : SettingsData.islandEdge(root.barConfig)
readonly property bool farEdge: root.edge === "bottom" || root.edge === "right"
readonly property int reservedStripThickness: root.islandMetrics.thickness
readonly property real windowWidth: root.hostWindow?.width ?? 0
readonly property real windowHeight: root.hostWindow?.height ?? 0
readonly property real windowMarginLeft: root.hostWindow?.margins?.left ?? 0
@@ -354,7 +354,7 @@ Item {
visible: bar.selectedBarIsIsland && !root.selectedIslandFree
resetStore: bar
resetKeys: ["islandCompactThickness"]
text: bar.selectedBarIsVertical ? I18n.tr("Compact width", "island settings: compact pill width slider") : I18n.tr("Compact height", "island settings: compact pill height slider")
text: bar.selectedBarIsVertical ? I18n.tr("Width") : I18n.tr("Height")
unit: "px"
minimum: 24
maximum: 72
@@ -366,10 +366,11 @@ Item {
SettingsSliderRow {
settingKey: "barSize"
tags: ["size", "thickness", "height", "inner"]
visible: !bar.selectedBarIsIsland || bar.islandSetting("islandSatellitesEnabled")
text: I18n.tr("Size")
resetStore: bar
resetKeys: ["innerPadding"]
value: bar.selectedBarConfig?.innerPadding ?? 4
value: bar.selectedBarConfig?.innerPadding ?? 2
minimum: -8
maximum: 24
unit: "px"
@@ -633,16 +634,6 @@ Item {
tags: ["widget", "style", "pills", "segments", "opacity", "padding", "maximize"]
visible: bar.selectedBarConfig?.enabled ?? false
SettingsToggleRow {
settingKey: "barNoBackground"
tags: ["transparent", "background", "invisible"]
text: I18n.tr("Background")
checked: !(bar.selectedBarConfig?.noBackground ?? false)
onToggled: checked => SettingsData.updateBarConfig(bar.selectedBarId, {
noBackground: !checked
})
}
SettingsRow {
settingKey: "barWidgetStyle"
tags: ["widget", "style", "segments", "pills", "flat", "connected", "group"]
@@ -674,6 +665,16 @@ Item {
}
}
SettingsToggleRow {
settingKey: "barNoBackground"
tags: ["transparent", "background", "invisible"]
text: I18n.tr("Background")
checked: !(bar.selectedBarConfig?.noBackground ?? false)
onToggled: checked => SettingsData.updateBarConfig(bar.selectedBarId, {
noBackground: !checked
})
}
SettingsToggleSliderRow {
resetStore: bar
text: I18n.tr("Override", "verb, toggle to override the global setting for this item")
@@ -69,7 +69,7 @@ Item {
}
// inset padding stores < 0 as "auto", resolved here to the mode's natural inset
readonly property real insetPadAutoUI: (SettingsData.connectedFrameModeActive && root.selectedBarFrameStyled) ? SettingsData.frameThickness : (selectedBarIsVertical ? Theme.spacingXS : Math.max(Theme.spacingXS, (selectedBarConfig?.innerPadding ?? 4) * 0.8))
readonly property real insetPadAutoUI: (SettingsData.connectedFrameModeActive && root.selectedBarFrameStyled) ? SettingsData.frameThickness : (selectedBarIsVertical ? Theme.spacingXS : Math.max(Theme.spacingXS, (selectedBarConfig?.innerPadding ?? 2) * 0.8))
readonly property int insetPadDisplayValue: {
const raw = SettingsData.barInsetPaddingSyncAll ? SettingsData.barInsetPaddingShared : (selectedBarConfig?.barInsetPadding ?? -1);
return raw < 0 ? Math.round(insetPadAutoUI) : raw;
+1 -1
View File
@@ -190,7 +190,7 @@ PanelWindow {
continue;
if (!SettingsData.barConfigCoversScreen(bc, screen))
continue;
const innerPadding = bc.innerPadding ?? (defaultBar?.innerPadding ?? 4);
const innerPadding = bc.innerPadding ?? (defaultBar?.innerPadding ?? 2);
const thickness = Theme.barThickness(innerPadding, dpr);
const spacing = bc.spacing ?? (defaultBar?.spacing ?? 4);
const bottomGap = bc.bottomGap ?? (defaultBar?.bottomGap ?? 0);
+2 -2
View File
@@ -44,7 +44,7 @@ Item {
property bool _primeContent: false
property bool _warmContent: false
property real storedBarThickness: Theme.barThickness(SettingsData.getPrimaryBarConfig()?.innerPadding ?? 4, 1)
property real storedBarThickness: Theme.barThickness(SettingsData.getPrimaryBarConfig()?.innerPadding ?? 2, 1)
property real storedBarSpacing: 4
property var storedBarConfig: null
property var sourceRegistration: null
@@ -344,7 +344,7 @@ Item {
triggerSection = section;
screen = targetScreen;
storedBarThickness = barThickness !== undefined ? barThickness : Theme.barThickness(SettingsData.getPrimaryBarConfig()?.innerPadding ?? 4, 1);
storedBarThickness = barThickness !== undefined ? barThickness : Theme.barThickness(SettingsData.getPrimaryBarConfig()?.innerPadding ?? 2, 1);
storedBarSpacing = barSpacing !== undefined ? barSpacing : 4;
storedBarConfig = barConfig;
triggerUsesOverlayLayer = _triggerBarUsesOverlayLayer(targetScreen, barConfig);
+1 -1
View File
@@ -100,7 +100,7 @@ Item {
readonly property real effectiveBarThickness: {
if (root.usesConnectedSurfaceChrome)
return Math.max(0, storedBarThickness);
return Theme.barThickness(storedBarConfig?.innerPadding ?? 4, dpr) + storedBarSpacing;
return Theme.barThickness(storedBarConfig?.innerPadding ?? 2, dpr) + storedBarSpacing;
}
readonly property var barBounds: {
+13 -3
View File
@@ -15,20 +15,30 @@ const bar = (id, position = 0, values = {}) => ({ id, position, enabled: true, .
function resolve(configs, options = {}, screen = screens[0]) {
return resolver.resolveScreen(configs.map(config => ({
config, wingSize: config.gothCornersEnabled ? 12 : 0, barThickness: 40, popupThickness: 40, islandThickness: resolver.islandThickness(config, islandDefaults)
config, wingSize: config.gothCornersEnabled ? 12 : 0, barThickness: 40, popupThickness: 40, islandThickness: resolver.islandThickness(config, islandDefaults),
islandReserve: resolver.islandReserve(config, islandDefaults)
})), screen, {
screens, displayNameMode: "name", framePreferences: ["all"], effectiveFrameEnabled: false,
effectiveConnected: false, frameThickness: 12, frameBarSize: 48, ...options
});
}
test("island metrics clamp each setting and reserve the larger of strip and gap plus compact", () => {
assert.deepEqual(plain(resolver.islandMetrics({}, islandDefaults)), { reserve: 40, compact: 38, gap: 4, thickness: 42 });
test("island metrics clamp each setting and a default reservation follows the pill", () => {
assert.deepEqual(plain(resolver.islandMetrics({}, islandDefaults)), { reserve: 42, compact: 38, gap: 4, thickness: 42 });
assert.deepEqual(plain(resolver.islandMetrics({ islandCompactThickness: 60 }, islandDefaults)), { reserve: 64, compact: 60, gap: 4, thickness: 64 });
assert.deepEqual(plain(resolver.islandMetrics({ islandReserveThickness: 500, islandCompactThickness: 1, islandOuterGap: -3 }, islandDefaults)), { reserve: 128, compact: 24, gap: 0, thickness: 128 });
assert.equal(resolver.islandThickness({ islandReserveThickness: 30, islandCompactThickness: 60, islandOuterGap: 10 }, islandDefaults), 70);
assert.deepEqual(plain(resolver.islandMetrics({ islandOuterGap: 10, islandNotch: true }, islandDefaults)), { reserve: 40, compact: 38, gap: 0, thickness: 40 });
});
test("an island set to reserve less than its pill paints the full pill but reserves only what was set", () => {
const island = bar("island", 0, { island: true, islandReserveThickness: 30 });
const alone = resolve([island]);
assert.deepEqual(plain([alone.instances[0].rowThickness, alone.instances[0].exclusiveZone, alone.edges.top.reservation]), [42, 30, 30]);
const stacked = resolve([island, bar("below")]);
assert.deepEqual(plain([stacked.instances[1].rowOffset, stacked.edges.top.reservation]), [42, 86]);
});
test("absent, empty, explicit and fallback assignments remain distinct", () => {
for (const count of [1, 2]) {
const live = screens.slice(0, count);
@@ -5149,30 +5149,6 @@
"parentLabel": "Bar",
"conditionKey": "islandEnabled"
},
{
"section": "islandCompactThickness",
"label": "Compact width",
"tabIndex": 6,
"category": "Appearance",
"keywords": [
"appearance",
"bar",
"compact",
"height",
"island",
"panel",
"placement",
"satellite",
"size",
"statusbar",
"taskbar",
"thickness",
"topbar",
"width"
],
"parentLabel": "Bar",
"conditionKey": "islandDocked"
},
{
"section": "barCornerStyle",
"label": "Corner style",
@@ -6013,6 +5989,30 @@
"icon": "widgets",
"description": "Opacity"
},
{
"section": "islandCompactThickness",
"label": "Width",
"tabIndex": 6,
"category": "Appearance",
"keywords": [
"appearance",
"bar",
"compact",
"height",
"island",
"panel",
"placement",
"satellite",
"size",
"statusbar",
"taskbar",
"thickness",
"topbar",
"width"
],
"parentLabel": "Bar",
"conditionKey": "islandDocked"
},
{
"section": "networkStatus",
"label": "Status",