aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorLines
2025-03-21Avoid crashing on too many containersKenny Levinsen-12/+33
If far too many containers are created, they can become so small that their size calculations come out negative, leading to crashes on asserts. Instead, set a lower bound for sizes and disable the container entirely if it goes below it, giving whatever space it used to the last container. The splits are not recalculated, so currently the effect is that if all containers have the same width fraction, they keep getting narrower until at some point they all round to zero and the last container will be given all the available space. A better behavior would have been if the additional container did not contribute to size and fraction calculations at all, but it's an extreme edge-case, anything is better than crashing, and this is easier to implement.
2025-03-20stringop: fix has_prefix() arg order in config parsingPaul Riou-3/+3
has_prefix() expects the prefix to be the 2nd argument, not the first. The config parsing was broken when using `--input-device=`. Introduced by: 0c60d1581f7b12ae472c786b7dfe27a1c6ec9a47 "Use has_prefix() instead of strncmp() throughout"
2025-03-20text_input: Fix ime panic in ext-session-lockShootingStarDragons-0/+29
in the origin text_input.c, we only check the sway_view and layershell, but now we have the third shell named sessionlock, so we need to modify both text_input.c and view.c to handle the new type of shell
2025-03-20desktop/output: Skip repaint if wlr_output is disabledKenny Levinsen-1/+1
When the repaint timer fires, we check if the sway_output is disabled, and if so, skip the output commit after having reset frame_pending. The sway_output enable flag is only updated if the output is disabled and removed from the layout, not if the power is disabled for e.g. idle. This can lead to situations where a commit is attempted on a disabled output, which will lead to an attempted and failed primary swapchain allocation. Use the wlr_output.enabled state to check if the output is active.
2025-03-18sway/commands: Return error if container is not in scratchpadPiotr Piwoński-2/+2
2025-03-16Fix output repositioning in global fullscreenmelvinm1-0/+2
Call wlr_scene_output_set_position when in global fullscreen to correctly set output positions when repositioning outputs (using swaymsg output or similar).
2025-03-11config/output: Reset everything before swaybg execKenny Levinsen-0/+1
swaybar and the exec command reset signal masks, signal handlers and NOFILE limit before exec, but swaybg was missing all that. Reset it for swaybg as well.
2025-03-11Use SIG_IGN for SIGCHLD instead of our own handlerKenny Levinsen-18/+14
The behavior of handlers registered with signal(3p) is not well-defined for signals delivered more than once, as laid out in the man page. We should replace our use of signal with sigaction, but for SIGCHLD specifically we can also just skip the signals altogether by setting the handler to SIG_IGN which causes child reaping to not be required. Fixes: https://github.com/swaywm/sway/pull/8567
2025-03-09sway/server: create ext-data-control managerllyyr-3/+7
2025-03-08Add the DesktopNames key to the sway.desktop session filenilninull-0/+1
According to https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html, to set the value of XDG_CURRENT_DESKTOP, a DesktopNames key is required in the session file. And the value of XDG_CURRENT_DESKTOP is used to run xdg-desktop-portal*. If this value is not set, xdg-desktop-portal-wlr will not run at login.
2025-03-07Remove constraint that con->view != NULL to use __focused__ criteriaChris Perl-2/+1
To use something like: [con_id=__focused__] mark --add --toggle foo The container must currently have a view. However, it is possible to focus parent containers that do not have a view. For example, via: focus parent Since containers without views can be the focused (meaning the container is marked "focused": true in the output of: swaymsg -t get_tree), it seems reasonable that a view is not required to target a container via __focused__.
2025-03-06Rework fork/exec strategyKenny Levinsen-138/+71
cmd_exec_process is used whenever sway is meant to execute a child process on behalf of the user, and had a lot of complexity. In order to avoid having to wait on the user's process, a double-fork was used, which in turn required us to wait on the outer process. In order to track the child PID for launcher purposes, a pipe was used to transmit the PID back to sway. This resulted in sway blocking for 5-6 ms per exec on my system, which is quite significant. The error handling was also quite lacking - the read loop did not handle errors at all for example. Instead, teach sway to handle SIGCHLD and do away with the double-fork. This in turn allows us to get rid of the pipe as we can record the child's PID directly. This reduces the time we block to just 1.5 ms on my system. We'd be able to get down to just 150 µs if we could use posix_spawn(3), but posix_spawn(3) cannot reset NOFILE. clone(2) or vfork(2) would be alternatives, but that presents portability issues. This change is replicated for swaybar, swaybg and swaynag handling, which had similar albeit less complicated implementations.
2025-02-25sway_text_node: Remove use of source boxKenny Levinsen-14/+0
The source box is always set to the full buffer dimensions, making it ineffective. Remove it.
2025-02-25sway_text_node: Apply max_width when renderingKenny Levinsen-2/+2
max_width was applied to the source box, but not to the cairo surface. The cairo surface would therefore take on arbitrarily large dimensions according to the required dimensions to fit the text input, which if large enough would cause failures during output rendering and leave a black hole in the titlebar.
2025-02-25commands/opacity: Call output_configure_scene on updated containerAlexander Orzechowski-1/+3
Calling container_update() wasn't enough: If there is no visible window decorations (title bar, borders) container_update would basically no-op and the scene wouldn't repaint with the update alpha. By also calling output_configure_scene() we force a call to wlr_scene_buffer_set_opacity() thus ensuring we update the scene. Closes: #8580
2025-02-25output: Allow configuring scene without an outputAlexander Orzechowski-1/+3
2025-02-25output: Expose output_configure_scene to headerAlexander Orzechowski-1/+4
2025-02-17docs: use "window" instead of "view" throughout.Mark Stosberg-65/+65
"view" is an internal term, while the commonly understood user-facing term is "window" Ref: #7323
2025-02-16sway/ipc-json: add ext-foreign-toplevel-handle identifier to get_tree ipc outputFerdinand Bachmann-0/+12
Fixes #8291
2025-02-09output/background: fix config ignoring fallback colorFurkan Sahin-44/+38
currently, the output background command handler prematurely returns with an error if the background file cannot be accessed. It should only error if user did not provide fallback color. closes #8556 Changes - Introduce variables to avoid uneccessary writing on output members - Log a debug message when fallback is being used over inaccessible file - Always parse the background color and swaynag warn if it is incorrect - when updating output member variables, free previous values - add cleanup label and goto it if `strdup` fails - Move output->member initializations to before parsing fallback, Also free and init output->background as well
2025-02-06man: Document bar mode toggle commandDan Baterisna-0/+6
Functionality for switching swaybar's current mode between hidden and docked currently exists, but is absent from the relevant manpage.
2025-01-27input/cursor: remove tool_proximity listener in destroyAttila Fidan-0/+1
2025-01-26Drop wlr_matrix.h include from sway/desktop/output.cBill Li-1/+0
wlr_matrix is now private API. Fixes #8549
2025-01-21Add ext-image-copy-capture-v1 and ext-image-capture-source-v1Simon Ser-3/+12
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4545
2025-01-16config/output: don't leak background_fallbackllyyr-0/+1
2025-01-13swaymsg: pretty-print sandbox propertiesJacob McNamee-0/+12
2025-01-13tree/container: support sandbox properties in title formatJacob McNamee-6/+32
2025-01-13criteria: add sandbox propertiesPuck Meerburg-1/+104
2025-01-13ipc-json: add sandbox properties to view JSONPuck Meerburg-0/+22
2025-01-13tree/view: add getters for sandbox propertiesJacob McNamee-0/+35
2025-01-12Increase max default buffer size to 1 MiBJim-0/+1
Increasing the max default buffer size prevents clients from crashing when they need more than 4096 bytes. This can happen when the GUI thread of the application is blocked, especially when moving your mouse over it with high mouse sensitivity.
2025-01-11layer_shell: cleanup new_popup listener when destroying nodellyyr-0/+1
2025-01-08config/output: don't hardcode DMA-BUF in search_render_format()Simon Ser-1/+2
We could be running with a backend which doesn't support DMA-BUFs, e.g. inside a parent Wayland compositor without GPU acceleration.
2025-01-08config/output: skip format checks if all are supportedmtvare6-1/+2
Fixes #8496
2025-01-07Fix has_prefix() comparisons with 0Simon Ser-2/+2
has_prefix() returns a bool, unlike strncmp() which returns an int. Fixes: 0c60d1581f7b ("Use has_prefix() instead of strncmp() throughout") Closes: https://github.com/swaywm/sway/issues/8527
2025-01-07Use has_prefix() instead of strncmp() throughoutSimon Ser-49/+44
This is safer than hardcoded string lengths.
2025-01-07stringop: move over has_prefix()Simon Ser-4/+6
2024-12-21Explain that the title bar always showsHong Xu-3/+3
2024-12-08swaybar: Handle opaque region properlyAlexander Orzechowski-6/+11
The background color can be set individually for the different elements of the bar. If any of the backgrounds have transparency, we have to bail out from advertising an opaque surface.
2024-12-08input/libinput: fix parsing input drag_lock commandBaltazár Radics-1/+1
Regression introduced by by b160fac9f7a
2024-11-23input/libinput: fix builtin device detection logicGyörgy Kurucz-2/+2
Fixes: #8468
2024-11-23tree/container: remove output_{enter,leave} listeners in destroyViolet Purcell-0/+2
https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/0d6cc471e95c1632b234fc9152659d24fe5982f1 added an assert that all signals are clear when destroying a wlr_scene_buffer, which is currently triggering due to sway not removing the output_enter and output_leave listeners on the container before calling wlr_scene_node_destroy on output_handler. Remove the listeners before wlr_scene_node_destroy is called.
2024-11-23Add support for LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKYSimon Ser-3/+18
Use it as the default, as recommended by the libinput release notes: https://lists.freedesktop.org/archives/wayland-devel/2024-November/043860.html
2024-11-23ipc-json: handle LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKYSimon Ser-5/+8
New entry introduced in libinput 1.27.0.
2024-11-17desktop/output: Clear repaint timer earlier in destroyKenny Levinsen-1/+3
The teardown of a sway_output is split in two: begin_destroy and output_destroy. The former clears some state such as NULL'ing the reference to wlr_output, while the latter frees the struct and its remaining resources. If an output is destroyed while a repaint timer is pending, future frame callbacks will no longer occur as the listener is torn down in begin_destroy, but the repaint timer is not torn down and may still fire until output_destroy is hit. As begin_destroy cleared the reference to wlr_output, this leads to a NULL-pointer dereference. Tear down the repaint timer in begin_destroy as there is no need for it. Fixes: fdc4318ac66d ("desktop/output: Clear frame_pending even output is disabled")
2024-11-17commands/include: handle many files in single linemtvare6-5/+5
i3 supports including multiple files in a single line, whereas sway limits to single file per line.
2024-11-17ipc-server: Force modeset if needed after executing commandsKenny Levinsen-0/+11
IPC clients generally expect executed commands to have taken effect when the command completes, while delayed modeset means that it can take several milliseconds more before e.g. an output is enabled. However, modesetting on every output command in the IPC call could on systems with already slow modesetting behavior lead to an unresponsive system for a not insignificant period of time. To strike a balance, force modeset once all the commands of this IPC call have executed if a modeset is pending.
2024-11-17config: Force modeset before running deferred configsKenny Levinsen-5/+11
Some commands require outputs to be enabled. These commands are deferred to allow outputs to be discovered, but the delayed modeset might only run some time later. Force a modeset to occur before running deferred commands. Fixes: https://github.com/swaywm/sway/issues/8433
2024-11-16Fix orthographic mistakes in Hungarian READMESolt Budavári-7/+7
Fix a few mistakes so the text conforms to Hungarian orthography. The following rules were applied (the whole linked page is in Hungarian): - <https://www.helyesiras.mta.hu/helyesiras/default/akh12#110> - <https://www.helyesiras.mta.hu/helyesiras/default/akh12#112> - <https://www.helyesiras.mta.hu/helyesiras/default/akh12#113> - <https://www.helyesiras.mta.hu/helyesiras/default/akh12#215> - <https://www.helyesiras.mta.hu/helyesiras/default/akh12#244>
2024-11-11desktop/output: Clear frame_pending even output is disabledKenny Levinsen-2/+1
frame_pending should always be cleared once the repaint callback is fired to ensure that future frame scheduling is not accidentally held back.