Skip to content

feat(panels): add per-panel anchor bar for source-less panel opens - #4091

Open
Excelsies wants to merge 1 commit into
noctalia-dev:mainfrom
Excelsies:feat/per-panel-anchor-bar
Open

feat(panels): add per-panel anchor bar for source-less panel opens#4091
Excelsies wants to merge 1 commit into
noctalia-dev:mainfrom
Excelsies:feat/per-panel-anchor-bar

Conversation

@Excelsies

@Excelsies Excelsies commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Adds an optional *_anchor_bar per panel under [shell.panel], consulted only when neither the global anchor nor a source bar resolved a bar:

shell.panel_anchor_bar  ->  source bar  ->  per-panel *_anchor_bar  ->  first enabled bar
[shell.panel]
launcher_anchor_bar = "Bottom"

Covers all six panels (launcher, clipboard, control_center, wallpaper, session, polkit) to stay symmetric with the existing *_placement / *_position families.

This is purely additive: it only fills the branch that previously fell through to "first enabled bar", so b6d1987's precedence and every existing configuration behave exactly as before.

Motivation

resolvePanelBarConfig() resolves a panel's bar from shell.panel_anchor_bar, then the opening source bar. Panels opened via a keybind, the CLI or IPC pass no sourceBarName, so with neither set the lookup falls through to "first enabled bar".

With multiple bars that means a panel whose widget lives on one bar opens attached to a different one. Concretely: a launcher widget on a bottom bar opens attached to the bottom bar when clicked, but noctalia msg panel-toggle launcher from a keybind opens it attached to the top bar.

shell.panel_anchor_bar can force a bar, but it is global and deliberately overrides the source bar for every panel (b6d1987), so it cannot fix one panel without relocating the rest.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Build / packaging

Related Issue

Closes #4090

Testing

Commands run:

  • meson setup build --buildtype=release && ninja -C build — clean build
  • Recompiled the three changed translation units and checked output: no new warnings or errors
  • just format (clang-format 22.1.8)
  • python3 tools/i18n-check.pyOK: 892 tr keys, 7 trp base keys — all present in catalog (2555 entries).
  • meson test -C buildNo tests defined.

Manual testing on a two-bar setup (top bar default, bottom bar Bottom, left/right bar Side; launcher widget on Bottom), with no shell.panel_anchor_bar set and launcher_anchor_bar = "Bottom":

Action Result
launcher via keybind / IPC attaches to the bottom bar (surface y=774..1388, bottom bar at y=1375)
control-center via keybind / IPC unchanged, still the top bar (y=34..674)
clicking the launcher bar widget unchanged
all *_anchor_bar unset behaviour identical to current main

Cross-checked the config layer: the stock 5.0.0-beta.9 build reports shell.panel.launcher_anchor_bar: unknown setting, the patched build validates it.

Manual Coverage

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors

Notes on the unchecked boxes: only Hyprland 0.56.2 was available to me, so Niri and Sway are untested. Bars at top, bottom, left and right were all present and exercised, but I did not vary density settings, so I left that box unchecked rather than half-claim it. Scaling was covered across two monitors at 1.0 and 1.5.

Screenshots / Videos

The only UI surface is a new "Anchor Bar" select in each panel's settings group, next to that panel's existing Placement / Position controls, with an empty option for the default.

anchor-bar-setting

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format with clang-format v22+ installed, or this PR has no code changes.
  • I ran the relevant build or test commands, or explained why they were not run.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I will update end-user documentation after merge, or this PR does not change user-facing configuration or behavior.
  • I added or updated assets/translations/en.json, or this PR adds no new user-facing strings.
  • I did not edit non-English translation files unless this PR is explicitly for translation tooling, an import/export sync, or a maintainer-requested locale change.
  • I used the existing canonical names for config keys, IPC names, paths, and identifiers.

Additional Notes

  • Naming follows the existing per-panel families, so the keys read launcher_anchor_bar, control_center_anchor_bar, and so on, matching launcher_placement / launcher_position.
  • panelAnchorBarForPanel() mirrors the existing openNearClickEnabledForPanel() in the same file rather than introducing a new dispatch pattern.
  • Registered with stringIfNonEmptyField, so unset values are not serialised and existing configs round-trip unchanged.
  • Happy to narrow this to the launcher alone, or to flip the precedence so the per-panel value outranks the source bar, if either fits the project's intent better.

Panels opened by a keybind, the CLI or IPC carry no source bar, so
resolvePanelBarConfig() falls through to the first enabled bar. With
multiple bars that means a panel whose widget lives on one bar opens
attached to a different one.

shell.panel_anchor_bar can force a bar, but it is global and overrides
the source bar for every panel (b6d1987), so it cannot be used to fix
a single panel.

Add an optional *_anchor_bar per panel under [shell.panel], consulted
only when neither the global anchor nor a source bar resolved a bar:

  shell.panel_anchor_bar -> source bar -> per-panel *_anchor_bar -> first enabled bar

This is purely additive; it fills the case that previously fell through,
so existing configurations and the b6d1987 precedence are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Per-panel anchor bar for panels opened without a source bar (keybind/CLI/IPC)

1 participant