mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
Add Border option to Settings>Customization
This commit is contained in:
1 parent
8b70585da8
commit
c6ce79ab70
7 files changed
+210
-50
No files matched your search
@@ -202,14 +202,16 @@ const launchableApps = () => ALL_APPS.filter((app) => app.showInLauncher !== fal
|
||||
* screen, the display mode's size (a band's position only moves windows), whether the app switcher
|
||||
* takes width beside windows, height below them or neither (a popup), and
|
||||
* the chrome rows each window loses to it: below them, whether the status
|
||||
* bar joins the row (dropping the top bar); with a popup, whether the
|
||||
* status bar keeps rows of its own and the window frame (where the status
|
||||
* bar goes only moves windows).
|
||||
* bar joins the row (dropping the top bar, for the window frame's top row
|
||||
* if it has a frame); with a popup, whether the status bar keeps rows of its
|
||||
* own and the window frame (where the status bar goes only moves windows).
|
||||
*/
|
||||
function viewportSizesKey(): string {
|
||||
const position = appSwitcherPositionSetting.get();
|
||||
const switcher = position === "bottom" ? `row|${statusBarPositionSetting.get()}`
|
||||
: position === "popup" ? `popup|${statusBarVisibilitySetting.get()}|${windowBorderSetting.get()}`
|
||||
const statusBar = statusBarPositionSetting.get();
|
||||
const framed = windowBorderSetting.get() === "all";
|
||||
const switcher = position === "bottom" ? `row|${statusBar}|${statusBar === "bottom" && framed}`
|
||||
: position === "popup" ? `popup|${statusBarVisibilitySetting.get()}|${framed}`
|
||||
: "strip";
|
||||
const layout = displayLayoutSetting.get();
|
||||
return `${screenWidth()}x${screenHeight()}|${layout.startsWith("band-") ? "band" : layout}|${switcher}`;
|
||||
|
||||
@@ -581,18 +581,36 @@ export const statusBarVisibilitySetting = new ConfigSettingEnum<StatusBarVisibil
|
||||
});
|
||||
|
||||
/**
|
||||
* Whether the foreground window gets a rounded border with a popup app
|
||||
* switcher (geometry.ts windowFramed); without one, a line divides the
|
||||
* window from the status bar.
|
||||
* Which lines the shell draws round the foreground window with a bottom or
|
||||
* popup app switcher: a rounded border all round it (geometry.ts
|
||||
* windowFramed), only a straight line between it and the status bar, or
|
||||
* none at all.
|
||||
*/
|
||||
export const windowBorderSetting = new ConfigSettingBoolean({
|
||||
export type WindowBorder = "all" | "status" | "none";
|
||||
|
||||
const WINDOW_BORDER_LABELS: Record<WindowBorder, string> = {
|
||||
all: "All around",
|
||||
status: "Status line",
|
||||
none: "None",
|
||||
};
|
||||
|
||||
// Until 2026-11-09 this was a toggle that only a popup app switcher had,
|
||||
// between the rounded border and the status line; a bottom row's windows
|
||||
// always had the border.
|
||||
function legacyWindowBorder(): WindowBorder {
|
||||
return appSwitcherPositionSetting.get() === "popup" && !getBooleanSetting("display.windowBorder", true) ? "status" : "all";
|
||||
}
|
||||
|
||||
export const windowBorderSetting = new ConfigSettingEnumWithLegacy<WindowBorder>({
|
||||
id: "window-border",
|
||||
label: "Window border",
|
||||
storageKey: "display.windowBorder",
|
||||
defaultValue: true,
|
||||
label: "Border",
|
||||
storageKey: "display.border",
|
||||
defaultValue: "all",
|
||||
values: ["all", "status", "none"],
|
||||
formatValue: (value) => WINDOW_BORDER_LABELS[value] ?? value,
|
||||
description:
|
||||
"Draw a rounded border around the window. Without it, a line separates the window from the status bar. Available with a popup app switcher. Changing it reopens open apps in the new size.",
|
||||
});
|
||||
"All around draws a rounded border around the window. Status line draws only a straight line between the window and the status bar. None draws no lines. Available with the app switcher at the bottom or as a popup. Open apps reopen at their new size when a change resizes windows.",
|
||||
}, legacyWindowBorder);
|
||||
|
||||
export const brightnessSetting = new ConfigSettingEnum<BrightnessSetting>({
|
||||
id: "brightness",
|
||||
|
||||
@@ -138,8 +138,9 @@ function settingsSections(): SettingsSection[] {
|
||||
},
|
||||
{
|
||||
label: "Customization",
|
||||
// Depth only applies (and only shows) with the app switcher at the
|
||||
// bottom; the panel re-reads the rows each paint.
|
||||
// Depth, the status bar's place and the border only apply (and only
|
||||
// show) with the app switcher at the bottom or a popup; the panel
|
||||
// re-reads the rows each paint.
|
||||
get items() {
|
||||
return customizationItems();
|
||||
},
|
||||
@@ -318,9 +319,12 @@ function customizationRows(): () => MenuItem[] {
|
||||
// resizes or moves windows on change.
|
||||
const statusBar = enumSettingMenuItem(statusBarPositionSetting);
|
||||
// Popup switcher only: whether the status bar shows only in the switcher
|
||||
// (windows then grow into its rows), and the foreground window's border.
|
||||
// (windows then grow into its rows).
|
||||
const statusBarVisibility = enumSettingMenuItem(statusBarVisibilitySetting);
|
||||
const windowBorder = toggleSettingMenuItem(windowBorderSetting);
|
||||
// The lines round the foreground window: a rounded border all around, only
|
||||
// the line between it and the status bar, or none; the dashboard
|
||||
// controller resizes windows when the border's rows come or go.
|
||||
const windowBorder = enumSettingMenuItem(windowBorderSetting);
|
||||
const rest = [
|
||||
// Submenu: top-bar battery indicator style plus per-device visibility.
|
||||
batteryIndicatorsMenuItem(),
|
||||
@@ -333,7 +337,7 @@ function customizationRows(): () => MenuItem[] {
|
||||
// Miles or kilometers: Weather's wind speed and Navigate's distances.
|
||||
enumSettingMenuItem(distanceUnitSetting),
|
||||
];
|
||||
const bottomRows = [font, position, depth, statusBar, ...rest];
|
||||
const bottomRows = [font, position, depth, statusBar, windowBorder, ...rest];
|
||||
const popupRows = [font, position, depth, statusBar, statusBarVisibility, windowBorder, ...rest];
|
||||
const sideRows = [font, position, ...rest];
|
||||
return () => {
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
SHELL_OPAQUE_BLACK,
|
||||
SIDEBAR_WIDTH,
|
||||
sidebarStripVisible,
|
||||
statusBarDivider,
|
||||
statusBarEdge,
|
||||
statusBarOverlays,
|
||||
statusBarTop,
|
||||
@@ -45,6 +46,7 @@ import {
|
||||
SWITCHER_ROW_HEIGHT,
|
||||
switcherPosition,
|
||||
switcherRect,
|
||||
switcherRowDivider,
|
||||
TOP_BAR_HEIGHT,
|
||||
windowFooterHeight,
|
||||
windowFramed,
|
||||
@@ -188,8 +190,11 @@ function switcherLayout(windowCount: number, heightMode: WindowHeightMode, appId
|
||||
// tab there carries the side straight down (drawWindowFrame squares that
|
||||
// corner for it). Scrolled past it, the cells keep the margin the left
|
||||
// chevron needs. The count of slots stays the same either way. Only the
|
||||
// first row's cells touch the separator; a second row's lines up under it.
|
||||
// first row's cells touch the separator; a second row's lines up under
|
||||
// it. Where the row has no separator line (geometry.ts
|
||||
// switcherRowDivider) none do, and every selection is a box.
|
||||
const first = windowFramed(appId) && scrollRow === 0 ? row.x - 1 : row.x + LIST_MARGIN - 2;
|
||||
const divided = switcherRowDivider(appId);
|
||||
return {
|
||||
position,
|
||||
iconSize: ROW_ICON_SIZE,
|
||||
@@ -198,7 +203,7 @@ function switcherLayout(windowCount: number, heightMode: WindowHeightMode, appId
|
||||
const line = (slot / columns) | 0;
|
||||
return {
|
||||
x: first + (slot % columns) * ROW_STEP, y: row.y + line * SWITCHER_ROW_HEIGHT,
|
||||
width: ROW_ICON_SIZE + 4, height: SWITCHER_ROW_HEIGHT, atSeparator: line === 0,
|
||||
width: ROW_ICON_SIZE + 4, height: SWITCHER_ROW_HEIGHT, atSeparator: divided && line === 0,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -413,7 +418,8 @@ function topBarSpan(state: ShellChromeState): { left: number; right: number } {
|
||||
* bar's layout starts in them: a row lower at the window's bottom, where
|
||||
* the bar's first row is the one next to the window. `divider` is the row
|
||||
* of the line between bar and window, or null where the window frame's side
|
||||
* runs along it instead.
|
||||
* runs along it instead, or the Border setting leaves the line out
|
||||
* (geometry.ts statusBarDivider).
|
||||
*/
|
||||
type StatusBarPlacement = { left: number; right: number; top: number; contentTop: number; divider: number | null };
|
||||
|
||||
@@ -433,7 +439,8 @@ function statusBarPlacement(state: ShellChromeState): StatusBarPlacement | null
|
||||
const { left, right } = topBarSpan(state);
|
||||
const top = statusBarTop(state.foregroundHeightMode, appId);
|
||||
const atBottom = statusBarEdge() === "bottom";
|
||||
const divider = windowFramed(appId) && !overlays ? null : atBottom ? top : top + TOP_BAR_HEIGHT - 1;
|
||||
const framedSide = windowFramed(appId) && !overlays;
|
||||
const divider = framedSide || !statusBarDivider() ? null : atBottom ? top : top + TOP_BAR_HEIGHT - 1;
|
||||
return { left, right, top, contentTop: atBottom ? top + 1 : top, divider };
|
||||
}
|
||||
|
||||
@@ -1001,7 +1008,8 @@ export class ShellChromeLayer implements Layer {
|
||||
// stops at the strip.
|
||||
const { left: barLeft, right: barRight } = bar;
|
||||
image.fillRect(barLeft, bar.top, barRight - barLeft, TOP_BAR_HEIGHT, SHELL_OPAQUE_BLACK);
|
||||
// A framed window's frame draws this line as its side (drawWindowFrame).
|
||||
// A framed window's frame draws this line as its side (drawWindowFrame);
|
||||
// without any border there is none.
|
||||
if (bar.divider !== null) {
|
||||
image.drawLine(barLeft, bar.divider, barRight - 1, bar.divider, BORDER_VALUE);
|
||||
}
|
||||
@@ -1369,7 +1377,9 @@ const TAB_STROKE = 150;
|
||||
|
||||
/**
|
||||
* Draw the switcher/main separator line along the strip's inner edge, with
|
||||
* a gap where the selection tab `gap` diverts it.
|
||||
* a gap where the selection tab `gap` diverts it. A bottom row has the line
|
||||
* only where the Border setting gives it one (geometry.ts
|
||||
* switcherRowDivider).
|
||||
*/
|
||||
function drawSeparator(
|
||||
image: GrayImage,
|
||||
@@ -1378,6 +1388,7 @@ function drawSeparator(
|
||||
gap: SwitcherCell | null,
|
||||
): void {
|
||||
if (switcherPosition() === "bottom") {
|
||||
if (!switcherRowDivider(state.foregroundAppId)) return;
|
||||
// Along the row's top edge: the full width of the row, or between the
|
||||
// corners of the window frame, whose bottom side this is.
|
||||
// A selection tab at the frame's left side squares that corner (see
|
||||
|
||||
+42
-10
@@ -9,6 +9,7 @@ import {
|
||||
statusBarPositionSetting,
|
||||
statusBarVisibilitySetting,
|
||||
uiDepthSetting,
|
||||
type WindowBorder,
|
||||
windowBorderSetting,
|
||||
} from "../dashboard-settings";
|
||||
|
||||
@@ -189,28 +190,59 @@ export function switcherRect(heightMode: WindowHeightMode, appId?: string): { x:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Which lines the chrome draws round the foreground window (Settings >
|
||||
* Customization > Border): all of them, only the one between the window and
|
||||
* the status bar, or none. The choice is a bottom or popup switcher's; a
|
||||
* side strip always has its lines.
|
||||
*/
|
||||
function windowBorder(): WindowBorder {
|
||||
return sideStrip() ? "all" : windowBorderSetting.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the foreground window's content gets a rounded frame (drawn by
|
||||
* the chrome layer). Its left and right sides take the pixel just outside
|
||||
* the 576-wide window; there's no room around a Full Screen or immersive
|
||||
* window, nor need beside a side strip. With a reserved bottom switcher row
|
||||
* it otherwise always has one: the row's top edge is the frame's bottom side, as the window
|
||||
* header's last row is its top. With a popup switcher it's the Window
|
||||
* border setting's choice, and its top and bottom take a header or footer
|
||||
* row of their own, except where the status bar's row next to the window
|
||||
* serves.
|
||||
* the chrome layer): with every border line on (windowBorder), where
|
||||
* there's room. Its left and right sides take the pixel just outside the
|
||||
* 576-wide window; there's no room around a Full Screen or immersive
|
||||
* window, nor need beside a side strip. With a reserved bottom switcher
|
||||
* row, the row's top edge is the frame's bottom side, as the window
|
||||
* header's last row is its top. With a popup switcher, its top and bottom
|
||||
* take a header or footer row of their own, except where the status bar's
|
||||
* row next to the window serves.
|
||||
*/
|
||||
export function windowFramed(appId?: string): boolean {
|
||||
if (fullWidth(appId) || windowBorder() !== "all") return false;
|
||||
switch (switcherPosition()) {
|
||||
case "bottom":
|
||||
return switcherRowHeight(appId) > 0 && !fullWidth(appId);
|
||||
return switcherRowHeight(appId) > 0;
|
||||
case "popup":
|
||||
return !fullWidth(appId) && windowBorderSetting.get();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a line divides a status bar with rows of its own (the top bar, or
|
||||
* a popup switcher's at the bottom) from the window. A window frame's side
|
||||
* is that line where there is one (chrome-layer.ts statusBarPlacement).
|
||||
*/
|
||||
export function statusBarDivider(): boolean {
|
||||
return windowBorder() !== "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a line runs along a bottom switcher's top edge, between it and
|
||||
* the window: a window frame's bottom side, or straight across where the
|
||||
* window has no room for a frame. As the status line alone, only where the
|
||||
* status bar shares the row.
|
||||
*/
|
||||
export function switcherRowDivider(appId?: string): boolean {
|
||||
const border = windowBorder();
|
||||
return border === "all" || (border === "status" && statusInSwitcherRow(appId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the status bar shares the bottom switcher row instead of topping
|
||||
* each window (Settings > Customization > Status bar position): only beside
|
||||
|
||||
Reference in new issue
Block a user