aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands
Commit message (Collapse)AuthorAge
* Move auto_back_and_forth logic out of workspace_switchLibravatar Ragnar Groot Koerkamp2021-06-18
| | | | | | | | This extracts the code to a separate workspace_auto_back_and_forth function. It also removes the bool argument by adding an extra if statement at the call site, and repurposes the no_auto_back_and_forth variable to auto_back_and_forth for simpler understanding.
* Fix #6299 Disable auto_back_and_forth for next_on_outputLibravatar Ragnar Groot Koerkamp2021-06-18
| | | | | | | | | | | | | | This forces no_auto_back_and_forth to true for `workspace next_on_output` and `workspace prev_on_output` to keep parity with i3. In i3, running next_on_output never changes focus to another output. In Sway currently, with workspace_auto_back_and_forth set to yet, running next_on_output on an output with only a single active workspace will typically end up focussing the other output: 1. next_on_output focusses the current workspace, because it's the only one 2. auto_back_and_forth focusses the last focussed workspace, because the current workspace to focus is the current one. This will usually be on the other monitor if the workspace there was last focussed.
* sway: commands: exec: restore SIGPIPE before exec:ingLibravatar Daniel Eklöf2021-06-05
| | | | | | | | | | | | Sway ignores SIGPIPE (by installing a SIG_IGN handler), in order to “prevent IPC from crashing Sway”. SIG_IGN handlers are the *only* signal handlers inherited in sub-processes. As such, we should be a good citizen and restore the SIGPIPE handler to its default handler. Original bug report: https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1806907.html
* config: Fix swaybar pango_markup inconsistencyLibravatar Daniel Otero2021-06-03
| | | | | | Until now, swaybar did not have pango markup enabled by default, even if the sway config had it on. This patch aims to mimic the i3 behavior, but maintaining the functionality of the "pango_markup" sway config command.
* Only defer seat attachment during initial startupLibravatar Bill Doyle2021-06-03
| | | | | | | | | Deferred commands are only run once, during sway startup. This means that deferring seat attachment based on whether we are reading the config prevents devices from being reattached to the correct seat during a config reload. Instead, only defer if the config is not yet active. Fixes #6048.
* commands/exec: stop truncating >4095-byte commandsLibravatar Manuel Stoeckl2021-05-10
|
* cmd_fullscreen: ignore fullscreen request on workspacesLibravatar Ronan Pigott2021-05-10
|
* commands/exec_always: log error on execlp failureLibravatar Simon Ser2021-04-22
| | | | And exit(1) instead of indicating success.
* Use execlp("sh") instead of execl("/bin/sh")Libravatar Simon Ser2021-04-22
| | | | This stops assuming the POSIX shell command is located in /bin.
* Prevent use-after-free on first bar subcommand errorLibravatar Michael Weiser2021-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If any error is encountered during execution of the first subcommand of a freshly created bar configuration, parsing apparently is to be aborted and the current bar config is freed. The pointer to that memory is left dangling though, leading to a use-after-free on successive bar subcommands. This quite reliably ends in a crash like so: sway -c reproducer.config 00:00:00.083 [sway/config.c:865] Error on line 2 'foo bar': Unknown/invalid command 'foo' (s) free(): double free detected in tcache 2 00:00:00.608 [swaynag/swaynag.c:451] failed to register with the wayland display Aborted (core dumped) Minimal reproducer config: bar { foo bar position top } Other messages: malloc(): unaligned fastbin chunk detected double free or corruption (fasttop) The invalid command has to be the first for a newly created bar config. Removing the command or switching order so it's not the first one masks the problem. Prevent this from occuring by resetting the pointer to NULL after freeing the memory. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
* cmd_fullscreen: allow fullscreen on fullscreen split containersLibravatar Ronan Pigott2021-04-16
| | | | | | Using the fullscreen command on a child of a fullscreen split container will now fullscreen the child instead of unfullscreening the parent.
* Add toggle logic inside DPMS handlerLibravatar Ivan Fedotov2021-03-25
| | | | | | | | | | | Logic that obtains current DPMS state is put inside the handler. sway_output from which the current DPMS state will be obtained is selected by the following logic: * For '-' and '--' the focused output is used; * For '*' error "Cannot apply toggle to all outputs" is reported; * For everything else all_output_by_name_or_id() is used. Fixes #5929.
* Fix for_window criteria and mouse button bindingsLibravatar ftilde2021-02-25
| | | | | | | | | | | | | | | | | | | Previously, the special case handling of scratchpad and unmark commands was (probably accidentally) limited to criteria directly handled in the execute_command function. This would exclude: 1. for_window criteria, as these are handled externally for views and 2. and mouse bindings which select target the node currently under the mouse cursor. As a concrete example `for_window [app_id="foobar"] move scratchpad, scratchpad show` would show (or hide due to the toggling functionality) another window from the scratchpad, instead of showing the window with app_id "foobar". This commit replaces the "using_criteria" flag with "node_overridden" with the more general notion of signifying that the node (and container/workspace) in the current command handler context of the sway config is not defined by the currently focused node, but instead overridden by other means, i.e., criteria or mouse position.
* focus: beyond fullscreen when focused explicitlyLibravatar lbonn2021-02-25
| | | | | | | When issuing a focus command on a specific container, users expect to proceed it even if is hidden by a fullscreen window. This matches the behavior of i3.
* container: Move pending state to state structLibravatar Kenny Levinsen2021-02-16
| | | | | | | | | Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
* input: Only commit transactions when necessaryLibravatar Kenny Levinsen2021-02-14
| | | | | | | | | | | There is no need to check for transactions at the end of every user input, as the vast majority of input will not issue transactions. This implementation can also hide where changes are made without an appropriate transaction commit, as a future unrelated input would issue the commit instead. Instead, commit transactions in places where changes are made or are likely to be made.
* Declare all struct cmd_handler arrays constLibravatar Manuel Stoeckl2021-02-04
| | | | And make the functions handling these arrays use const types.
* cmd_move: update container representation in sibling swapsLibravatar Ronan Pigott2021-01-04
|
* commands/move: reset geometry of promoted containersLibravatar Ronan Pigott2020-12-20
|
* commands/move: squash workspace after directional con moveLibravatar Ronan Pigott2020-12-20
|
* commands/move: rework container_move_in_directionLibravatar Ronan Pigott2020-12-20
| | | | | | | | | | This changes the move command to better match i3 behavior after the layout changes. workspace_rejigger handled the case where containers would escape their workspace in an orthogonal move by changing the layout to accomodate them, but this case is now handled within the loop.
* Revert "commands/move: maintain workspace_layout when moving"Libravatar Ronan Pigott2020-12-20
| | | | | | | This is in preparation for changing the workspace_layout command to work like it does in i3. This reverts commit b4a75a1ab2a72842830aeea37733311f85e6f660.
* commands/move: don't flatten on move; reap empty former parent insteadLibravatar Tudor Brindus2020-12-20
| | | | | | | | | | | | | | | | | | Some comparisons of current Sway versus i3 behavior: 1) T[T[T[app]]] + move left * Sway: T[app] * i3: T[T[app]] 2) H[V[H[V[app]]]] + move left * Sway: H[app] * i3: H[V[app]] After this commit, Sway behavior matches i3. The intermediate states are now: T[T[T[app]]] -> T[T[app T[]]] -> T[T[app]] H[V[H[V[app]]]] -> H[V[app H[V[]]]] -> H[V[app]]
* commands/layout: don't change the layout of workspaces with childrenLibravatar Ronan Pigott2020-12-20
| | | | | | In i3 the layout command on a workspace affects the workspace layout only on empty workspaces. Otherwise children are placed in a new container with the desired layout to preserve the workspace layout.
* container: don't split single childrenLibravatar Ronan Pigott2020-12-20
| | | | | | In i3 splits are ineffective on singleton H/V containers, and the command is interpreted to affect the parent layout instead.
* input/cursor: unhide cursor on synthetic inputLibravatar Tudor Brindus2020-12-06
| | | | Fixes #5847.
* tree/container: introduce `container_is_sticky[_or_child]` functionsLibravatar Tudor Brindus2020-11-11
| | | | | | | | | | To query whether a container is sticky, checking `con->is_sticky` is insufficient. `container_is_floating_or_child` must also return true; this led to a lot of repetition. This commit introduces `container_is_sticky[_or_child]` functions, and switches all stickiness checks to use them. (Including ones where the container is already known to be floating, for consistency.)
* commands/focus: force container warp when fulfilling `focus mode_toggle`Libravatar Tudor Brindus2020-11-01
| | | | | | | This commit switches focusing behavior to force a warp when executing `focus mode_toggle`. Fixes #5772.
* hide_cursor: Add an option to hide when typingLibravatar Tamir Zahavi-Brunner2020-10-30
| | | | | Add an option for the `hide_cursor` command to hide the cursor when typing, i.e. whenever a key is pressed.
* commands/move: fix crash when moving sphsc childLibravatar Ronan Pigott2020-10-24
|
* commands/resize: don't consider 1px resizes to be invalidLibravatar Daniel De Graaf2020-10-22
| | | | | | A "resize shrink width 1px" will cause grow_x to be 0 while grow_width is -1, incorrectly rejecting the command even though the resize is not a noop. Fix this by checking width/height instead of x/y.
* input/tablet: add tool_mode option to set tablet tools as relative inputLibravatar Tudor Brindus2020-10-12
| | | | Closes #4139.
* Add support for workspace_min_width bar option.Libravatar Tarmack2020-10-11
|
* commands/move: fix single-split escaping on moveLibravatar Tudor Brindus2020-10-04
| | | | | | | | | Prior to this commit, having a layout like T[app1 V[app2]], focusing app2, and then doing `move left` would result in T[app2 app1]. Now, the resulting layout is T[app1 app2], which matches i3 behavior. `container_flatten` updates `container->parent`, meaning that the existing check would never be true.
* exec: fix validation during config reloadLibravatar Konstantin Pospelov2020-08-24
| | | | | Split cmd_exec_always into separate methods for general validation and process creation. This fixes a potential call of join_args with 0 arguments.
* fix force_display_urgency_hint parsingLibravatar Rex Hackbro2020-08-03
|
* Fix incorrect format specifiersLibravatar Antonin Décimo2020-07-30
|
* cmd/bar/colors: fix dereference of null pointerLibravatar Antonin Décimo2020-07-30
| | | | | | `!*rgba` tests if the first byte of rgba isn't `'\0'`. `hex_to_rgba_hex` returns NULL if `parse_color` fails. There's a null pointer dereference in that case. The intended behavior is `!rgba`.
* Use wlr_output_layout_output_at to get output for move to cursorLibravatar Thayne McCombs2020-07-27
|
* Keep windows in bounds on move to position mouseLibravatar Thayne McCombs2020-07-27
| | | | | | | | | | | | | If the mouse/cursor/pointer is near the edge of an output when a "move position to pointer" command is run, then the floating container will be constrained to fit inside the bounds of the output as much as possible. This behavior matches what i3 does in this scenario. I also think it is a better user experience. Relates to #4906 The logic for the bounds check follows the implementation in i3: https://github.com/i3/i3/blob/733077822302d8b77eacb606a26fd002a42f534f/src/floating.c#L536
* added ppt unit to move position commandLibravatar Nils Schulte2020-07-21
|
* moved and renamed movement-unit parsing to commonLibravatar Nils Schulte2020-07-21
|
* Reload command now matches i3's implementationLibravatar Geoffrey Casper2020-07-07
|
* commands/move: maintain workspace_layout when movingLibravatar Tudor Brindus2020-07-03
| | | | Fixes #5157.
* commands/move: unwrap workspace container on move to new workspaceLibravatar Tudor Brindus2020-07-01
| | | | | | | | | If moving e.g. `T[app app]` into a new workspace with `workspace_layout tabbed`, then post-move the tree in that workspace will be `T[T[app app]]`. This still happens with horizontal or vertical workspace layout, but is less visible since those containers have no decorations. Fixes #5426.
* input_cmd_click_method: fix typo in error textLibravatar Tudor Brindus2020-06-19
|
* seat_cmd_cursor: emit frame eventsLibravatar Brian Ashworth2020-05-29
| | | | | | | This emits frame events for the seat_cmd_cursor subcommands. The wl_pointer frame event are required to notify clients when to process the events. It will now be emitted after cursor movement, button press, button release, and axis events.
* commands: Add per-view shortcuts_inhibitor commandLibravatar Michael Weiser2020-05-13
| | | | | | | | | | | | | | | | | | | | | Add a separate per-view shortcuts_inhibitor command that can be used with criteria to override the per-seat defaults. This allows to e.g. disable shortcuts inhibiting globally but enable it for specific, known-good virtualization and remote desktop software or, alternatively, to blacklist that one slightly broken piece of software that just doesn't seem to get it right but insists on trying. Add a flag to sway_view and handling logic in the input manager that respects that flag if configured but falls back to per-seat config otherwise. Add the actual command but with just enable and disable subcommands since there's no value in duplicating the per-seat activate/deactivate/toggle logic here. Split the inhibitor retrieval helper in two so we can use the backend half in the command to retrieve inhibitors for a specific surface and not just the currently focused one. Extend the manual page with documentation of the command and references to its per-seat sibling and usefulness with criteria. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
* Restrict relative output transforms to runtime changesLibravatar Simon Ser2020-04-21
| | | | | | | | Prevent them from being used in the config file. This is a breaking config file change. References: https://github.com/swaywm/sway/issues/5236
* Fix a use-after-free error in switch bindingLibravatar Di Ma2020-04-14
|