aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
Commit message (Collapse)AuthorAge
* Define _POSIX_C_SOURCE globallyLibravatar Simon Ser2024-02-23
| | | | See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
* commands: make primary_selection a config-only commandLibravatar Simon Ser2024-02-05
| | | | It's not possible to switch this at runtime.
* Use format_str() throughoutLibravatar Simon Ser2023-04-14
|
* commands: add printf attribute to cmd_results_new()Libravatar Simon Ser2023-04-14
| | | | And fix the resulting build failures.
* Make cmd_handler.command constLibravatar Carl Smedstad2023-01-03
|
* Add `primary_selection` config optionLibravatar Aidan Dang2022-12-05
| | | | | | | | | | | | See: https://github.com/swaywm/sway/issues/4511 Adds a bool config option `primary_selection`, which explicitly enables/disables the primary selection clipboard. Defaults to enabled. This is implemented as a launch-only option which enables or disables the creation of the `zwp_primary_selection_device_manager_v1` global. Co-authored-by: Tilde Rose <t1lde@protonmail.com>
* Allocate enough space for `cmd_results->error`Libravatar kraftwerk282022-06-16
|
* sway: add bindgesture commandLibravatar Florian Franzen2022-05-30
| | | | Co-authored-by: Michael Weiser <michael.weiser@gmx.de>
* Add focused_tab_titleLibravatar Vsevolod2021-12-10
|
* commands: Remove unused code after 1d3681f52135Libravatar Evgeniy Khramtsov2021-10-01
| | | | | | | | | | | | Clang 13 reports: ../sway/commands.c:470:23: error: variable 'context' set but not used [-Werror,-Wunused-but-set-variable] enum command_context context = 0; ^ Last use of was removed in commit 1d3681f52135. Downstream PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258813
* 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.
* 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.
* Declare all struct cmd_handler arrays constLibravatar Manuel Stoeckl2021-02-04
| | | | And make the functions handling these arrays use const types.
* commands: disallow runtime includeLibravatar Ronan Pigott2020-07-27
|
* Remove code related to the security featuresLibravatar Érico Rolim2020-05-21
| | | | | | - Remove struct definitions - Remove struct members - Remove initializations and frees
* 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>
* criteria: match containers without viewLibravatar Anders2020-02-04
| | | | | | | | Closes #4929 Replaces criteria_get_views with criteria_get_containers which can return containers without views when the criteria only contains container properties.
* bar_cmd_colors: remove add_colorLibravatar Brian Ashworth2019-12-28
| | | | | | | | | | | | This is the third commit in a series of commits to refactor color handling in sway. This removes add_color from commands.c. It was only being used by bar_cmd_colors. This also changes the functions to use parse_color which is used to validate rgb(a) colors throughout the code base and is also what i3bar is using to parse the colors after they are passed over ipc. After parsing the color and ensuring it is valid, the rgba hex string is then generated using snprintf. This refactor also ensures that all the colors for the command are valid before applying any of them.
* view: add max_render_timeLibravatar Ivan Molodetskikh2019-11-17
|
* Fix various memory leaksLibravatar lbonn2019-11-01
| | | | Found with clang-tidy
* ipc: collapse multi-container command resultsLibravatar Laurent Bonnans2019-08-22
| | | | | | | | | Match i3's behavior and only return one status response per command, even if it applies to several nodes. Also returns an error if the criteria returns an empty match. Closes #4483
* config: fix find_handler logicLibravatar Brian Ashworth2019-06-20
| | | | | | | | | | Without this change, the handlers listed in the config_handlers or command_handlers arrays (depending on reading or active) in commands.c would be valid subcommands. To make matters worse, they would also take precedence over the defined subcommand handlers. This corrects find_handler to only work on the handler array given instead of implicitly trying others.
* Fix segfaults caused by faulty command parsingLibravatar Matt Coffin2019-06-11
| | | | | | | | | | | | | | | | This patch fixes faulty command parsing introduced by f0f5de9a9e87ca1f0d74e7cbf82ffceba51ffbe6. When that commit allowed criteria reset on ';' delimeters in commands lists, it failed to account for its inner ','-parsing loop eating threw the entire rest of the string. This patch refactors argsep to use a list of multiple separators, and (optionally) return the separator that it matched against in this iteration via a pointer. This allows it to hint at the command parser which separator was used at the end of the last command, allowing it to trigger a potential secondary read of the criteria. Fixes #4239
* criteria: reset on semicolon separationLibravatar Brian Ashworth2019-06-05
| | | | | | This matches i3's behavior of only retaining criteria across comma separated commands. When separating commands with a semicolon, the criteria is reset and allows for new criteria to be set, if desired.
* Add unbindswitch commandLibravatar Alex Maese2019-04-17
|
* Create unbindsym and unbindcode commandsLibravatar Alex Maese2019-04-17
|
* Add deprecation warnings for new_float, new_window, and force_focus_wrapping.Libravatar Connor E2019-04-14
|
* Implement inhibit_idle commandLibravatar Brian Ashworth2019-03-24
| | | | | | | | | | | | | | | | | | | | | | This implements the following command to set/unset a user idle inhibitor for a view: `inhibit_idle focus|fullscreen|open|none|visible` The modes are as follows: - focus: inhibited when the view is focused by any seat - fullscreen: inhibited when the view is fullscreen (or a descendant of a fullscreen container) and is visible on any output - open: inhibited until the view is closed or the inhibitor is unset or changed - none: unsets any user set idle inhibitors for the view - visible: inhibited when the view is visible on any output This should have no effect on idle inhibitors set by the applications themselves and those should still work as intended. Since this operates on the view in the handler context, it is possible to set it on the currently focused view, on any existing view with criteria, or for any future view with for_window.
* Fix #3924Libravatar Philipe Goulet2019-03-24
| | | | | | | | | | Removes "unescape_string(argv[i]);". Since "do_var_replacement(argv[i])" never adds escape characters, it is both wrong and unnecessary to remove escape characters on the next line. This caused characters that were meant to be escaped to not be anymore.
* Support WLR_INPUT_DEVICE_SWITCH in swayLibravatar Ryan Walklin2019-03-19
| | | | | | | | | | | | | | | | | | | | | This commit adds support for laptop lid and tablet mode switches as provided by evdev/libinput and handled by wlroots. Adds a new bindswitch command with syntax: bindswitch <switch>:<state> <command> Where <switch> is one of: tablet for WLR_SWITCH_TYPE_TABLET_MODE lid for WLR_SWITCH_TYPE_LID <state> is one of: on for WLR_SWITCH_STATE_ON off for WLR_SWITCH_STATE_OFF toggle for WLR_SWITCH_STATE_TOGGLE (Note that WLR_SWITCH_STATE_TOGGLE doesn't map to libinput and will trigger at both on and off events)
* Fix quoting of commands passed to for_windowLibravatar minus2019-03-15
| | | | | | E.g. `for_window [class="mpv"] move container to output "Dell Inc. ..."` does not work because the executed move command only uses `Dell` as output name.
* execute_command: do not strip qoutes for cmd_modeLibravatar Brian Ashworth2019-02-26
| | | | | | | | | `cmd_mode` performs its own quote stripping for the mode string to avoid double stripping quotes for `cmd_bindcode` and `cmd_bindsym` in `config_command` and `execute_command`. Stripping quotes in `execute_command` for `cmd_mode` will also result in double stripping, which will cause issues for any mode string with spaces, such as pango markup.
* Fix quote strippingLibravatar emersion2019-02-05
| | | | Let's not use !strcmp(…) anymore.
* execute_command: dont strip quotes for exec_alwaysLibravatar Brian Ashworth2019-02-05
| | | | | | | This removes quote stripping for `exec_always` in `execute_command`. Since `exec_always` commands will be deferred in the config and processed by `execute_command`, the quotes need to be left intact like they are for `exec`.
* pointer_constraint: change to a seat subcommandLibravatar Brian Ashworth2019-01-31
| | | | | | | | | | | | This changes the `pointer_constraint` command to be a subcommand of seat to allow for per-seat settings. The current implementation that is not a seat subcommand will only operate on the current seat and will segfault in the config due to `config->handler_context.seat` only being set at runtime. This also allows for the wildcard identifier to be used to alter the pointer constraint settings on all seats and allows for the setting to be merged with the rest of the seat config.
* Add pointer_constraint commandLibravatar Drew DeVault2019-01-30
|
* Make json-c include respect pkg-config --cflagsLibravatar Jan Beich2019-01-23
| | | | | json-c.pc contains `Cflags: -I${includedir}/json-c`, so `<json-c/json.h>` won't be found unless the parent directory is searched by default.
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
* Remove now-unused "input" argument of cmd_results_newLibravatar M Stoeckl2019-01-14
| | | | | | | | | Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors.
* Remove 'input' field of IPC command return jsonLibravatar M Stoeckl2019-01-14
| | | | | | | | This field is not in i3 and provides imprecise and redundant information. (Specifically, when swaymsg is given a list of commands, the IPC return array already indicates precisely which number command failed; knowing the name of the command is not useful when multiple commands of the same type are provided.)
* Merge pull request #3144 from emersion/cmd-xwaylandLibravatar Drew DeVault2019-01-13
|\ | | | | Add xwayland command
| * Add xwayland commandLibravatar emersion2018-11-19
| |
* | Merge pull request #3275 from ianyfan/remove-readlineLibravatar emersion2019-01-08
|\ \ | | | | | | Rewrite strip_whitespace and remove readline.c
| * | stringop.c: rewrite strip_whitespaceLibravatar Ian Fan2019-01-01
| | |
* | | Implement tiling_drag_thresholdLibravatar Brian Ashworth2019-01-02
|/ / | | | | | | | | | | | | | | | | Implements `tiling_drag_threshold <threshold>` to prevent accidental dragging of tiling containers. If a container (and all of its descendants) are unfocused and the tile bar is pressed, a threshold will be used before actually starting the drag. Once the threshold has been exceeded, the cursor will change to the grab icon and the operation will switch from `OP_MOVE_TILING_THRESHOLD` to `OP_MOVE_TILING`.
* | hide_cursor: change to a seat subcommandLibravatar Brian Ashworth2018-12-30
| | | | | | | | | | This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
* | Revamp seat configsLibravatar Brian Ashworth2018-12-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes seat configs work like output and input configs do. This also adds support for wildcard seat configs. A seat config is still created in the main seat command handler, but instead of creating a new one in the subcommands and destroying the main seat command's instance, the seat subcommands modify the main one. The seat config is then stored, where it is merged appropriately. The seat config returned from `store_seat_config` is then applied. When attempting to apply a wildcard seat config, a seat specific config is queried for and if found, that is used. Otherwise, the wildcard config is applied directly. Additionally, instead of adding input devices to the default seat directly when there is no seat configs, a seat config for the default seat is created with only fallback set to true, which is more explicit. It also fixes an issue where running a seat command at runtime (with no seat config in the sway config), would result in all input devices being removed from the default seat and leaving sway in an unusable state. Also, instead of checking for any seat config, the search is for a seat config with a fallback option seat. This makes it so if there are only seat configs with fallback set to -1, the default seat is still created since there is no explicit notion on what to do regarding fallbacks. However, if there is even a single fallback 0, then the default seat is not used as a fallback. This will be needed for seat subcommands like hide_cursor where the user may only want to set that property without effecting anything else.
* | Implement hide_cursor <timeout> commandLibravatar Brian Ashworth2018-12-25
| | | | | | | | | | Allows the cursor to be hidden after a specified timeout in milliseconds
* | Cleanup list codeLibravatar Ian Fan2018-12-09
| |
* | Fix command list executionLibravatar mwenzkowski2018-12-05
| | | | | | | | | | | | | | | | | | Determine the container/workspace a command is run on, each time when a command of the command list will be run. Previously the container/workspace was determined only once at the beginning of command list execution, which led to wrong behaviour because commands wouldn't take into account when a previous command changed the focused container.