From 1081adfe5e1b7a07a71302cc83436d685cd1a84a Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 31 Mar 2025 16:42:14 +1100 Subject: bar: add panel style --- src/config/defaults.ts | 1 + src/config/types.ts | 1 + src/modules/bar.tsx | 114 +++++++++++++++++++++++++------------------------ 3 files changed, 61 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/config/defaults.ts b/src/config/defaults.ts index d699a45..8a3927a 100644 --- a/src/config/defaults.ts +++ b/src/config/defaults.ts @@ -8,6 +8,7 @@ export default { // Modules bar: { vertical: true, + style: "gaps", modules: { osIcon: { enabled: true, diff --git a/src/config/types.ts b/src/config/types.ts index aa0d921..51eb7cc 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -9,6 +9,7 @@ export default { "style.vibrant": BOOL, // Bar "bar.vertical": BOOL, + "bar.style": ["gaps", "panel", "embedded"], "bar.modules.osIcon.enabled": BOOL, "bar.modules.activeWindow.enabled": BOOL, "bar.modules.mediaPlaying.enabled": BOOL, diff --git a/src/modules/bar.tsx b/src/modules/bar.tsx index 85d2add..14a1ebd 100644 --- a/src/modules/bar.tsx +++ b/src/modules/bar.tsx @@ -554,59 +554,63 @@ const bindWidget = (module: keyof typeof config.modules, Widget: () => JSX.Eleme const bindCompositeWidget = (module: keyof typeof config.modules, binding: Binding) => bind(Variable.derive([config.modules[module].enabled, binding], (e, w) => (e ? w : ))); -export default ({ monitor }: { monitor: Monitor }) => ( - - Astal.WindowAnchor.TOP | - Astal.WindowAnchor.LEFT | - (v ? Astal.WindowAnchor.BOTTOM : Astal.WindowAnchor.RIGHT) - )} - exclusivity={Astal.Exclusivity.EXCLUSIVE} - > - `bar ${v ? "vertical" : " horizontal"}`)} +export default ({ monitor }: { monitor: Monitor }) => { + const className = Variable.derive( + [bind(config.vertical), bind(config.style)], + (v, s) => `bar ${v ? "vertical" : " horizontal"} ${s}` + ); + + return ( + + Astal.WindowAnchor.TOP | + Astal.WindowAnchor.LEFT | + (v ? Astal.WindowAnchor.BOTTOM : Astal.WindowAnchor.RIGHT) + )} + exclusivity={Astal.Exclusivity.EXCLUSIVE} > - - {bindWidget("osIcon", OSIcon)} - {bindWidget("activeWindow", ActiveWindow)} - {bindWidget("mediaPlaying", MediaPlaying)} -