aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/workspace.c
Commit message (Collapse)AuthorAge
* Merge commit '104057a7ea34ad3fa4b202668bb6d66550483f0b' into HEADHEADmasterLibravatar Jenkins CI9 days
|\
| * Override outputs with the workspace commandpatch-for/masterLibravatar Kristóf Marussy2024-01-27
| |
* | Define _POSIX_C_SOURCE globallyLibravatar Simon Ser2024-02-23
|/ | | | See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
* commands: add printf attribute to cmd_results_new()Libravatar Simon Ser2023-04-14
| | | | And fix the resulting build failures.
* Revert "Add workspace {prev,next}_on_output --create"Libravatar Ragnar Groot Koerkamp2021-06-22
| | | | | | | This reverts commit 487c83f0de9ca2a7650ad636eed6fd694ddcb82e. The --create flag is undocumented, not in i3, and at least partially broken (#5913), so this removes the feature.
* Only call workspace_auto_back_and_forth when neededLibravatar Ragnar Groot Koerkamp2021-06-18
| | | | | | Instead of disabling it for some workspace subcommands, this explicitly calls it only in the 2 places it's actually needed: for switching to a named or numbered workspace.
* 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.
* 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.
* Handle seat_get_focused_workspace returning NULLLibravatar Brian Ashworth2019-03-12
| | | | | This modifiers the callers of seat_get_focused_workspace to handle getting NULL as the return value, if they did not already.
* Fix crash in cmd_workspace when layer surface has focusLibravatar emersion2019-03-10
|
* Add workspace {prev,next}_on_output --createLibravatar Drew DeVault2019-02-17
| | | | This creates the next workspace if you hit the end.
* cmd_workspace_gaps: fix double free on bad amountLibravatar Brian Ashworth2019-02-05
| | | | | | | | 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
* Implement fullscreen globalLibravatar Ryan Dwyer2019-01-25
|
* 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.
* list.c: rename free_flat_list to list_free_items_and_destroyLibravatar Ian Fan2018-12-09
|
* Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
| | | | And make sure we don't define both in the same source file.
* Allow multiple outputs for workspace outputLibravatar Brian Ashworth2018-11-11
| | | | | | | | | | | | `i3 4.16` allows users to list multiple outputs for a workspace and the first available will be used. The syntax is as follows: `workspace <workspace> output <outputs...>` Additionally when the workspace is created, the outputs get added to the output priority list in the order specified. This ensures that if a higher output gets connected, the workspace will move to the higher output. This works the same way as if the user had a workspace on an output, disconnected the output, and then later reconnected the output.
* Implement per side and per direction outer gapsLibravatar Brian Ashworth2018-11-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the following command extensions from `i3-gaps`: * `gaps horizontal|vertical|top|right|bottom|left <amount>` * `gaps horizontal|vertical|top|right|bottom|left all|current set|plus|minus <amount>` * `workspace <ws> gaps horizontal|vertical|top|right|bottom|left <amount>` `inner` and `outer` are also still available as options for all three of the above commands. `outer` now acts as a shorthand to set/alter all sides. Additionally, this fixes two bugs with the prevention of invalid gap configurations for workspace configs: 1. If outer gaps were not set and inner gaps were, the outer gaps would be snapped to the negation of the inner gaps due to `INT_MIN` being less than the negation. This took precedence over the default outer gaps. 2. Similarly, if inner gaps were not set and outer gaps were, inner gaps would be set to zero, which would take precedence over the default inner gaps. Fixing both of the above items also requires checking the gaps again when creating a workspace since the default outer gaps can be smaller than the negation of the workspace specific inner gaps.
* Update workspace.cLibravatar ppascher2018-10-25
| | | re-added missing output check after config load
* Update workspace.cLibravatar ppascher2018-10-25
| | | Remove output requirement for workspace command
* Deny several commands when there's no outputs connectedLibravatar Ryan Dwyer2018-10-26
|
* Make workspace back_and_forth seat-specificLibravatar Ryan Dwyer2018-10-21
| | | | | | | | * When using multiple seats, each seat has its own prev_workspace_name for the purpose of workspace back_and_forth. * Removes prev_workspace_name global variable. * Removes unused next_name_map function in tree/workspace.c. * Fixes memory leak in seat_destroy (seat was not freed).
* Consider cursor warp when switching workspacesLibravatar Ryan Dwyer2018-10-19
| | | | | | | | | Fixes a regression introduced in 24a90e5d86441fc345356eb3767e5a6880dcedbd. consider_warp_to_focus has been renamed to seat_consider_warp_to_focus, moved to seat.c and made public. It is now called when switching workspaces via `workspace <ws>`.
* Fix crash when using workspace back_and_forth with no previousLibravatar Ryan Dwyer2018-10-16
|
* fix_edge_gaps: Allow negative values for outer gaps.Libravatar Tarmack2018-10-13
| | | | While allowing negative values for the outer gaps it is still prevented that negative values move windows out of the container. This replaces the non-i3 option for edge_gaps.
* Make gaps implementation consistent with i3-gapsLibravatar Ryan Dwyer2018-09-29
| | | | | | | | | | | | | | | | | | | | | | | | This changes our gaps implementation to behave like i3-gaps. Our previous implementation allowed you to set gaps on a per container basis. This isn't supported by i3-gaps and doesn't seem to have a practical use case. The gaps_outer and gaps_inner properties on containers are now removed as they just read the gaps_inner from the workspace. `gaps inner|outer <px>` no longer changes the gaps for all workspaces. It only sets defaults for new workspaces. `gaps inner|outer current|workspace|all set|plus|minus <px>` is now runtime only, and the workspace option is now removed. `current` now sets gaps for the current workspace as opposed to the current container. `workspace <ws> gaps inner|outer <px>` is now implemented. This sets defaults for a workspace. This also fixes a bug where changing the layout of a split container from linear to tabbed would cause gaps to not be applied to it until you switch to another workspace and back.
* Rename workspace_outputs to workspace_configs and fix memory leakLibravatar Ryan Dwyer2018-09-28
| | | | | | | | | | | | | | | When we eventually implement `workspace <ws> gaps inner|outer <px>`, we'll need to store the gaps settings for workspaces before they're created. Rather than create a workspace_gaps struct, the approach I'm taking is to rename workspace_outputs to workspace_configs and then add gaps settings to that. I've added a lookup function workspace_find_config. Note that we have a similar thing for outputs (output_config struct and output_find_config). Lastly, when freeing config it would create a memory leak by freeing the list items but not the workspace or output names inside them. This has been rectified using a free_workspace_config function.
* Implement type safe arguments and demote sway_containerLibravatar Ryan Dwyer2018-09-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the meaning of sway_container so that it only refers to layout containers and view containers. Workspaces, outputs and the root are no longer known as containers. Instead, root, outputs, workspaces and containers are all a type of node, and containers come in two types: layout containers and view containers. In addition to the above, this implements type safe variables. This means we use specific types such as sway_output and sway_workspace instead of generic containers or nodes. However, it's worth noting that in a few places places (eg. seat focus and transactions) referring to them in a generic way is unavoidable which is why we still use nodes in some places. If you want a TL;DR, look at node.h, as well as the struct definitions for root, output, workspace and container. Note that sway_output now contains a workspaces list, and workspaces now contain a tiling and floating list, and containers now contain a pointer back to the workspace. There are now functions for seat_get_focused_workspace and seat_get_focused_container. The latter will return NULL if a workspace itself is focused. Most other seat functions like seat_get_focus and seat_set_focus now accept and return nodes. In the config->handler_context struct, current_container has been replaced with three pointers: node, container and workspace. node is the same as what current_container was, while workspace is the workspace that the node resides on and container is the actual container, which may be NULL if a workspace itself is focused. The global root_container variable has been replaced with one simply called root, which is a pointer to the sway_root instance. The way outputs are created, enabled, disabled and destroyed has changed. Previously we'd wrap the sway_output in a container when it is enabled, but as we don't have containers any more it needs a different approach. The output_create and output_destroy functions previously created/destroyed the container, but now they create/destroy the sway_output. There is a new function output_disable to disable an output without destroying it. Containers have a new view property. If this is populated then the container is a view container, otherwise it's a layout container. Like before, this property is immutable for the life of the container. Containers have both a `sway_container *parent` and `sway_workspace *workspace`. As we use specific types now, parent cannot point to a workspace so it'll be NULL for containers which are direct children of the workspace. The workspace property is set for all containers, except those which are hidden in the scratchpad as they have no workspace. In some cases we need to refer to workspaces in a container-like way. For example, workspaces have layout and children, but when using specific types this makes it difficult. Likewise, it's difficult for a container to get its parent's layout when the parent could be another container or a workspace. To make it easier, some helper functions have been created: container_parent_layout and container_get_siblings. container_remove_child has been renamed to container_detach and container_replace_child has been renamed to container_replace. `container_handle_fullscreen_reparent(con, old_parent)` has had the old_parent removed. We now unfullscreen the workspace when detaching the container, so this function is simplified and only needs one argument now. container_notify_subtree_changed has been renamed to container_update_representation. This is more descriptive of its purpose. I also wanted to be able to call it with whatever container was changed rather than the container's parent, which makes bubbling up to the workspace easier. There are now state structs per node thing. ie. sway_output_state, sway_workspace_state and sway_container_state. The focus, move and layout commands have been completely refactored to work with the specific types. I considered making these a separate PR, but I'd be backporting my changes only to replace them again, and it's easier just to test everything at once.
* commands: saner workspace number handlingLibravatar Ian Fan2018-08-18
|
* commands: check for special workspaces in workspace & move commandsLibravatar Ian Fan2018-08-06
|
* commands: complete workspace implementationLibravatar Ian Fan2018-08-06
| | | | Allow optional --no-auto-back-and-forth flag, as well as refactoring some logic
* Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
|
* Fix cmd_workspace crash when a surface has focusLibravatar Brian Ashworth2018-06-01
|
* move workspace create to workspace.cLibravatar Tony Crisci2018-04-03
|
* unify workspace create functionsLibravatar Tony Crisci2018-04-03
|
* rename seat functionsLibravatar Tony Crisci2018-04-02
|
* Revert "Merge pull request #1653 from swaywm/revert-1647-refactor-tree"Libravatar Tony Crisci2018-03-29
| | | | | This reverts commit 472e81f35d689d67cda241acafda91c688d61046, reversing changes made to 6b7841b11ff4cd35f54d69dc92029855893e5ce0.
* Revert "Refactor tree"Libravatar Drew DeVault2018-03-29
|
* more renaming thingsLibravatar Tony Crisci2018-03-29
|
* rename container functionsLibravatar Tony Crisci2018-03-29
|
* move tree includes to their own directoryLibravatar Tony Crisci2018-03-29
|
* separate seat get focus and seat get focus inactiveLibravatar Tony Crisci2018-02-07
|
* basic focus overhaulLibravatar Tony Crisci2018-02-04
|
* Implement workspacesLibravatar Drew DeVault2018-01-30
|
* Move everything to sway/old/Libravatar Drew DeVault2017-11-18
|
* remove unnecessary todo itemLibravatar Zandr Martin2017-03-18
| | | | | | As best I can tell this todo was intended to add workspace movement to the given output with the `workspace <ws> output <op>` command, but i3 does not behave this way.
* UnGNUify the codebaseLibravatar Drew DeVault2017-03-10
|
* fix workspace output assignmentLibravatar Zandr Martin2017-03-08
|
* Fix #1099: Allow spaces in worspace namesLibravatar Calvin Lee2017-03-01
| | | | | | | | | This commit allows unquoted spaces in worspace names in order to keep compatability with i3. The names _must not_ contain the string "output" which is documented in 'sway.5' because how sway detects the `move <workspace> output <output>` command. Also I documented that "number" may be used before the worspace name without affecting how the name is evaluated.