Commit graph

7695 commits

Author SHA1 Message Date
blinxen
af55e39143
Merge d18bf0f261 into 47ec005a58 2026-06-13 11:19:10 +01:00
Francesco
47ec005a58
man: mark opacity as runtime-only command
opacity is registered in command_handlers[] and requires a container in
handler_context. Using it directly in the config file results in
"Unknown/invalid command 'opacity'". It must be used via swaymsg,
bindsym, or for_window.

Fixes #9100
2026-06-13 11:50:23 +02:00
Scott Leggett
97c342f9e1 swaybar/tray: fix heap buffer overflow in read_pixmap
Validate that the icon pixel data array size accommodates the provided
dimensions.
2026-06-03 00:41:40 +02:00
llyyr
3302f1ce5c sway/server: advertise xdg-decoration-v1 version 2
Ref: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5385
2026-05-31 10:15:31 +02:00
Scott Leggett
f1b40bc288 seatop_move_tiling: fix stack overflow when dropping container into itself
This change avoids a cyclic reference in the window tree when dragging a
container and dropping it into one of its descendants.

The drop target resolution logic previously only checked if the target node
was the container itself, but missed checking if the target was a descendant
of the dragged container.

Fixes: #7949
2026-05-25 13:36:44 +02:00
Konstantin Pospelov
3cb86e4a2a input/seat: check only the last output workspace on focus
`seat_set_workspace_focus()` contains two references to the "last
workspace":
- `last_workspace` is the last focused workspace on all outputs.
- `new_output_last_ws` is the last focused workspace on the new
  workspace output.

They are the same when using a single output, but with multiple outputs
they can diverge: `last_workspace` will be the focused workspace on the
previous output, `new_output_last_ws` will be the previously focused
workspace on the current output.

This confusion seems to have led to #9139 when `last_workspace` was used
instead of `new_output_last_ws`.

However, we can safely drop `last_workspace` and use
`new_output_last_ws` for everything that `seat_set_workspace_focus()`
does:
- Calling `node_set_dirty()` on the new output.
- Calling `wlr_ext_workspace_handle_v1_set_active()` on the last
  workspace (this fixes #9139).
- Skip `workspace_consider_destroy()` on `last_workspace`, since the
  other output still has it focused.

This commit also renames `new_output_last_ws` to `last_workspace` to
keep the name simple.
2026-05-24 21:25:05 +02:00
Furkan Sahin
3774506bd0 seatop_move_tiling: clamp edge thresholds to parent box
When a fullscreen view is present on a workspace that has panels (e.g. a
bar with exclusive zone), the view's content geometry extends beyond the
workspace's usable area. The edge-detection thresholds computed from the
view's content_x/content_width could then lie outside the parent
container's box, causing the indicator width or height to become
negative. This triggered an assertion in wlr_scene_rect_set_size.  Fix
this by clamping the threshold coordinates to the parent container's
boundaries before using them to size the drop indicator.

fixes #9102
2026-05-24 20:48:30 +02:00
Scott Leggett
abb959602f tree/workspace: fix unwrapping children to avoid redundant split
Before this change, with `workspace_layout tabbed`, moving T[app app] to
an empty workspace resulted in T[T[app] T[app]], as each child was
individually wrapped in a new split container.

It looks like commit 92891fb1 introduced workspace_unwrap_children to
fix an issue where moving a tabbed/stacked container to a new workspace
with workspace_layout tabbed would incorrectly nest the container,
creating T[T[app app]].

However, workspace_unwrap_children used workspace_add_tiling to add the
detached children to the workspace. Since commit ece6a1d4,
workspace_add_tiling checks for a configured default_layout and if it
finds one, calls container_split for every added window.

This commit changes the unwrapping logic to use
workspace_insert_tiling_direct instead of workspace_add_tiling,
avoiding the default_layout splitting behaviour.
2026-05-24 20:40:33 +02:00
Orestis Floros
e52c14d535 i3-compat: swaybar: default to first bar-id
When launching swaybar from the command line without a --bar-id flag,
default to the first configured bar.

This is a mirror of i3 PR https://github.com/i3/i3/pull/4231.

This makes it easier to call swaybar from the command line since the
majority of swaybar users have only one bar configured.
2026-05-23 12:47:45 +02:00
MATHIP6
9c663b1fa1 Fix typo in README.fr.md
Corrected a typographical error in the documentation regarding the usage
of 'man 5 sway'. Updated 'pour' to 'sur' for better clarity.
2026-05-14 09:08:50 +02:00
Jan Palus
0bf8731114 man: update drag_lock default
ref. #8800

Fixes #9119
2026-05-10 13:03:02 +02:00
Furkan Sahin
c857ca3a97 tree/workspace: fix crash on dragging container to workspace edge
When a container is moved, `finalize_move` previously assumed that
calling `workspace_split` would always result in a workspace with exactly
1 child (the wrapper container). Consequently, it safely assumed that
inserting a container with `after = 1` was always valid.

However, if the moved container was the only child of its workspace,
calling `container_detach` drops the workspace's tiling length to 0.
Calling `workspace_split` on an empty workspace simply changes its
layout enum and returns, leaving the length at 0. Passing `after`
(which evaluates to 1 when moving right/down) into
`workspace_insert_tiling` then causes an out-of-bounds insertion and a
subsequent segmentation fault during `container_build_representation`.

This commit fixes the issue by dynamically calculating the insertion
index based on the actual length of the workspace's tiling list at the
moment of insertion, rather than overloading the `after` boolean flag
as a hardcoded index.
2026-04-26 16:31:54 +02:00
llyyr
1084d2e87a sway/desktop/transaction: skip freeing dirty nodes
This fixes a race that causes UAF when turning on multiple outputs after
they've been off for a while.

When output_begin_destroy is called while a transaction that references
the output is in-flight, node_set_dirty adds the node to
server.dirty_nodes list and ntxnrefs is still held by that transaction.
Once the transaction completes and ntxnrefs drops to 0,
transaction_destroy frees the output, leaving a dangling pointer in
server.dirty_nodes. The next transaction_commit_dirty call then walks
the dirty_nodes list and crashes

The fix is to skip the free in transaction_destroy if node->dirty is
set, this means transaction_commit_dirty hasn't processed this node yet
and will bump ntxnrefs shortly. The free will happen once that
transaction completes and ntxnrefs reaches 0 again and
transaction_commit_dirty will allocate a fresh instruction and
increment ntxnrefs again when it processes the node.
2026-04-26 11:23:20 +02:00
Hugo Osvaldo Barrera
1cbb8a440f Ignore failures creating linux-drm-syncobj
Failures creating this global are non-fatal.

Fixes: 1606311553
Fixes: https://github.com/swaywm/sway/issues/9110
2026-04-23 15:38:35 +02:00
Hugo Osvaldo Barrera
80a940a992 Treat ext-workspace-v1 as privileged
And do not expose it to clients in security contexts.

Fixes: https://github.com/swaywm/sway/issues/9120
2026-04-23 15:37:52 +02:00
llyyr
91c662fa59 sway/server: chase wlroots!5327
Ref: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5327
2026-04-22 22:18:50 +02:00
Furkan Sahin
9a5f09c867 input/seat: fix drag-and-drop regression and improve popup dismissal 2026-04-18 00:54:51 +02:00
Vladimir Panteleev
d18bf0f261 fix(swaybar/dbusmenu): cache icon lookups to avoid repeated filesystem access
Add caching for icon lookups in menu items. Two new fields are added to
the menu item struct:
- icon_surface: cached icon surface loaded from icon_name
- icon_lookup_done: tracks whether icon lookup has been attempted

The icon is now looked up once and cached, rather than performing
filesystem access every time the menu is drawn. The cached surface is
properly cleaned up when the menu is destroyed.
2026-04-17 20:10:00 +02:00
Vladimir Panteleev
33f2e590ed fix(swaybar/dbusmenu): properly destroy cairo surface for icon data
Properly destroy cairo surface for icon data when freeing dbusmenu
items.
2026-04-17 20:10:00 +02:00
Vladimir Panteleev
d4d295daf3 fix(swaybar/dbusmenu): fix null pointer dereference when loading icons
This change adds a null check when loading icons in the dbusmenu
code to avoid a segmentation fault when the icon surface fails to load.
2026-04-17 20:10:00 +02:00
blinxen
6c06a96efc Remove unused includes 2026-04-17 20:10:00 +02:00
blinxen
d550ece996 Rename dbusmenu functions to adhere to the style guide 2026-04-17 20:10:00 +02:00
blinxen
5e53b74295 Limit recursion depth when trying to find items under dbus menu 2026-04-17 20:10:00 +02:00
blinxen
3d26398e89 Remove comment that should be now obsolete 2026-04-17 20:10:00 +02:00
blinxen
0bf2a6e480 Close dbus menu when unregistering sni 2026-04-17 20:10:00 +02:00
blinxen
70d5a6778b Initialize surface height with 0 before drawing 2026-04-17 20:10:00 +02:00
blinxen
8eedcd651e Move variable creation outside of conditional code block
See https://github.com/swaywm/sway/pull/8405#discussion_r1818100461
2026-04-17 20:10:00 +02:00
blinxen
7a1837eb3b Replace old usage of background-image.h
See https://github.com/swaywm/sway/pull/8405#discussion_r1817770755 and https://github.com/swaywm/sway/pull/8405#discussion_r1817770817
2026-04-17 20:10:00 +02:00
blinxen
40fffa3d27 Remove trailing whitespace 2026-04-17 20:10:00 +02:00
Giancarlo Razzolini
a5d85dfda1 Apply suggestions from code review
Co-authored-by: Demi Marie Obenour <demiobenour@gmail.com>
2026-04-17 20:10:00 +02:00
Florian Franzen
65919a7b24 Tray: don't invoke dbus menu when tray is disabled 2026-04-17 20:10:00 +02:00
Felix Weilbach
86022e223d Tray: Implement dbusmenu
Co-authored-by: Ian Fan <ianfan0@gmail.com>
Co-authored-by: Nathan Schulte <nmschulte@gmail.com>

Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de>
2026-04-17 20:10:00 +02:00
Furkan Sahin
136765a530 input/seat: end keyboard grab when clearing focus
When focus leaves a surface, ensure any active keyboard grab is
terminated. This prevents stale xdg-popup grabs from persisting
after the popup is destroyed, which could otherwise cause keyboard
input to remain stuck on the old window.

fixes #8919
2026-04-17 18:08:22 +02:00
someever
e51f9d7183 Fix typos in sway-ipc.7.scd
Some sections of the man page were difficult to understand. This fixes
several typos and grammatical errors.
2026-04-12 19:49:33 +02:00
Alexander Orzechowski
81246fc6dc container: Move foreign toplevel enter/leave events to view
It made sense to put it on the container level because the protocol cares
about the toplevel and that includes its decorations. But, this breaks
down when we consider if the container's view is fullscreen and the container
decorations are disabled. Moving it to the view manages this expected lifetime
better. Since the buffer is now part of the view, the buffer will get
negative coordinates to act as if it's part of the container when we
want to.

A known issue is that we will send spurious leave/enter events while
we reconfigure the scene for entering/exiting fullscreen. The fix for
this loops back to atomic updates to scene and that is outside of the scope
of this commit.

Fixes: #9000
2026-04-12 13:46:38 +02:00
Hugo Osvaldo Barrera
1606311553 Don't ignore initialisation errors
server_init ignores all errors. In practice, theses result in a
segfault, potentially much later and losing any unsaved work.

Properly handle initialisation errors and bail immediately.
2026-04-10 13:13:42 +02:00
Hugo Osvaldo Barrera
909a2ddb5f Centre fullscreen surfaces smaller than output
Sway renders fullscreen surfaces smaller than the output left-aligned.

From xdg-shell:

> If the surface doesn't cover the whole output, the compositor will
> position the surface in the center of the output and compensate with
> with border fill covering the rest of the output. The content of the
> border fill is undefined, but should be assumed to be in some way that
> attempts to blend into the surrounding area (e.g. solid black).

Render surfaces smaller than the output centred. Can be tested easily
with:

    weston-simple-egl -f -r

Fixes: https://github.com/swaywm/sway/issues/8845
2026-03-26 18:41:48 +01:00
Simon Ser
ec7e0186e0 build: bump version to 1.13-dev 2026-03-26 16:30:37 +01:00
Hugo Osvaldo Barrera
f50f78c0d9 ext-workspace-v1: initial implementation
Maintain a 1:1 relationship between workspace groups and outputs, so
that moving a workspace across groups effectively moves it across
outputs.

ext_workspace_handle_v1::id is never emitted; sway has no concept of ids
or of stable vs temporary workspaces. Everything is ephemeral to the
current session.

ext_workspace_handle_v1::coordinates is never emitted; sway does not
organise workspaces into any sort of grid.

ext_workspace_handle_v1::assign is mostly untested, because no client
current implements this. Perhaps it's best to not-advertise the feature
for now?

Deactivating a workspace is a no-op. This functionality doesn't really
align with sway, although it could potentially be implemented to "switch
to previous workspace on this output" as a follow-up.

Removing a workspace is a no-op.

Implements: https://github.com/swaywm/sway/issues/8812
2026-03-24 17:25:33 +01:00
Hugo Osvaldo Barrera
7ba11d6dee Make workspace_move_to_output reusable
Move workspace_move_to_output out of the command handler, so it can be
re-used for ext_workspace_handle_v1::assign.
2026-03-24 17:25:33 +01:00
llyyr
131045ce55 sway_text_node: properly check cairo_t status in text_calc_size
cairo_create never returns NULL, so the previous null check never
triggered. Use cairo_status instead.
2026-03-21 11:18:26 +01:00
llyyr
dea166a27c common/pango: use pangocairo directly instead of cairo_create(NULL)
We never need a cairo context for anything here. Use
pango_cairo_font_map_get_default() and pango_font_map_create_context()
directly instead of bootstrapping via a nil cairo context.

Same as last commit, but just a cosmetic fix in this case since we don't
actually use the cairo context for anything
2026-03-21 11:18:26 +01:00
llyyr
e4870d84a2 sway_text_node: fix cairo_create without a backing surface
This fixes sway not being able to draw text on text nodes.

cairo_create(NULL) returns a nil object in an error state rather than
NULL, causing the null check to never trigger and passing a broken cairo
context to get_text_size, which was fine until 40e1dcd29f adding error
handling to it and causing pango_cairo_update_layout to fail with a NULL
pointer.
2026-03-21 11:18:26 +01:00
Stephane Fontaine
8378c560c1 call disable container in arrange_root 2026-03-20 22:53:22 -04:00
Félix Poisot
82227d6103 common/pango: get_text_size out pointers may be NULL
Fixes: 2c2a2ec380
Closes: https://github.com/swaywm/sway/issues/9082
2026-03-20 09:51:55 +01:00
llyyr
85a4b19ac4 build: bump wlroots version
Upstream bumped to 0.21.0-dev 627da39e76
2026-03-19 16:24:39 -04:00
Simon Ser
40e1dcd29f common/pango: add error handling to get_text_size()/render_text()
Closes: https://github.com/swaywm/sway/issues/9054
2026-03-19 16:23:20 -04:00
Simon Ser
9d0dbe66c3 common/pango: log on get_text_size()/render_text() format failure 2026-03-19 16:23:20 -04:00
Simon Ser
2c2a2ec380 common/pango: ensure we return zero on get_text_size() error
Avoid leaving out pointers undefined.
2026-03-19 16:23:20 -04:00
Alexander Orzechowski
6d25b100a2 Chase wlroots!3879
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3879
2026-03-14 10:51:57 +01:00