Skip to content
Merged
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ commit-message convention that feeds this file.

### Fixed

- Keep maximized windows clear of the right stack panel while preserving
full-width Waybar, including after panel toggles and Waybar restarts.
- Give every bar module a black resting background and the same subtle hover
highlight, including power, clock and workspace buttons.

- **Silence stopped being indexed as content.** 150 of the 4 132
`telegram-voice` points were not speech: whisper answers a silent round
video with `""`, one of its own labels (`[Music]`, `(footsteps)`), or a
Expand Down
6 changes: 5 additions & 1 deletion configs/niri/config.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ layout {

struts {
left 0
right 28
// The stack panel reserves its own layer-shell exclusive zone.
right 0
top 0
bottom 0
}
Expand Down Expand Up @@ -328,3 +329,6 @@ binds {
Mod+Print { screenshot-screen write-to-disk=true; }
Mod+Shift+Print { screenshot-window write-to-disk=true; }
}

// Preserve window rules supplied by the ASUS DialPad driver when installed.
include optional=true "../asus-dialpad-driver/niri-dialpad.kdl"
14 changes: 3 additions & 11 deletions configs/systemd/user/sy-stack-bar.service
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,9 @@ Type=notify
NotifyAccess=main
WatchdogSec=300s
TimeoutStartSec=300s
# Wait for waybar
# to register its top exclusive zone before our wlr-layer-shell
# surface attaches. Otherwise niri hasn't deducted waybar's 24-px
# strip yet, and the bar's `Right | Top | Bottom` anchor straddles
# the top edge — producing the "right panel disappeared" symptom
# (the bar is actually drawn beneath waybar). The pgrep loop
# mirrors what the legacy niri spawn-at-startup did before the bar
# was promoted to a unit; folding it into the unit lets us drop
# the niri-side spawn so there is exactly one owner with
# `Restart=on-failure` supervision.
ExecStartPre=/usr/bin/bash -c 'until pgrep -x waybar >/dev/null; do sleep 0.05; done; sleep 0.3'
# Wait for Waybar's layer surface, not merely its process. Mapping it
# first gives Waybar the full top edge before our right reservation.
ExecStartPre=/usr/bin/bash -c 'until niri msg --json layers | jq -e ".[] | select(.namespace == \\"top\\")" >/dev/null 2>&1; do sleep 0.05; done'
ExecStart=%h/.local/bin/sy stack bar
Restart=on-failure
RestartSec=2s
Expand Down
4 changes: 4 additions & 0 deletions configs/systemd/user/sy-waybar.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ After=graphical-session.target
[Service]
Type=simple
ExecStart=/usr/bin/waybar
# Re-map the right panel after every Waybar start, including crash recovery.
# Its exclusive zone must be registered after Waybar's full-width top zone.
# Do not wait here: the panel is ordered After=this service.
ExecStartPost=/usr/bin/systemctl --user --no-block try-restart sy-stack-bar.service
Restart=on-failure
RestartSec=2s

Expand Down
30 changes: 10 additions & 20 deletions configs/waybar/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}

window#waybar {
background: @bg_soft;
background: @bg;
color: @fg;
border: none;
}
Expand All @@ -44,13 +44,11 @@ tooltip {
#workspaces button {
padding: 0 8px;
color: @fg;
background: transparent;
border-bottom: 2px solid transparent;
transition: all 150ms ease;
}

#workspaces button:hover {
background: @bg1;
color: @fg;
box-shadow: none;
text-shadow: none;
Expand All @@ -63,8 +61,7 @@ tooltip {
}

#workspaces button.urgent {
color: @bg;
background: @red;
color: @red;
border-bottom: 2px solid @red;
}

Expand Down Expand Up @@ -103,21 +100,16 @@ tooltip {
color: @yellow;
padding: 0 12px;
margin-left: 8px;
background: @bg1;
}

#network:hover,
#custom-agents:hover,
#custom-notif:hover,
#custom-bt:hover,
#custom-sy-gpu:hover,
#custom-sy-npu:hover,
#custom-sy-disk:hover,
#custom-sy-silent:hover,
#custom-sy-vol:hover,
#custom-sy-bl:hover,
#custom-sy-profile:hover,
#custom-sy-knowledge:hover {
/* Workspace buttons are controls; their parent is only a container. */
.module:not(#workspaces),
#workspaces button {
background: @bg;
}

.module:not(#workspaces):hover,
#workspaces button:hover {
background: @bg1;
}

Expand Down Expand Up @@ -224,7 +216,6 @@ tooltip {
color: @fg;
padding: 0 12px;
margin-right: 4px;
background: @bg1;
}

#cpu,
Expand All @@ -245,7 +236,6 @@ tooltip {

/* --- Bottom cheatsheet bar ---------------------------------------------- */
window#waybar.cheatsheet {
background: alpha(@bg_soft, 0.85);
color: @fg_dim;
border: none;
border-top: 1px solid @bg1;
Expand Down
13 changes: 13 additions & 0 deletions crates/sy-desktop-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,18 @@ for the runtime session, including after a drop or clipboard-history refresh.
The receiving application handles insertion, quoting, or attaching the file.
Dragging uses copy semantics and retains the source item.

The panel reserves 28 logical pixels through layer-shell, so maximized windows
leave its controls visible. Hiding the panel releases that space. Waybar maps
first to keep the full top edge; its service remaps the panel after each restart.

With the black theme, every bar module and workspace button is black at rest
and uses the same subtle hover highlight. Text and borders retain status colors.

To check geometry without changing the live desktop, build the executable and
run `python3 scripts/check-stack-panel-layout.py` from the repository root.
This requires Niri, Waybar, Foot, Xvfb, jq and a systemd user manager. It starts
disposable services and a nested compositor, checks maximize, hide/show,
fullscreen and repeated Waybar restarts, then stops its test processes.

Verification: `cargo test -p sy-desktop-shell --all-targets` and
`cargo clippy -p sy-desktop-shell --all-targets -- -D warnings`.
67 changes: 40 additions & 27 deletions crates/sy-desktop-shell/src/stack/bar/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,21 @@ use crate::stack::{
};

/// Width of the bar's vertical strip on the right edge.
/// Niri's right strut reserves this width for tiled windows. The surface
/// itself does not reserve a layer-shell zone, so Waybar spans the top edge.
/// A layer-shell exclusive zone protects this strip from tiled and
/// maximized-to-edges windows. Waybar must register before this surface.
const BAR_WIDTH: u32 = 28;

fn bar_settings(visible: bool) -> LayerShellSettings {
LayerShellSettings {
size: Some(if visible { (BAR_WIDTH, 0) } else { (1, 1) }),
exclusive_zone: if visible { BAR_WIDTH as i32 } else { 0 },
anchor: Anchor::Right | Anchor::Top | Anchor::Bottom,
margin: (WAYBAR_TOP_MARGIN, 0, 0, 0),
layer: Layer::Top,
start_mode: StartMode::Active,
..Default::default()
}
}
/// Waybar's `"height"` from `configs/waybar/config.jsonc`. Used by
/// the hover-preview surface to translate the bar-local cursor y
/// back to screen-space (the bar's surface starts at y=24).
Expand All @@ -80,6 +92,8 @@ const HOVER_POPUP_WIDTH: u32 = 320;
/// Height of the hover preview popup. Sized to fit a 256×256 image
/// thumbnail plus a 32-px header strip.
const HOVER_POPUP_HEIGHT: u32 = 300;
/// Hover margins are screen coordinates, including the panel and Waybar offsets.
const HOVER_EXCLUSIVE_ZONE: i32 = -1;
/// Edge length of the thumbnail rendered inside the hover popup
/// (vs. the 20-px inline thumbnails on the bar itself).
const HOVER_THUMB_PX: f32 = 256.0;
Expand Down Expand Up @@ -362,21 +376,7 @@ pub fn run() -> anyhow::Result<()> {
.subscription(subscription)
.settings(Settings {
with_connection: Some(connection.into()),
layer_settings: LayerShellSettings {
size: Some((BAR_WIDTH, 0)),
// Niri's right strut reserves tiled space. Reserving a
// layer-shell zone here would shorten Waybar at the top.
exclusive_zone: 0,
anchor: Anchor::Right | Anchor::Top | Anchor::Bottom,
// (top, right, bottom, left) per layershellev's
// `LayerSurface::set_margin` signature.
// `WAYBAR_TOP_MARGIN = 0` defers vertical positioning
// to niri's deduction of waybar's top exclusive zone.
margin: (WAYBAR_TOP_MARGIN, 0, 0, 0),
layer: Layer::Top,
start_mode: StartMode::Active,
..Default::default()
},
layer_settings: bar_settings(true),
..Default::default()
})
.run()
Expand Down Expand Up @@ -480,15 +480,12 @@ fn update(bar: &mut Bar, msg: Msg) -> Task<Msg> {
bar.visible = !bar.visible;
// Resize the bar surface; note: needs the bar's Id.
if let Some(bid) = bar.bar_id {
let (anchor, size, zone) = if bar.visible {
(
Anchor::Right | Anchor::Top | Anchor::Bottom,
(BAR_WIDTH, 0),
0,
)
} else {
(Anchor::Right | Anchor::Top | Anchor::Bottom, (1, 1), 0)
};
let settings = bar_settings(bar.visible);
let (anchor, size, zone) = (
settings.anchor,
settings.size.unwrap(),
settings.exclusive_zone,
);
return Task::done(Msg::AnchorSizeChange {
id: bid,
anchor,
Expand Down Expand Up @@ -710,7 +707,7 @@ fn update(bar: &mut Bar, msg: Msg) -> Task<Msg> {
size: Some((HOVER_POPUP_WIDTH, HOVER_POPUP_HEIGHT)),
layer: Layer::Overlay,
anchor: Anchor::Top | Anchor::Right,
exclusive_zone: Some(0),
exclusive_zone: Some(HOVER_EXCLUSIVE_ZONE),
margin: Some((margin_top, BAR_WIDTH as i32 + 4, 0, 0)),
keyboard_interactivity: KeyboardInteractivity::None,
output_option: OutputOption::LastOutput,
Expand Down Expand Up @@ -1434,6 +1431,22 @@ mod tests {
}
use std::path::PathBuf;

#[test]
fn visible_panel_reserves_its_width_for_maximized_windows() {
assert_eq!(bar_settings(true).exclusive_zone, BAR_WIDTH as i32);
}

#[test]
fn hidden_panel_releases_its_reserved_space() {
assert_eq!(bar_settings(false).exclusive_zone, 0);
assert_eq!(bar_settings(false).size, Some((1, 1)));
}

#[test]
fn hover_preview_does_not_count_panel_reservations_twice() {
assert_eq!(HOVER_EXCLUSIVE_ZONE, -1);
}

#[test]
fn waybar_top_margin_does_not_double_count_niri_deduction() {
// Niri deducts waybar's 24-px top exclusive zone from this
Expand Down
11 changes: 0 additions & 11 deletions crates/sy-desktop-shell/src/waybar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ pub fn reload() {
.status();
if matches!(restart, Ok(status) if status.success()) {
println!(" ↻ waybar restarted");
let stack_active = Command::new("systemctl")
.args(["--user", "is-active", "--quiet", "sy-stack-bar.service"])
.status();
if matches!(stack_active, Ok(status) if status.success()) {
let stack_restart = Command::new("systemctl")
.args(["--user", "restart", "sy-stack-bar.service"])
.status();
if !matches!(stack_restart, Ok(status) if status.success()) {
eprintln!(" ! could not restart sy-stack-bar.service");
}
}
} else {
eprintln!(" ! could not restart sy-waybar.service");
}
Expand Down
5 changes: 5 additions & 0 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5996,6 +5996,11 @@ commit-message convention that feeds this file.

#### Fixed

- Keep maximized windows clear of the right stack panel while preserving
full-width Waybar, including after panel toggles and Waybar restarts.
- Give every bar module a black resting background and the same subtle hover
highlight, including power, clock and workspace buttons.

- **Silence stopped being indexed as content.** 150 of the 4 132
`telegram-voice` points were not speech: whisper answers a silent round
video with `""`, one of its own labels (`[Music]`, `(footsteps)`), or a
Expand Down
3 changes: 2 additions & 1 deletion packaging/sy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Requires: sy = %{version}-%{release}
Requires: sy-desktop-shell = %{version}-%{release}
Requires: fuzzel
Requires: foot
Requires: niri
Requires: niri >= 26.04
Requires: jq
Requires: swaylock
Requires: waybar
Requires: python3
Expand Down
Loading
Loading