Skip to content

Bar

Note

The Bar (the Bar block) is a surface attached to one screen edge that reserves space, so maximised windows stop short of it. It can span the whole edge, touching three edges (its own and the two across it), or be shorter and sit at a position along the edge. A dock, a top bar and a side bar are all Bars. A Bar can have a Gap to its edge and then looks as if it floats, but it is still attached to its edge: the gap space is reserved, so it behaves as if the Bar were flush (maintainer, 2026-10-27). A Bar has no Margin; its placement keys are Edge, Width, Height, Alignment, Offset and Gap (maintainer, 2026-10-30). A surface that is not attached to an edge and reserves nothing is a Panel. It is highly customisable: size, position, gap, animation, hidden state, background, borders, rounded corners, shadows with elevation and colour, and transparency. A Bar is a tre LayerWindow anchored to an edge. The decisions are the maintainer's (Surface Types); the key names were accepted by the maintainer on 2026-10-29 (many mirror tre's settings). The examples are TDL illustrations (ADR-0014 Shell File Language).

Purpose and Scope

  • The v1 uses: the top bar with the clock, workspaces, tray and system modules; a dock; a side bar (V1 Scope > Surfaces).
  • Not in this note: what a Bar contains (blocks, containers and modules, Building Blocks), the Panel that slides out of a Bar (Panel), and the Frame (Frame).

Behaviour

Geometry

The Bar is placed with Edge, Width, Height, Alignment, Offset and Gap (Shell File > Surface Keys). For a top or bottom Bar Width is the length along the edge and Height the size across it; for a left or right Bar Width is the size across the edge and Height the length along it.

Shape TDL keys (top Bar shown) tre settings it implies
Full-span bar on one edge Edge: TOP, Width: EXPAND, Height: 32 anchor the edge and both perpendicular edges; size 0 along the edge and 32 across it; exclusive_zone 32
A shorter bar, centred on its edge Edge: BOTTOM, Width: 560, Height: 64, Alignment: CENTER anchor the edge only; size (560, 64); the compositor centres it along that edge
A shorter bar at one end Edge: TOP, Width: 400, Height: 32, Alignment: START, Offset: 200 anchor the edge and one perpendicular edge; a margin along the edge for the offset
A bar that looks floating Edge: TOP, Width: EXPAND, Height: 32, Gap: 8 The same, with a margin on its own edge; the zone is 40 and the margin 8, and the compositor reserves 48 (the Gap shows above and below the Bar; measured, see below). It is still a Bar: the Gap is reserved

The shell computes tre's anchor, size, margin and exclusive_zone from Edge, Width, Height, Alignment, Offset and Gap, the same way it computes a Panel's attachment geometry. The maintainer accepted the computation below on 2026-10-31 (D61).

Mapping to tre

Sources: the layer-shell protocol (set_size, set_anchor, set_exclusive_zone, set_margin, read 2026-10-31) and the tre LayerWindow reference (read 2026-10-31). tre takes margin as (top, right, bottom, left), whole pixels, negative allowed; size 0 on an axis stretches between two anchors on that axis and is otherwise a protocol error (invalid_size); anchor, size, margin and exclusive_zone are live through set(); a margin can be animated.

Terms. The along axis runs along the Edge (x for a top or bottom Bar, y for a left or right Bar), the across axis is the thickness. L is the resolved length along the Edge (Width for top and bottom, Height for left and right), T the resolved thickness across it, and O the output's logical size along the Edge (Output.width or Output.height from App.outputs(), in logical pixels). The start side is the left side of a top or bottom Bar and the top side of a left or right Bar. A positive Offset moves the Bar toward the end of the Edge.

Step Rule
Resolve a size Pixels stay; p% is p/100 of the output's size on that axis; AUTO is the content's size on that axis; EXPAND along the Edge stretches (below); EXPAND across the Edge is Max_, else Min_, else 0. Then clamp to Min_ and Max_.
Across size and zone size across is T. The Gap goes on the Edge's own side: margin on that side is Gap. exclusive_zone is T + Gap (2026-10-27 rule above), only when Layer is TOP and Reserve is true.
EXPAND along anchor is the Edge plus both perpendicular edges; size along is 0; no margin along. Alignment and Offset have no effect; the shell warns if either is set.
START anchor is the Edge plus the start side; margin on the start side is Offset; size along is L; exclusive_edge is the Edge.
END anchor is the Edge plus the end side; margin on the end side is -Offset; size along is L; exclusive_edge is the Edge.
CENTER, no Offset anchor is the Edge only; the compositor centres the Bar along it; size along is L. No exclusive_edge is needed.
CENTER with Offset anchor is the Edge plus the start side; margin on the start side is (O - L) / 2 + Offset; exclusive_edge is the Edge. The shell recomputes it on output_updated.
Zero size A resolved T, or an L that is not EXPAND, of 0 is not created (D46). This matches the protocol: a 0 on an axis without anchors on both opposite edges is invalid_size.
Hidden or peeking The window keeps its size. The shell animates the Edge-side margin to -(T - peek) (negative margins are accepted and were honoured on KWin, TRE-REQ-001 Layer Surface Window) and sets exclusive_zone to 0 when the slide ends. A size of 0 never arises.
Recompute On any live key change, on output_updated (size, scale or rotation), and when an AUTO size's content changes. The shell sends one set() with the new anchor, size, margin and exclusive_zone.

Worked examples on a 1920 px wide output (margin as top, right, bottom, left):

TDL anchor size margin exclusive_zone
Edge: TOP, Width: EXPAND, Height: 32 top, left, right (0, 32) (0, 0, 0, 0) 32
Edge: TOP, Width: EXPAND, Height: 32, Gap: 8 top, left, right (0, 32) (8, 0, 0, 0) 40
Edge: BOTTOM, Width: 560, Height: 64, Alignment: CENTER bottom (560, 64) (0, 0, 0, 0) 64 (only if Layer is TOP)
Edge: TOP, Width: 400, Height: 32, Alignment: START, Offset: 200 top, left (400, 32) (0, 0, 0, 200) 32, exclusive_edge top
Edge: TOP, Width: 400, Height: 32, Alignment: END, Offset: 40 top, right (400, 32) (0, -40, 0, 0) 32, exclusive_edge top

Measured 2026-11-04 on KWin 6.8.2 and sway: a Bar with Height 32 and Gap 8 reserves 48 pixels, because the compositor adds the margin to the zone. Still unverified (#needs-verification): whether margins on an axis with no anchor are ignored by the compositor (the reason CENTER with an Offset anchors to the start side instead); whether Output.width and height are already rotated for a rotated output; and whether tre offers a way to measure content for AUTO before the window exists.

Tip

Measured on KWin 6.8.2 and sway, 2026-11-04 A Bar with Height 32 and Gap 8, given the mapping above (margin top 8, exclusive_zone 40), reserves 48 pixels on both compositors: the compositor adds the margin to the zone, so there are 8 pixels above the Bar, the Bar, and 8 below it. The maintainer ran the check on KWin and kept the rule (zone = thickness + Gap, margin = Gap; reported by tess-shell as D31, 2026-11-04): the Gap is on both sides of the Bar. The "reserved zone is 40" reading of 2026-10-27 was wrong; the number windows stop at is 48.

  • A positive exclusive_zone counts only for a surface anchored to one edge, or one edge plus both perpendicular edges; with any other anchor set the compositor treats it as 0, and a warning event says so (TRE-REQ-001 Layer Surface Window > Shell need).
  • A size is pixels, a percent, AUTO or EXPAND (TDL Language > Sizes (Shell Schema)). AUTO shrinks the Bar to its content on that axis. Max_Width, Max_Height, Min_Width and Min_Height bound the result.
  • The EXPAND rule. EXPAND stretches the Bar edge to edge along its attached Edge. Across the Edge it cannot stretch, because the attached edge does not reach the opposite edge: a top Bar with Height: EXPAND resolves to Max_Height, else Min_Height, else 0 px (D34, D46).
  • The zero-size rule. A Bar whose size resolves to 0 on the axis it is attached along (a top Bar with Height: EXPAND and no bound, or Height: 0) is not created. The shell warns, names the Bar and says to set Min_Height (Min_Width for a left or right Bar). The check runs at creation only; it never stops hide, peek, expand or contract of a Bar or of a Frame strip, which may reach a size of 0 while hidden or contracted (Frame > Strip: Expand, Contract, Peek).
  • The gap is part of the Bar (decided 2026-10-27). A Bar with a Gap looks as if it floats but stays attached to its edge, and the gap space is reserved, so windows stop where they would for a flush Bar. The protocol says the exclusive zone includes the margin: "The exclusive zone includes the margin" (protocol, read 2026-10-27). A Bar with a Gap of 8 and a Height of 32 sets a zone of 40 and a margin of 8; measured on KWin 6.8.2 and sway, the compositor then reserves 48 (the margin is added to the zone), so windows stop 8 pixels below the Bar, and the Gap shows on both sides of it. The shell computes the zone from the size across the Edge and the Gap. A Panel differs: it is not attached to an edge and does not have to reserve anything. Verified on KWin 6.8.2 (2026-11-04).
  • A shadow makes the surface larger (decided 2026-11-05, D37). A Bar with an Elevation is a larger surface than its body: it grows by the shadow margin on its inner side and, for a Bar that does not span the screen, on both ends. A side flush with the screen gets none. The Edge side gets at most the Gap, so the shadow above the Bar shows in the Gap. The exclusive zone grows by what the Edge margin shrinks, so the reserved space is Height + Gap with or without a shadow. The surface is transparent and holds the Bar's fill in a body node, and its input region is the body, so clicks in the margin reach the windows below (ADR-0010 Surface Shadows, M3 Build Log).
  • Layers and reserving space. A Bar may use BOTTOM, TOP or OVERLAY. It may reserve space only on TOP; an Exclusive_Zone on another layer is a load error (Surface Types > Layers per kind). A Bar on BOTTOM or OVERLAY is therefore not reserving and is for effects (a decorative strip, a launcher dock that floats over windows).
  • Corner anchors. A bar anchored to an edge and one perpendicular edge reserves nothing unless exclusive_edge (tre's argument) names the edge; tre binds layer-shell version 5 for this (TRE-REQ-001 Layer Surface Window > Delivered (tre #195 closed)). KWin 6.8.1 and sway were tested for corner reservation.

States

A Bar is Hidden, Showing, Visible, Hiding or Closed, as a Panel is (Panel > States); Hidden and Visible here are states, not keys; the Visible key chooses the state it starts in. Moving is not offered: a Bar is anchored, and a movable surface is a Panel.

Auto-hide (Decided 2026-10-27)

  • On by default; the user opts out with Auto_Hide: false. Amended by the code session's report of 2026-11-21 (tess-shell PR #131, open, held for the maintainer's KWin check; the vault did not receive the decision from the maintainer itself): the default is OFF, per the owner, and Shortcut Mode reveals the Bar when Auto_Hide is on. Confirm with the maintainer before this line is final.
  • A reasonable default delay, which the user can change (Auto_Hide_Delay, milliseconds). Proposed default: 1000 ms after the pointer leaves the Bar, tuned in testing.
  • Shortcut Mode reveals a hidden Bar (decided 2026-11-21, amends the 2026-10-27 "none by default"): entering shortcut mode shows a Bar hidden by Auto_Hide and moves focus into it; leaving the mode or Escape hides it again per Auto_Hide (Focus and Keyboard > Shortcut Mode (the maintainer's design, 2026-11-10)). The matching Tesserae UX record is ADR-0021 "Shortcut Mode reveals a hidden Bar" (pending PR; Auto_Hide, Auto_Hide_Delay and the reveal are specified in its Auto Hide and Bar notes).
  • Other keyboard reveal: none by default. The user can set a key (Reveal_Key, a global shortcut through the KDE global-accel service, ADR-0005 Global Shortcuts). A Bar that hides itself and has no reveal key is still reachable by pointer through the hover strip.
  • The slide follows the pattern in the tre request (TRE-REQ-001 Layer Surface Window > Shell patterns):
  • Hide: slide the bar out by animating a margin (a negative margin slides it past the edge; tre accepts negative margins on KWin), then set exclusive_zone to 0 when the slide ends.
  • Show: set the zone first, then slide in. Windows reflow once, not on every frame.
  • A hover-to-reveal strip keeps a thin input area at the edge while the bar is hidden.

Vertical Bars (Decided 2026-10-27)

A Bar on a left or right edge lays its contents out as a FlexBox with Flex: VERTICAL. Text is not rotated by default; the user opts in (Text_Rotation, proposed key and values). The standard modules follow the Bar's direction.

Contents

A Bar holds modules, containers and blocks under Children (Common Keys and Conventions). The usual layout is a FlexBox with left, centre and right groups pushed apart by Spacer modules.

Multi-monitor

A Bar belongs to a Monitor block, and so to one monitor (Shell File). A Bar defined once and imported by several Monitor blocks appears on each. Each Bar reserves space on its own output only.

Note

Fill in a Bar's Style (maintainer, 2026-11-04, D14) In a Bar's inline Style, Fill is accepted as an alias of Background, because the M1 sample writes Style { Fill: ... }. Elsewhere Fill is the interior of a shape.

Configuration

Key Meaning Status
Bar (the head) The type; there is no Kind: key Decided
Layer BOTTOM, TOP or OVERLAY Decided
Children Blocks, containers and modules Decided
Style A style file or inline values Decided
Edge LEFT, RIGHT, TOP or BOTTOM: the edge it attaches to Decided (maintainer, 2026-10-27)
Width, Height Pixels, 50%, AUTO (shrink to content on that axis) or EXPAND (stretch edge to edge along the Edge); the EXPAND rule and the zero-size rule are in Geometry Decided (D34, D46; replaces Span, Length and Thickness)
Max_Width, Max_Height, Min_Width, Min_Height Bounds on the size, in pixels Decided (D34)
Alignment Where a shorter Bar sits along the Edge: START, CENTER, END; default CENTER; no effect on an EXPAND axis (D55). The Panel and the Popup use the same name for the same idea, along the edge they share with their target (Panel > Attachment Geometry (Decided 2026-10-27)) Decided (2026-10-30; replaces Align)
Offset One number that moves the Bar along the Edge; positive or negative Decided (D51)
Gap One number: the space between the Edge and the Bar; the reserved zone includes it Decided (D49); replaces the Bar Margin
Reserve Reserve space: on or off. The shell computes Exclusive_Zone (the size across the Edge plus the Gap) Decided (key name accepted 2026-10-29); rule decided (only on TOP)
Exclusive_Zone The raw tre value, for an exact figure Rule decided; key accepted 2026-10-29
Keyboard NONE, ON_DEMAND or EXCLUSIVE Decided (key name accepted 2026-10-29)
Input_Region Whole, nothing, rectangles or auto Decided (key name accepted 2026-10-29)
Attach_To, Meld With Attach_To a Frame, a Bar melds when its Gap on the Frame-facing side is 0, and does not when the Gap is above 0; with no Frame there is no meld (D62). Meld: true draws a melded Bar inside the Frame's surface instead of in a window of its own; a thicker Frame edge (a strip) does the same job Decided (key name accepted 2026-10-29); the mechanism is decided (Frame > Hosted melding (decided 2026-10-27))
Visible true (the default) starts the Bar shown; false starts it hidden. The opposite of the earlier Hidden Decided (key name accepted 2026-10-29; renamed from Hidden, 2026-11-02)
Auto_Hide Slide out after the delay when the pointer leaves; default true Decided (on by default, opt-out, 2026-10-27)
Auto_Hide_Delay The delay in milliseconds Decided that it exists; default 1000 ms proposed
Reveal_Key (removed 2026-11-17: see the note under this table) A keyboard shortcut that reveals the Bar; default none Decided (default none, 2026-10-27); key accepted 2026-10-29
Text_Rotation Rotate text on a vertical Bar; default off Decided (opt-in, 2026-10-27); key accepted 2026-10-29
Animation Slide or fade, with a duration Decided (key name accepted 2026-10-29)

Warning

Reveal_Key is removed (code session's report of tess-shell PR #59, 2026-11-17) A Bar is always shown and Auto_Hide is not built, so Reveal_Key only registered a Show_<Bar> shortcut that did nothing. The shell removes the key: a Bar that still writes it gets the error removed-key at the key, with a hint to delete it. The schema export goes from 1.9 to 1.10, a removal and not an addition. The key returns with Auto_Hide, the hover strip and the reveal, which is a larger piece of work that the maintainer decides (Global Shortcuts, Validation and Errors).

The Bar has no Margin and no raw Anchor or Size: the shell computes tre's anchor, size and margin from the placement keys (Geometry). Padding is allowed, as on every element that has Children (Common Keys and Conventions).

Bar {
    Name: Top_Bar
    Layer: TOP
    Edge: TOP
    Width: EXPAND
    Height: 32
    Reserve: true
    Style: TopBar_Style.tdl
    Children {
        FlexBox {
            Name: Top_Bar_Row
            Flex: HORIZONTAL
            Children {
                Workspaces { }
                Spacer { }
                Clock { }
                Spacer { }
                Tray { }
            }
        }
    }
}

Bar {
    Name: Dock
    Layer: TOP
    Edge: BOTTOM
    Width: 560
    Height: 64
    Alignment: CENTER
    Gap: 8
    Reserve: true
    Children {
        Tasks { }
    }
}

An illustration only. The module names (Workspaces, Tray, Tasks) are v1 modules whose specs are not written; Reserve is a proposal. Reserve: true is a bare word that the parser keeps as a string and the key's declared type turns into a boolean (ADR-0014 Shell File Language > Decisions on the Open Items (2026-10-30), D2), and a module use is written with the module's name as the head (Module File > Using a Module). The dock reserves 72 px: its height of 64 plus its Gap of 8.

Python Contract

A Bar has no Python of its own. Modules in it receive use records with the Bar's monitor (Module Context > Uses). A module can show or hide the Bar through shell actions, as for a Panel (Panel > Python contract).

Integration

  • tre: a LayerWindow with layer, anchor, size, exclusive_zone, exclusive_edge, margin, keyboard, input_region (live through set() in one commit), margin animation, and output bound to the monitor (TRE-REQ-001 Layer Surface Window). A change to output or namespace means reopening the window.
  • Threads: window operations on the loop thread (Process Model and Threading).
  • Coexistence with the Plasma panel. plasmashell's panel reserves space too. Decided 2026-10-27: the Bar wins over a Plasma panel unless that panel is set to always on top, or a window is fullscreen (Surface Types > Fullscreen and maximised windows (decided 2026-10-27)); this is about fullscreen, not maximised. On the same edge the compositor stacks the zones in an order the shell does not control, so how the Bar wins is #needs-verification; different edges or monitors avoid it. The maintainer's Edge Shell design used a per-monitor mode (shell, Plasma, both, none).
  • Memory: about 18 MiB for a 1280 x 32 bar on tre 0.5.8; one surface per bar per monitor (TRE-REQ-001 Layer Surface Window > Delivered (tre #195 closed)).

Design

  • The look is a style file, stylesheet or an inline Style block over the root container: background, border, corner radius, shadow, opacity (Style, Theme and Stylesheet Files > Rules).
  • A Bar matches the rest of the shell's surface elements (decided 2026-10-27): the same tokens, the same style keys and the same corner, border and shadow rules as a Panel and the Frame (Style Schema); a Bar has no look of its own.
  • Shadows: a surface cannot draw outside its own bounds. A Bar with a shadow is a larger transparent surface; the zone covers the body only and input_region follows the body (ADR-0010 Surface Shadows, decided 2026-10-27).
  • Rounded corners on a full-span bar are drawn with the container's corner radius; a bar that melds into the Frame uses Path blocks (Frame > Melding).

Accessibility

  • tre publishes the Bar as one window of the application; the bar's window node has no accessible name yet, so the shell sets the surface name (TRE-REQ-001 Layer Surface Window > Delivered (tre #195 closed)).
  • Every module in it is keyboard-reachable. A hidden or auto-hidden Bar needs a keyboard way to reveal it (a global shortcut or a shell action).
  • Reduced motion: show and hide are instant (Goals and Non-Goals G7).
  • Auto-hide is on and the keyboard reveal is off by default (maintainer, 2026-10-27), so a keyboard-only user has no way to reveal the Bar until they set Reveal_Key. Open: whether the shell warns at first start, or reveals the Bar when it takes keyboard focus (Auto-hide (decided 2026-10-27)).

Performance Budget

  • A Bar draws no frames at idle and wakes the loop only for its modules' timers.
  • Sliding is margin animation: one small commit per step, no buffer change; the zone changes once, at the start or the end, not per frame.
  • Budgets are set in 60 Quality/.

Failure Modes and Recovery

Failure Result
Exclusive_Zone on a layer other than TOP Error at load naming the file, the Bar and the key
A size of 0 on the axis it is attached along The Bar is not created; a warning names the Bar and says to set Min_Height or Min_Width. Checked at creation only
The zone does not include the Gap Windows overlap the gap; the shell computes the zone from the size across the Edge and the Gap to avoid it
A corner-anchored Bar with a zone and no exclusive_edge Reserves nothing; a warning event says so
The monitor is removed The Bar closes (output_removed); recreated when the monitor returns
Two reserving surfaces on one edge The compositor decides the order

Open Questions

  • The placement keys: Edge, Width, Height, the Max_ and Min_ bounds, Alignment, Offset and Gap; they replace Span, Length, Thickness, Margin and the raw Anchor and Size (maintainer, 2026-10-30).
  • The mapping of Edge, Width, Height, Alignment, Offset and Gap to tre is accepted (maintainer, 2026-10-31, D61), under Geometry. A hidden or peeking Bar keeps its size and slides by a negative margin, so a size of 0 never arises. Open, #needs-verification: the points listed under the mapping table.
  • Movable: no, a Bar is anchored and a movable surface is a Panel. Floating: a Bar with a Gap looks floating but stays attached and its gap space is reserved (maintainer, 2026-10-27).
  • Auto-hide: on by default with opt-out, a default delay the user can change, keyboard reveal none by default (maintainer, 2026-10-27). Open: the default delay value, the hover strip's thickness, and the reveal key's key name (Reveal_Key).
  • The Plasma panel on the same edge: the Bar wins, unless the Plasma panel is always on top or a window is fullscreen (maintainer, 2026-10-27). Open: how, and how KWin orders two zones on one edge. #needs-verification
  • A vertical Bar: a FlexBox with a vertical direction; text rotation is opt-in (maintainer, 2026-10-27). Open: the Text_Rotation values.
  • Shadow keys: Elevation, Shadow and Shadow_Bleed (Style Schema > Shadow keys, accepted 2026-10-27).

Acceptance Criteria

  • A full-span top Bar with a zone of 32 makes a maximised window stop 32 px below the top edge on KWin.
  • A dock with a Gap of 8 and a Height of 64 sets a zone of 72 and keeps maximised windows 72 px above the edge, the same as a flush Bar of that total size.
  • A Bar on BOTTOM or OVERLAY with an Exclusive_Zone is a load error.
  • A top Bar with Height: EXPAND resolves to Max_Height, else Min_Height, else 0; at 0 it is not created and the warning names Min_Height.
  • A Bar or Frame strip that is hidden or contracted can still be shown or expanded; the zero-size check does not stop it.
  • A Bar on each of two monitors appears on both, and unplugging one removes only its Bar.
  • Auto-hide is on with no key written; Auto_Hide: false keeps the Bar visible. The Bar slides out after the delay, then sets the zone to 0, and windows reflow once; the pointer at the edge brings it back.
  • With Reveal_Key unset, no key reveals the Bar; with it set, the key does.
  • A left or right Bar lays out vertically with unrotated text; Text_Rotation turns rotation on.
  • A fullscreen window covers the Bar; a maximised window stops at it.
  • An idle Bar draws no frames between module updates.