aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands
Commit message (Collapse)AuthorAge
* floating_maximum_size: change default behaviorLibravatar Brian Ashworth2019-03-04
| | | | | | | | | | | | | This changes the way zero (which is the default) is interpreted for both the width and height of `floating_maximum_size`. It now refers to the width and height of the entire output layout, which matches i3's behavior. This also removes duplicated code to calculate the floating constraints in three files. Before this, `container_init_floating` used two-thirds of the workspace width/height as the max and the entire workspace width/height was used everywhere else. Now, all callers use a single function `floating_calculate_constraints`.
* Make load_include_configs void. Fix some cases where WD would not be restored.Libravatar Connor E2019-02-25
|
* move scratchpad: hide visible scratchpad containerLibravatar Brian Ashworth2019-02-25
| | | | | | | This makes it so running `move [to] scratchpad` on a container already in the scratchpad does not return an error. To match i3's behavior, a visible scratchpad container will be hidden and a hidden scratchpad container will be treated as a noop.
* commands/move: reintroduce wrongly removed NULL checkLibravatar Rouven Czerwinski2019-02-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit d3d7956576341bbbfb60d045175b0e8a44752e0b removed this NULL check, which leads to the following backtrace: #0 0x0000557bd201df46 in node_is_view (node=0x0) at ../sway/sway/tree/node.c:41 #1 0x0000557bd1ff5d4e in seat_get_focus_inactive (seat=0x557bd3fc7580, node=0x0) at ../sway/sway/input/seat.c:968 current = 0x557bd2033485 #2 0x0000557bd2009f24 in cmd_move_container (argc=3, argv=0x557bd46b19c0) at ../sway/sway/commands/move.c:557 new_output_last_focus = 0x0 error = 0x0 node = 0x557bd469f360 workspace = 0x557bd4572ee0 container = 0x557bd469f360 no_auto_back_and_forth = false seat = 0x557bd3fc7580 old_parent = 0x0 old_ws = 0x557bd4572ee0 old_output = 0x557bd411f740 destination = 0x557bd46a0cc0 new_output = 0x557bd411f740 new_output_last_ws = 0x0 focus = 0x557bd469f360 __PRETTY_FUNCTION__ = "cmd_move_container" new_workspace = 0x557bd4572ee0 […] Reintroduce the NULL check to fix the bug. Fixes #3746
* Handle NULL from output_get_active_workspaceLibravatar Brian Ashworth2019-02-25
| | | | | | | | | | This modifies the places where output_get_active_workspace is called to handle a NULL result. Some places already handled it and did not need a change, some just have guard off code blocks, others return errors, and some have sway_asserts since the case should never happen. A lot of this is probably just safety precautions since they probably will never be called when `output_get_active_workspace` is not fully configured with a workspace.
* layout cmd: always operate on parent container, like i3Fixes #3724Libravatar Eric Drechsel2019-02-25
|
* Use container under cursor for mouse bindings1.0-rc3Libravatar Brian Ashworth2019-02-18
| | | | | This matches i3's behavior of executing mouse bindings in regards to the container under the cursor instead of what is focused.
* seat_cmd_cursor: fix typo in expected syntaxLibravatar Brian Ashworth2019-02-18
| | | | This just fixes a typo in the expected syntax for seat_cmd_cursor
* Don't remove from scratchpad on move to workspaceLibravatar athrungithub2019-02-18
| | | | | on move container window to another workspace, not remove from scratchpad.
* fix misc memory leaksLibravatar Brian Ashworth2019-02-11
| | | | | | | | | This fixes a few misc memory leaks reported by asan: - Items of `config->config_chain` are now freed instead of just the list itself - `bar->swaybar_command` is now freed - The result returned by a seat subcommand is now returned instead of leaked
* fix double free for mode toggle if bar was invisibleLibravatar Rouven Czerwinski2019-02-11
| | | | | | | | | If the bar was set to "invisible" and subsequently "toggle" was send twice, the new mode was never set and the bar->mode was double freed. Fix this by not requiring the bar->mode to be "hide" and instead show it unconditionally, because it was either hidden or invisible. Fixes #3637
* bar_cmd_modifier: add support for noneLibravatar Brian Ashworth2019-02-11
| | | | | | | | sway-bar(5) documents `modifier none`, which comes from i3. This implements the functionality for `modifier none` since it was not previously implemented. The bar modifier toggles visibility of the bar when the bar mode is set to hide. When the bar modifier is set to `none`, the ability to toggle visibility of the bar will be disabled.
* output_cmd_background: fix no file + valid modeLibravatar Brian Ashworth2019-02-11
| | | | | | | | | | | | | If output_cmd_background is given a valid mode as the first argument, then there is no file given and an error should be returned. join_args should not be called with an argc of zero since it sets the last character to the null terminator. With an argc of zero, the length is zero causing a heap buffer overflow when setting the byte before the start of argv to '\0'. This probably will not ever generate a segfault, but may cause data corruption to whatever is directly before it in memory. To make other such cases easier to detect, this also adds a sway_assert in join_args when argc is zero.
* cmd_workspace_gaps: fix double free on bad amountLibravatar Brian Ashworth2019-02-11
| | | | | | | | This fixes a double free in cmd_workspace_gaps when the amount given is invalid. The end pointer from strtol is part of the argument and should not be freed. Freeing the end pointer could result in a double free or bad free depending on whether or not the end pointer was at the start of the argument
* seat_cmd_cursor: do not create non-existing seatLibravatar Brian Ashworth2019-02-11
| | | | | | | | If a seat does not exist in seat_cmd_cursor, do not create it. A seat without any attachments is useless since it will have no capabilities. This changes `input_manager_get_seat` to have an additional argument that dictates whether or not to create the seat if it does not exist.
* cmd_seat: allow - to be used as alias for currentLibravatar Brian Ashworth2019-02-02
| | | | | | This allows for `-` (hyphen) to be used as an alias for the current seat while sway is running. This alias was chosen since it is unlikely to interfere with any desirable seat identifier
* seat_cmd_attach: defer while readingLibravatar Brian Ashworth2019-02-03
| | | | | Since the seats and inputs are not yet available while the config is being read, defer seat attachment requests
* 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
|
* criteria & scratchpad verify if show in another workspace (#3522)Libravatar athrungithub2019-01-30
| | | check if scratchpad is show in another workspace
* Introduce container_is_scratchpad_hiddenLibravatar Ryan Dwyer2019-01-28
| | | | | | | | | | | | Just a convenience function that improves readability of the code. Other things worth noting: * container_get_siblings and container_sibling_index no longer use the const keyword * container_handle_fullscreen_reparent is only ever called after attaching the container to a workspace, so its con->workspace check has been changed to an assertion
* Merge pull request #3423 from RyanDwyer/fullscreen-globalLibravatar Drew DeVault2019-01-27
|\ | | | | Implement fullscreen global
| * Implement fullscreen globalLibravatar Ryan Dwyer2019-01-25
| |
* | Use sway_log_errno instead of strerrorLibravatar Ian Fan2019-01-24
|/
* Fix dead stores found by scan-buildLibravatar M Stoeckl2019-01-22
| | | | | | | | In addition to removing unused code, two minor problems are fixed: (1) `resize set` and `resize adjust` did not error when given too many arguments. (2) `orientation` was incorrectly overridden to be 'U' for scroll events in the swaybar tray `handle_click` function.
* Merge pull request #3494 from ianyfan/commandsLibravatar Drew DeVault2019-01-22
|\ | | | | i3 command behaviour compatibility fixes
| * commands: allow setting floating on scratchpad containersLibravatar Ian Fan2019-01-22
| |
| * commands: allow tiled containers to be stickiedLibravatar Ian Fan2019-01-22
| | | | | | | | | | This also stops stickied containers from losing its sticky status when it is tiled, allowing it to be immediately stickied when floated again.
* | root_scratchpad_remove_container: do not showLibravatar Brian Ashworth2019-01-22
| | | | | | | | | | | | | | This removes the call to `root_scratchpad_show` from `root_scratchpad_remove_container` and places it in the `cmd_move_container`. This also moved the IPC `window::move` event to `cmd_scratchpad`.
* | util.c: remove numlen functionLibravatar Ian Fan2019-01-22
|/ | | | Its uses have been replaced by snprintf, which is more in line with its usage.
* Remove assumption that noop output will be called NOOP-1Libravatar Ryan Dwyer2019-01-22
|
* Don't allow noop output to be configuredLibravatar Ryan Dwyer2019-01-22
|
* Prevent noop output from being enabledLibravatar Ryan Dwyer2019-01-22
|
* Move sway-specific functions in common/util.c into sway/Libravatar M Stoeckl2019-01-21
| | | | | | Modifier handling functions were moved into sway/input/keyboard.c; opposite_direction for enum wlr_direction into sway/tree/output.c; and get_parent_pid into sway/tree/root.c .
* Merge pull request #3480 from RedSoxFan/input-modes-improved-toggleLibravatar Drew DeVault2019-01-21
|\ | | | | input_cmd_events: allow toggle modes to be listed
| * input_cmd_events: allow toggle modes to be listedLibravatar Brian Ashworth2019-01-21
| | | | | | | | | | | | | | | | | | This extends `input <identifier> events toggle` to allow for an optional list of modes to toggle through. If no event modes are listed, all supported modes are cycled through (current behavior). If event modes are listed, they will be cycled through, defaulting to the first mode listed when the current mode is not in the list. This modes listed will also not be checked to see if the device supports them and may fail.
* | 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.
* Don't escape swaybg arguments anymoreLibravatar emersion2019-01-18
| | | | | | | swaybg used to be invoked with sh, which made escaping necessary. This is no longer necessary. Fixes https://github.com/swaywm/sway/issues/3456
* bar_cmd_tray_bind: Use mouse button helpersLibravatar Brian Ashworth2019-01-16
| | | | | | | | | | | | | | | | This modifies `bar_cmd_tray_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `bar_cmd_tray_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like with sway bindings, the two commands are encapsulated in a single file to maximize shared code. This also modifies tray bindings to work off of events codes rather than x11 buttons, which allows for any mouse buttons to be used. For `get_bar_config`, `event_code` has been added to the `tray_bindings` section and will include to event code for the button. If the event code can be mapped to a x11 button, `input_code` will still be the x11 button number. Otherwise, `input_code` will be `0`.
* cmd_resize: allow resizing hidden scratchpad by pxLibravatar Brian Ashworth2019-01-16
| | | | | | Allow resizing a hidden scratchpad container by px. Resizing a hidden scratchpad container by ppt is still not allowed since there is no workspace
* Handle hidden scratchpad containers in commandsLibravatar Brian Ashworth2019-01-15
| | | | | | | This fixes the handling of hidden scratchpad containers for some commands. For the most part, this just prevents running the commands on hidden scratchpad containers, but there are some commands that have some special handling for them.
* Fix invalid pointers when using resize grow width on first/last siblingsLibravatar Ryan Dwyer2019-01-15
|
* Resize only current and immediate siblings rather than all siblingsLibravatar Ryan Dwyer2019-01-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | For example, create layout V[view view view] and resize the leftmost view using mod+rightclick. Previously, the edge between view 2 and 3 would be adjusted as well. Now this edge will remain constant, which matches the behaviour of i3. To do this operation correctly, the resize tiling seatop now keeps track of two containers, as the container that resizes horizontally will be a different container to the one which resizes vertically (one will be an ancestor). The tiling resize seatop now figures out these containers during the start of the operation and keeps references to them in the event. A new function container_find_resize_parent has been introduced to do this. This function is also used by the resize command. During cursor motion, the seatop logic is similar to before, but now has to choose the correct container to resize. In resize.c, container_resize_tiled and resize_tiled have been merged into one. One of them originally did nothing except pass the values through to the other. container_resize_tiled now takes a simplified approach where it just finds the immediate siblings on either side and resizes them without worrying about the others. The parellel_coord and parallel_size functions are no longer needed and have been removed.
* 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.
* Use uint32_t where resize axis might contain a bitfieldLibravatar Ryan Dwyer2019-01-14
|
* Replace resize_axis with wlr_edgesLibravatar Ryan Dwyer2019-01-14
| | | | | | | | | | | This patch removes the resize_axis enum in favour of wlr_edges. As wlr_edges has no `horizontal` or `vertical` value, it denotes these by bitwise `or`ing the left/right and up/down values. Two constants are defined to make it easier to refer to these. This will allow the tiling resize seatop to utilise the functions in this file. resize_axis was local to the resize command and couldn't be exposed in function arguments.
* Merge pull request #3144 from emersion/cmd-xwaylandLibravatar Drew DeVault2019-01-13
|\ | | | | Add xwayland command
| * Add xwayland commandLibravatar emersion2018-11-19
| |
* | Merge pull request #3344 from RedSoxFan/bar-mouse-bindings-improvedLibravatar Drew DeVault2019-01-13
|\ \ | | | | | | Improve mouse button parsing: bar mouse bindings
| * | bar_cmd_bind: utilize mouse button helpersLibravatar Brian Ashworth2019-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies `bar_cmd_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `cmd_bar_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like sway bindings, the two commands are encapsulated in a single file with shared code. This also modifies swaybar to operate off of event codes rather than x11 button numbers, which allows for any mouse button to be used. This introduces two new IPC properties: - For `get_bar_config`, `event_code` has been added to the `bindings` section and will include to event code for the button. If the event code can be mapped to a x11 button, `input_code` will still be the x11 button number. Otherwise, `input_code` will be `0`. - Likewise for `click_events`, `event` has been added and will include the event code for the button clicked. If the event code can be mapped to a x11 button, `button` will still be the x11 button number. Otherwise, `button` will be `0`.