aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands
Commit message (Collapse)AuthorAge
* 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
|
* Fix a use-after-free error in switch bindingLibravatar Di Ma2020-04-14
|
* Implement create_output command for headless backendLibravatar Simon Ser2020-04-14
|
* add --no-repeat option for bindingsLibravatar Linus Heckemann2020-03-30
| | | | | | | | | This allows e.g. triggering one command while a key is held, then triggering another to undo the change performed by it afterwards. One use case for this is triggering push-to-talk functionality for VoIP tools without granting them full access to all input events. Fixes #3151
* check for workspace command name argLibravatar r-c-f2020-03-24
| | | | | | | | | | | | | | | | | | * check for workspace command name arg (fix #5131) For the 'workspace <name> output <output>' command, output_location must be greater than zero or the attempt to get the workspace name with join_args will segfault or abort() (depending on the flavor of sway_assert() in use). This checks and returns an error instead. * put workspace output error string on one line To ease grepping as requested * check for name in workspace gaps command as well A malformed command here will lead to the same result seen in #5131, so add a check. Done inside the cmd_workspace_gaps() function itself, to take advantage of the existing 'Expected...' string.
* commands/bind.c: remove unnecessary checkLibravatar Jason Nader2020-03-15
|
* commands: Adjust style in cursors commandLibravatar Michael Weiser2020-03-11
| | | | | | | Remove some unnecessary brackets in an error condition check identified during review of the shortcuts inhibitor command code (#5021). Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
* commands: Add shortcuts_inhibitor commandLibravatar Michael Weiser2020-03-11
| | | | | | | | | | | | | | | | | | | Add a command to influence keyboard shortcuts inhibitors. In its current form it can be used to activate, deactivate or toggle an existing inhibitor on the surface currently receiving input. This can be used to define an escape shortcut such as: bindsym --inhibited $mod+Escape seat - shortcuts_inhibitor deactivate It also allows the user to configure a per-seat default of whether keyboard inhibitors are honoured by default (the default) or not. Using the activate/toggle command they can then enable the lingering inhibitor at a later time of their choosing. As a side effect this allows to specifically address a named seat for actions as well, whatever use-case that might serve. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
* input: Add support for keyboard shortcuts inhibitLibravatar Michael Weiser2020-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adding support for the keyboard shortcuts inhibit protocol allows remote desktop and virtualisation software to receive all keyboard input in order to pass it through to their clients so users can fully interact the their remote/virtual session. The software usually provides its own key combination to release its "grab" to all keyboard input. The inhibitor can be deactivated by the user by removing focus from the surface using another input device such as the pointer. Use support for the procotol in wlroots to add support to sway. Extend the input manager with handlers for inhibitor creation and destruction and appropriate bookkeeping. Attach the inhibitors to the seats they apply to to avoid having to search the list of all currently existing inhibitors on every keystroke and passing the inhibitor manager around. Add a helper function to retrieve the inhibitor applying to the currently focused surface of a seat, if one exists. Extend bindsym with a flag for bindings that should be processed even if an inhibitor is active. Conversely this disables all normal shortcuts if an inhibitor is found for the currently focused surface in keyboard::handle_key_event() since they don't have that flag set. Use above helper function to determine if an inhibitor exists for the surface that would eventually receive input. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
* input: implement cycling through keyboard layout listLibravatar Bor Grošelj Simić2020-03-11
|