Skip to content

display: snap monitors to aligned centers in the arrangement view - #384

Open
ggiesen wants to merge 1 commit into
linuxmint:masterfrom
ggiesen:display-center-snap
Open

display: snap monitors to aligned centers in the arrangement view#384
ggiesen wants to merge 1 commit into
linuxmint:masterfrom
ggiesen:display-center-snap

Conversation

@ggiesen

@ggiesen ggiesen commented Jun 26, 2026

Copy link
Copy Markdown

What

In the Display arrangement panel, dragging a monitor now also snaps to positions that align its center with an adjacent monitor's center -- both stacked (top/bottom) and side by side (left/right) -- alongside the existing edge snaps.

Why

Currently only edges snap, so two monitors of different sizes cannot be centered relative to each other by dragging; you can only line up their top/bottom or left/right edges. A centered-but-abutting arrangement is a valid layout (muffin accepts it), so this is a UI-only gap.

How

Four center-aligned candidates are added in find_best_snapping() (panels/display/cc-display-arrangement.c) as SNAP_DIR_BOTH peers of the existing edge candidates:

  • stacked: the dragged monitor's center-x aligned to the other's, at its top or bottom edge;
  • side by side: the dragged monitor's center-y aligned to the other's, at its left or right edge.

Prior art

GNOME's gnome-control-center added the stacked (horizontal-edge) center-snap in commit 3070866d ("display-arrangement: Add center-aligned snapping for horizontal edges", 2026-06-22). This brings that case to Cinnamon and additionally adds the side-by-side (vertical-edge) center case, which GNOME does not have.

Testing

Built and drag-tested on Linux Mint 22 (Cinnamon, X11): a smaller monitor now snaps to vertically-centered when placed beside a larger one, and horizontally-centered when stacked, in addition to the edge snaps. No backend change required.

When dragging a monitor in the Display arrangement panel, also offer
snap positions that align the dragged monitor's center with an adjacent
monitor's center -- both stacked (top/bottom) and side by side
(left/right). Until now only edges snapped, so two monitors of
different sizes could not be centered relative to each other by
dragging, even though muffin accepts the resulting centered-but-abutting
layout as valid.

This adds four center-aligned candidates in find_best_snapping(),
alongside the existing edge candidates. The stacked (horizontal-center)
case matches the approach gnome-control-center took; the side-by-side
(vertical-center) case extends the same idea to the vertical axis.
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.

1 participant