Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/components/bar/layout/BarLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class BarLayout {
private _widgetRegistry: WidgetRegistry;

private _visibilityVar: Variable<boolean>;
private _exclusivityVar: Variable<Astal.Exclusivity>;
private _classNameVar: Variable<string>;
private _anchorVar: Variable<Astal.WindowAnchor>;
private _layerVar: Variable<Astal.Layer>;
Expand All @@ -32,6 +33,7 @@ export class BarLayout {
this._widgetRegistry = widgetRegistry;

this._visibilityVar = Variable(true);
this._exclusivityVar = Variable(Astal.Exclusivity.EXCLUSIVE);
this._classNameVar = Variable('bar');
this._anchorVar = Variable(
Astal.WindowAnchor.TOP | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.RIGHT,
Expand Down Expand Up @@ -79,9 +81,7 @@ export class BarLayout {
visible={this._visibilityVar()}
anchor={this._anchorVar()}
layer={this._layerVar()}
exclusivity={bind(this._visibilityVar).as((visible) =>
visible ? Astal.Exclusivity.EXCLUSIVE : Astal.Exclusivity.NORMAL,
)}
exclusivity={this._exclusivityVar()}
onDestroy={() => this._cleanup()}
>
<box className="bar-panel-container">
Expand Down Expand Up @@ -130,14 +130,17 @@ export class BarLayout {
* Initialize variables related to bar positioning
*/
private _initializePositionVariables(): void {
const { location } = options.theme.bar;
const { location, exclusive } = options.theme.bar;

this._anchorVar = Variable.derive([bind(location)], (loc) => {
if (loc === 'bottom') {
return Astal.WindowAnchor.BOTTOM | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.RIGHT;
}
return Astal.WindowAnchor.TOP | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.RIGHT;
});
this._exclusivityVar = Variable.derive([bind(exclusive)], (isExclusive: boolean) => {
return isExclusive ? Astal.Exclusivity.EXCLUSIVE : Astal.Exclusivity.NORMAL;
});
}

private _initializeAppearanceVariables(): void {
Expand Down
6 changes: 6 additions & 0 deletions src/components/settings/pages/config/bar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export const BarSettings = (): JSX.Element => {
type="enum"
enums={['top', 'bottom']}
/>
<Option
opt={options.theme.bar.exclusive}
title="Exclusivity"
type="boolean"
subtitle="An exclusive bar will have a reserved space on your display"
/>

<Option
opt={options.bar.autoHide}
Expand Down
1 change: 1 addition & 0 deletions src/configuration/modules/theme/bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default {
layer: opt<WindowLayer>('top'),
margin_top: opt('0.5em'),
opacity: opt(100),
exclusive: opt(true),
enableShadow: opt(false),
shadow: opt('0px 1px 2px 1px #16161e'),
shadowMargins: opt('0px 0px 4px 0px'),
Expand Down