дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
Compact Mode only lowered the title bar and narrowed the stripes: row heights, toolbar widgets and icons were fixed in code, and nothing in JS (where virtualised list row heights are set) could tell whether the mode was on. A small density store now mirrors the setting for JS, and Compact Mode uses IntelliJ's *.compact theme values: tree/list rows 22 (VCS log 24), toolbar widgets 26, toolbar and stripe icons 16, status bar 24, island gap 4, and chrome text 1px smaller. Co-authored-by: ChildishForces <[email protected]>
28 рядки
986 B
TypeScript
28 рядки
986 B
TypeScript
import { create } from "zustand";
|
||
|
||
/**
|
||
* Settings › Appearance › Compact mode, for sizes set from JS (virtualised rows,
|
||
* icon props). CSS reads the same switch from `:root[data-compact]` (tokens.css).
|
||
* Steps follow IDEA's Islands theme `*.compact` keys: rows −2 (Tree/List 24 → 22,
|
||
* VCS log 26 → 24), main-toolbar and stripe icons 20 → 16.
|
||
*/
|
||
export const useCompactMode = create<boolean>(() => false);
|
||
|
||
export function setCompactMode(on: boolean): void {
|
||
useCompactMode.setState(on, true);
|
||
}
|
||
|
||
export function compactRowHeight(base: number, compact: boolean): number {
|
||
return compact ? base - 2 : base;
|
||
}
|
||
|
||
/** Height of a list / tree row whose regular height is `base`. */
|
||
export function useRowHeight(base = 24): number {
|
||
return compactRowHeight(base, useCompactMode());
|
||
}
|
||
|
||
/** Icon size for window chrome: main toolbar, run widget, tool window stripes. */
|
||
export function useChromeIconSize(base = 20): number {
|
||
return useCompactMode() ? base - 4 : base;
|
||
}
|