/* SPDX-License-Identifier: MIT * * The important rule in this file is `.viewport { background: transparent }`. * * That element is a hole. The compositor paints the real Wayland client into * whatever screen rect it occupies, on a layer above the web view, so anything * painted there by CSS is simply covered. Give the frame around it a border or * a shadow — but never give the hole a background, or you are drawing pixels * that will never be seen while paying to composite them. * * The second thing worth knowing: the tiling tree renders to nested flexboxes, * so the browser computes every window rectangle. The shell measures the * result rather than calculating it. */ :root { color-scheme: dark; --bg: #14161b; --border: #2a3040; --border-focus: #7aa2f7; --text: #e7e9ee; --muted: #8b92a3; --gap: 8px; --bar: 30px; --radius: 6px; --tab: 24px; /* Short enough that it never feels like waiting, long enough to read as motion rather than a jump. Ease-out: fast off the mark, settling at the end, which is what makes a short duration feel unhurried. */ --anim: 130ms; --ease: cubic-bezier(.2, .8, .2, 1); } /* Motion is decoration. Anyone who has asked the system for less of it gets none, and the layout still works exactly the same. */ @media (prefers-reduced-motion: reduce) { :root { --anim: 0ms; } } * { box-sizing: border-box; } html, body { height: 100%; margin: 0; overflow: hidden; /* the desktop never scrolls */ /* Family name as fontconfig reports it: "FiraCode Nerd Font", with no space between Fira and Code. "Fira Code NerdFont" matches nothing, and the fallback has no Material Design glyphs, so every bar icon renders as a tofu box. Check with: fc-list : family | grep -i nerd */ font: 13px/1.4 "FiraCode Nerd Font", "FiraCode Nerd Font Mono", "Symbols Nerd Font", "Fira Code", ui-monospace, monospace; color: var(--text); } body { /* The compositor clears to transparent and the web view is the bottom layer, so this gradient is the actual desktop background. */ background: radial-gradient(70rem 50rem at 20% -10%, #263047, transparent), radial-gradient(50rem 40rem at 90% 110%, #1d2a2a, transparent), var(--bg); } /* Positioned per output from JS, in layout coordinates. */ .desktop { position: absolute; overflow: hidden; /* Space claimed by layer-shell panels (waybar and friends) through their exclusive zones. The compositor measures it and sends it per output; the bar and the tiling area both sit inside what is left. Zero when nothing has reserved anything, which is the common case. */ --rsv-top: 0px; --rsv-right: 0px; --rsv-bottom: 0px; --rsv-left: 0px; } /* --------------------------------------------------------------------- * Bar * ------------------------------------------------------------------ */ .bar { position: absolute; inset: var(--rsv-top) var(--rsv-right) auto var(--rsv-left); height: var(--bar); display: flex; align-items: center; justify-content: space-between; padding: 0 .5rem; background: #0f1116e6; border-bottom: 1px solid #ffffff12; user-select: none; } .desktop.bar-hidden .bar, .desktop.has-fullscreen .bar { display: none; } .bar-left, .bar-right { display: flex; align-items: center; gap: .35rem; } .workspaces { display: flex; gap: .25rem; } .workspaces button { min-width: 1.9rem; padding: .1rem .45rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; } .workspaces button:hover { background: #ffffff14; } .workspaces button.active { background: var(--border-focus); color: #10141c; } /* Hosted by the other monitor: it exists, but not here. */ .workspaces button.elsewhere { opacity: .45; } .taskbar { display: flex; gap: .25rem; margin-left: .5rem; padding-left: .5rem; border-left: 1px solid #ffffff14; } .taskbar button { max-width: 16rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: .1rem .5rem; border: 0; border-radius: 4px; background: #ffffff0d; color: var(--muted); font: inherit; cursor: pointer; } .taskbar button.focused { background: #ffffff24; color: var(--text); } /* Active binding mode, e.g. RESIZE. Hidden in the default mode. */ .mode { padding: .1rem .5rem; border-radius: 4px; background: #f7768e; color: #10141c; font-weight: bold; } .mode[hidden] { display: none; } .module { color: var(--muted); padding: 0 .35rem; white-space: nowrap; } .module.clock { color: var(--text); } /* A module with nothing to say takes no space, rather than showing a gap. */ .module:empty { display: none; } /* --------------------------------------------------------------------- * Tiling * * Split containers are flexboxes; leaves are windows. Nesting these is what * produces an i3-style tree, and the browser does all the arithmetic. * ------------------------------------------------------------------ */ .windows { position: absolute; inset: calc(var(--bar) + var(--rsv-top)) var(--rsv-right) var(--rsv-bottom) var(--rsv-left); padding: var(--gap); } .desktop.bar-hidden .windows { inset: var(--rsv-top) var(--rsv-right) var(--rsv-bottom) var(--rsv-left); } /* Fullscreen fills the output: no bar, no gap, no border. */ .desktop.has-fullscreen .windows { inset: 0; padding: 0; } /* No `gap`: the space between children is a real .divider element so it can be grabbed and dragged. */ .split { display: flex; width: 100%; height: 100%; min-width: 0; min-height: 0; transition: flex-grow var(--anim) var(--ease); } .split.horizontal { flex-direction: row; } .split.vertical { flex-direction: column; } /* flex-grow comes from each node's weight; flex-basis 0 stops content from biasing the split, which is what makes two terminals come out equal. */ .split > * { flex-basis: 0; flex-shrink: 1; min-width: 0; min-height: 0; } /* The draggable edge between two windows. It occupies what would otherwise be a CSS gap, and never grows. */ .divider { flex: 0 0 var(--gap); align-self: stretch; } .split.horizontal > .divider { cursor: col-resize; } .split.vertical > .divider { cursor: row-resize; } .divider:hover { background: #ffffff14; border-radius: 3px; } /* --------------------------------------------------------------------- * Tabbed and stacked containers * * One window visible, the rest behind a strip of titles. This is the only * place the shell draws a title at all: without one there is nothing to tell * two collapsed tabs apart. Tabs run across the top; stacked runs one title * per row, which is the only difference between the two in sway as well. * ------------------------------------------------------------------ */ .split.tabbed, .split.stacked { flex-direction: column; } .tabs { display: flex; flex: 0 0 auto; gap: 2px; padding-bottom: var(--gap); } .split.stacked > .tabs { flex-direction: column; } .tab { flex: 1 1 0; min-width: 0; height: var(--tab); padding: 0 .5rem; border: 1px solid var(--border); border-radius: 4px; background: #1b1f28; color: var(--muted); font: inherit; font-size: .78rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; } .split.stacked > .tabs > .tab { flex: 0 0 var(--tab); } .tab.active { border-color: var(--border-focus); background: #232a38; color: var(--text); } /* The selected tab's contents fill whatever the title strip left. */ .tab-body { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; } .tab-body > * { flex: 1 1 auto; } /* --------------------------------------------------------------------- * Overview * * Every workspace at once. Each thumbnail contains the workspace's real tree, * rendered at output size and scaled down — so the miniature is the layout, * not a drawing of it. The windows inside are real surfaces the compositor * shrinks on our behalf. * ------------------------------------------------------------------ */ .overview { position: absolute; inset: 0; display: grid; gap: calc(var(--gap) * 2); padding: calc(var(--gap) * 2); /* Dim the wallpaper so the thumbnails read as a layer above the desktop rather than as more windows on it. */ background: #0b0d12cc; animation: overview-in 140ms cubic-bezier(.2, .8, .2, 1); } @keyframes overview-in { from { opacity: 0; } to { opacity: 1; } } .thumb { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: #0f1116; cursor: pointer; transition: border-color var(--anim) var(--ease), box-shadow var(--anim) var(--ease), background var(--anim) var(--ease); } .thumb:hover { border-color: #55617d; background: #141821; } /* The workspace you are on, and the one the pointer is over, are different things and both worth seeing at a glance. */ .thumb.current { border-color: var(--border-focus); box-shadow: 0 0 0 1px var(--border-focus), 0 .5rem 1.5rem #0006; } /* An empty workspace should say so rather than looking like a failed render. */ .thumb.empty-workspace::after { content: "empty"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: #4a5165; pointer-events: none; } .thumb-label { position: absolute; top: .3rem; left: .4rem; z-index: 2; min-width: 1.25rem; padding: .05rem .35rem; border-radius: 4px; background: #0b0d12cc; font-size: .72rem; line-height: 1.4; text-align: center; color: var(--muted); pointer-events: none; } .thumb.current .thumb-label { background: var(--border-focus); color: #0b0d12; } /* Full output size, shrunk. The origin matters: scaling about the centre would push the contents out of the thumbnail. Clipped, so the shell's own painting stays inside the cell — the compositor is told separately to crop the surfaces, which CSS cannot reach. */ .thumb-inner { position: absolute; top: 0; left: 0; overflow: hidden; transform-origin: top left; } /* Windows in a thumbnail are miniatures: their focus ring would be a thick coloured band at this size, and their shadows just mud. */ .thumb .window { border-width: 1px; border-radius: 3px; box-shadow: none; cursor: grab; } /* Being carried to another workspace. Only the frame can show this — the window's contents are a surface the compositor draws, and no style here reaches it. */ .thumb .window.dragging-overview { cursor: grabbing; border-color: var(--border-focus); opacity: .85; } /* An output that is not showing the overview shows nothing at all, rather than a stale layout whose windows have been moved into someone else's grid. */ .desktop.overview-active .empty { display: none; } /* --------------------------------------------------------------------- * Scrolling layout (niri) * * An endless row of fixed-width columns that slides left and right. The * container clips it and the strip itself is translated — no real scrollbar, * because the position is decided by which window has focus rather than by * dragging. * ------------------------------------------------------------------ */ .windows.scrolling { overflow: hidden; } /* A transform makes the strip the containing block for anything positioned inside it, which would anchor a fullscreen window to the scrolled strip rather than to the output. Fullscreen therefore stops the scrolling. */ .desktop.has-fullscreen .strip { transform: none !important; } .strip { display: flex; align-items: stretch; height: 100%; width: max-content; /* No `gap`: like a split, the space between columns is a real .divider so the edge can be grabbed. */ transition: transform var(--anim) var(--ease); } .strip > .divider { cursor: col-resize; } /* Fixed width, set per column from its preset. Columns never flex: that is what stops a new window from reflowing the ones already open. */ .column { flex: 0 0 auto; height: 100%; min-width: 0; display: flex; transition: width var(--anim) var(--ease); } /* Dragging a column edge sets the width directly; interpolating fights the pointer. */ .strip.dragging .column { transition: none; } .column > * { flex: 1 1 auto; min-width: 0; } .window { border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; /* What actually moves. `flex-grow` covers tiled windows sharing a split; left/top/width/height cover floating ones, which are positioned. The compositor follows along because the shell resamples geometry every frame while any of this is running — see pumpGeometry. */ transition: transform var(--anim) var(--ease), flex-grow var(--anim) var(--ease), left var(--anim) var(--ease), top var(--anim) var(--ease), width var(--anim) var(--ease), height var(--anim) var(--ease), border-color var(--anim) var(--ease); } /* Mid-FLIP: the window has just been offset back to where it came from, and that jump must not itself animate. Cleared in the same frame, after a forced reflow, which is what starts the slide. */ .window.flipping { transition: none; } /* A window being dragged must track the pointer exactly. Interpolating toward the cursor lags it by the whole duration and feels like ice. */ .window.dragging { transition: none; } .window.focused { border-color: var(--border-focus); } /* Floating windows are marked in the taskbar so the list still reflects the layout when one is hidden behind another. */ .taskbar button.floating { font-style: italic; } /* The hole. No background — see the note at the top of this file. */ .viewport { flex: 1 1 auto; min-width: 0; min-height: 0; background: transparent; } /* Fullscreen covers the output entirely, bar included, like sway. */ .window.fullscreen { position: absolute; /* !important because a floating window carries its rect as inline style, and fullscreen has to win over it without the JS having to strip and restore those properties. */ inset: 0 !important; left: 0 !important; top: 0 !important; width: auto !important; height: auto !important; z-index: 10; border: 0; border-radius: 0; } /* Floating: positioned rather than laid out, and above everything tiled. The rect itself comes from inline styles the shell sets per window. */ .window.floating { position: absolute; z-index: 5; box-shadow: 0 .5rem 1.5rem #0008; } /* Hidden on another workspace: kept in the DOM so the client stays alive. */ .window[hidden], .split[hidden] { display: none; } /* --------------------------------------------------------------------- * Empty state * ------------------------------------------------------------------ */ .empty { position: absolute; inset: var(--bar) 0 0 0; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); pointer-events: none; } .empty h1 { margin: 0 0 .25rem; font-size: 1.1rem; color: var(--text); } .empty[hidden] { display: none; } .empty pre { margin-top: .75rem; padding: .6rem .9rem; border-radius: 8px; background: #0d0f13; font-size: .85rem; text-align: left; } /* --------------------------------------------------------------------- * Notifications * * The compositor claims org.freedesktop.Notifications and forwards each one * here, so these are ordinary elements rather than another program's windows. * Which means their appearance is this stylesheet, live-reloadable like the * rest of the shell. * ------------------------------------------------------------------ */ #notifications { position: fixed; top: calc(var(--bar) + var(--gap)); right: var(--gap); z-index: 100; display: flex; flex-direction: column; gap: var(--gap); width: 22rem; max-width: 30vw; pointer-events: none; } .notification { pointer-events: auto; padding: .6rem .7rem; border: 1px solid var(--border); border-left: 3px solid var(--border-focus); border-radius: var(--radius); background: #161a22f2; box-shadow: 0 .5rem 1.5rem #0007; cursor: pointer; animation: notification-in 160ms cubic-bezier(.2, .8, .2, 1); } @keyframes notification-in { from { opacity: 0; transform: translateX(1rem); } to { opacity: 1; transform: none; } } @media (prefers-reduced-motion: reduce) { .notification { animation: none; } } /* Low urgency recedes; critical asks to be dealt with and, per the specification, never expires on its own. */ .notification.urgency-0 { border-left-color: #4a5165; opacity: .9; } .notification.urgency-2 { border-left-color: #f7768e; } .notification-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .15rem; } .notification-app { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } .notification-close { border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; padding: 0 .15rem; } .notification-close:hover { color: var(--text); } .notification-summary { font-weight: 600; } .notification-body { margin-top: .2rem; font-size: .85rem; color: #c3c8d4; /* Notification bodies can be arbitrarily long; a wall of text pushes everything else off the screen. */ max-height: 8rem; overflow: hidden; } .notification-actions { display: flex; gap: .35rem; margin-top: .5rem; } .notification-actions button { flex: 1 1 auto; padding: .25rem .5rem; border: 1px solid var(--border); border-radius: 4px; background: #1b1f28; color: var(--text); font: inherit; font-size: .8rem; cursor: pointer; } .notification-actions button:hover { border-color: var(--border-focus); }