aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
AgeCommit message (Collapse)Author
2021-02-25Fix for_window criteria and mouse button bindingsftilde
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.
2021-02-25focus: beyond fullscreen when focused explicitlylbonn
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.
2021-02-16container: Move pending state to state structKenny Levinsen
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.
2021-02-14input: Only commit transactions when necessaryKenny Levinsen
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.
2021-02-04Declare all struct cmd_handler arrays constManuel Stoeckl
And make the functions handling these arrays use const types.
2021-01-04cmd_move: update container representation in sibling swapsRonan Pigott
2020-12-20commands/move: reset geometry of promoted containersRonan Pigott
2020-12-20commands/move: squash workspace after directional con moveRonan Pigott
2020-12-20commands/move: rework container_move_in_directionRonan Pigott
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.
2020-12-20Revert "commands/move: maintain workspace_layout when moving"Ronan Pigott
This is in preparation for changing the workspace_layout command to work like it does in i3. This reverts commit b4a75a1ab2a72842830aeea37733311f85e6f660.
2020-12-20commands/move: don't flatten on move; reap empty former parent insteadTudor Brindus
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]]
2020-12-20commands/layout: don't change the layout of workspaces with childrenRonan Pigott
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.
2020-12-20container: don't split single childrenRonan Pigott
In i3 splits are ineffective on singleton H/V containers, and the command is interpreted to affect the parent layout instead.
2020-12-06input/cursor: unhide cursor on synthetic inputTudor Brindus
Fixes #5847.
2020-11-11tree/container: introduce `container_is_sticky[_or_child]` functionsTudor Brindus
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.)
2020-11-01commands/focus: force container warp when fulfilling `focus mode_toggle`Tudor Brindus
This commit switches focusing behavior to force a warp when executing `focus mode_toggle`. Fixes #5772.
2020-10-30hide_cursor: Add an option to hide when typingTamir Zahavi-Brunner
Add an option for the `hide_cursor` command to hide the cursor when typing, i.e. whenever a key is pressed.
2020-10-24commands/move: fix crash when moving sphsc childRonan Pigott
2020-10-22commands/resize: don't consider 1px resizes to be invalidDaniel De Graaf
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.
2020-10-12input/tablet: add tool_mode option to set tablet tools as relative inputTudor Brindus
Closes #4139.
2020-10-11Add support for workspace_min_width bar option.Tarmack
2020-10-04commands/move: fix single-split escaping on moveTudor Brindus
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.
2020-08-24exec: fix validation during config reloadKonstantin Pospelov
Split cmd_exec_always into separate methods for general validation and process creation. This fixes a potential call of join_args with 0 arguments.
2020-08-03fix force_display_urgency_hint parsingRex Hackbro
2020-07-30Fix incorrect format specifiersAntonin Décimo
2020-07-30cmd/bar/colors: fix dereference of null pointerAntonin Décimo
`!*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`.
2020-07-27Use wlr_output_layout_output_at to get output for move to cursorThayne McCombs
2020-07-27Keep windows in bounds on move to position mouseThayne McCombs
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
2020-07-21added ppt unit to move position commandNils Schulte
2020-07-21moved and renamed movement-unit parsing to commonNils Schulte
2020-07-07Reload command now matches i3's implementationGeoffrey Casper
2020-07-03commands/move: maintain workspace_layout when movingTudor Brindus
Fixes #5157.
2020-07-01commands/move: unwrap workspace container on move to new workspaceTudor Brindus
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.
2020-06-19input_cmd_click_method: fix typo in error textTudor Brindus
2020-05-29seat_cmd_cursor: emit frame eventsBrian Ashworth
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.
2020-05-13commands: Add per-view shortcuts_inhibitor commandMichael Weiser
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>
2020-04-21Restrict relative output transforms to runtime changesSimon Ser
Prevent them from being used in the config file. This is a breaking config file change. References: https://github.com/swaywm/sway/issues/5236
2020-04-14Fix a use-after-free error in switch bindingDi Ma
2020-04-14Fix a use-after-free error in switch bindingDi Ma
2020-04-14Implement create_output command for headless backendSimon Ser
2020-03-30add --no-repeat option for bindingsLinus Heckemann
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
2020-03-24check for workspace command name argr-c-f
* 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.
2020-03-15commands/bind.c: remove unnecessary checkJason Nader
2020-03-11commands: Adjust style in cursors commandMichael Weiser
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>
2020-03-11commands: Add shortcuts_inhibitor commandMichael Weiser
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>
2020-03-11input: Add support for keyboard shortcuts inhibitMichael Weiser
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>
2020-03-11input: implement cycling through keyboard layout listBor Grošelj Simić
2020-03-07Add an adaptive_sync output commandSimon Ser
This enables/disables adaptive synchronization on the output. For now, the default is disabled because it might cause flickering on some hardware if clients don't submit frames at regular enough intervals. In the future an "auto" option will only enable adaptive sync if a fullscreen client opts-in via a Wayland protocol.
2020-02-18treewide: fix typosTorstein Husebø
2020-02-18input_cmd_events: add support for input typesBrian Ashworth
This adds support for input type configs to input_cmd_events. This works similar to the wildcard handling that existed where configs for the devices are stored and the type config is reset to INT_MIN so that it does not override. This also condenses the toggle_send_events and toggle_wildcard_send_events functions into a single function to reduce code duplication.