aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/layout.c
Commit message (Collapse)AuthorAge
* 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.
* cmd_split: fix toggle split for non-split layoutsLibravatar Brian Ashworth2019-07-11
| | | | | | | | | | Previously, `layout toggle` and `layout toggle split` would set L_VERT when layout was L_HORIZ, otherwise it would set L_HORIZ. This meant that when the layout was L_TABBED or L_STACKED, it would always be L_HORIZ. This extends #4315 (which corrects the handling when multiple layouts are given) to try prev_split_layout, config->default_orientation, and then falling back to L_VERT when the output is taller than wide and L_HORIZ when wider than tall.
* cmd_layout: toggle split for tabbed/stack defaultLibravatar Brian Ashworth2019-07-10
| | | | | | | | | | | This fixes the logic of split for layout toggle when the default layout is L_TABBED or L_STACKED. When the default layout is L_TABBED or L_STACKED, the container/workspace may not have a prev_split_layout. This was causing L_NONE to be returned by get_layout_toggle, which was being handled as a syntax error. This adds logic to try config->default_orientation when prev_split_layout is L_NONE. If that is also L_NONE, then L_VERT is used when the output is taller than wide, otherwise, L_HORIZ is used.
* Fix scratchpad fullscreen behavior and crashLibravatar Brian Ashworth2019-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | When setting fullscreen on a hidden scratchpad container, there was a check to see if there was an existing fullscreen container on the workspace so it could be fullscreen disabled first. Since the workspace is NULL, it would cause a SIGSEGV. This adds a NULL check to avoid the crash. This also changes the behavior of how fullscreen is handled when adding a container to the scratchpad or changing visibility of a scratchpad container to match i3's. The behavior is as follows: - When adding a container to the scratchpad or hiding a container back into the scratchpad, there is an implicit fullscreen disable - When setting fullscreen on a container that is hidden in the scratchpad, it will be fullscreen when shown (and fullscreen disabled when hidden as stated above) - When setting fullscreen global on a container that is hidden in the scratchpad, it will be shown immediately as fullscreen global. The container is not moved to a workspace and remains in the scratchpad. The container will be visible until fullscreen disabled or killed. Since the container is in the scratchpad, running `scratchpad show` or `move container to scratchpad` will have no effect This also changes `container_replace` to transfer fullscreen and scratchpad status.
* layout cmd: always operate on parent container, like i3Fixes #3724Libravatar Eric Drechsel2019-02-19
|
* 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.
* Deny several commands when there's no outputs connectedLibravatar Ryan Dwyer2018-10-26
|
* commands: remove EXPECTED_MORE_THANLibravatar Ian Fan2018-10-23
| | | | Its uses have been replaced with EXPECTED_AT_LEAST.
* 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.
* Fix crash when running "layout toggle"Libravatar Ryan Dwyer2018-09-06
| | | | | The argc and argv used in this function are the same ones used by the layout command itself.
* Fix crash when running layout toggle splitLibravatar Ryan Dwyer2018-09-05
|
* 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.
* Fix gaps issuesLibravatar Ryan Dwyer2018-08-28
| | | | | | | | | * In layout command, arrange parent of parent - not sure why this is needed but it is * Remove gap adjustment when rendering * Workspace should use outer gaps, not inner * Add exceptions for tabbed and stacked containers * Don't mess with gap state when splitting a container
* commands: fix layout implementation (also better name for previous split layout)Libravatar Ian Fan2018-08-06
|
* commands: complete layout implementationLibravatar Ian Fan2018-08-06
|
* Simplify transactions by utilising a dirty flag on containersLibravatar Ryan Dwyer2018-07-14
| | | | | | | | | | | | | | | This PR changes the way we handle transactions to a more simple method. The new method is to mark containers as dirty from low level code (eg. arranging, or container_destroy, and eventually seat_set_focus), then call transaction_commit_dirty which picks up those containers and runs them through a transaction. The old methods of using transactions (arrange_and_commit, or creating one manually) are now no longer possible. The highest-level code (execute_command and view implementation handlers) will call transaction_commit_dirty, so most other code just needs to set containers as dirty. This is done by arranging, but can also be done by calling container_set_dirty.
* Refactor everything that needs to arrange windowsLibravatar Ryan Dwyer2018-06-09
| | | | | | | | | | * The arrange_foo functions are now replaced with arrange_and_commit, or with manually created transactions and arrange_windows x2. * The arrange functions are now only called from the highest level functions rather than from both high level and low level functions. * Due to the previous point, view_set_fullscreen_raw and view_set_fullscreen are both merged into one function again. * Floating and fullscreen are now working with transactions.
* Replace is_floating boolean with functionLibravatar Ryan Dwyer2018-06-01
|
* Clean up container title functionsLibravatar Ryan Dwyer2018-05-25
| | | | | | | | | | | | | * Add and use lenient_strcat and lenient_strncat functions * Rename `concatenate_child_titles` function as that's no longer what it does * Rename `container_notify_child_title_changed` because we only need to notify that the tree structure has changed, not titles * Don't notify parents when a child changes its title * Update ancestor titles when changing a container's layout * Eg. create nested tabs and change the inner container to stacking * No need to store tree presentation in both container->name and formatted_title
* Implement stacked layoutLibravatar Ryan Dwyer2018-05-22
|
* Implement tabbed layoutLibravatar Ryan Dwyer2018-05-21
|
* Refactor arrange_windows()Libravatar Ryan Dwyer2018-04-28
| | | | | | | | | Replaces arrange_windows() with arrange_root(), arrange_output(), arrange_workspace() and arrange_children_of(). Also makes fullscreen views save and restore their dimensions, which allows it to preserve any custom resize and is also a requirement for floating views once they are implemented.
* Remove sway_container.workspace_layoutLibravatar Ryan Dwyer2018-04-26
| | | | Fixes #1716.
* Revert "Break everything^W^WUse wlr_box for sway_container"Libravatar Drew DeVault2018-04-06
|
* Break everything^W^WUse wlr_box for sway_containerLibravatar Drew DeVault2018-04-06
|
* clean up container_get_default_layoutLibravatar Tony Crisci2018-04-03
|
* 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
|
* arrange windowsLibravatar Tony Crisci2018-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
|
* remove checks for command handlersLibravatar Tony Crisci2018-02-24
|
* basic layout commandLibravatar Tony Crisci2018-02-22
|
* Move everything to sway/old/Libravatar Drew DeVault2017-11-18
|
* prevent crash when `layout auto` is missing argsLibravatar Zandr Martin2017-04-29
|
* Improve criteria handlingLibravatar Calvin Lee2017-04-05
| | | | | | | | | | | | | | This commit changes how commands decide what container to act on. Commands get the current container though `current_container`, a global defined in sway/commands.c. If a criteria is given before a command, then the following command will be run once for every container the criteria matches with a reference to the matching container in 'current_container'. Commands should use this instead of `get_focused_container()` from now on. This commit also fixes a few (minor) mistakes made in implementing marks such as non-escaped arrows in sway(5) and calling the "mark" command "floating" by accident. It also cleans up `criteria.c` in a few places.
* UnGNUify the codebaseLibravatar Drew DeVault2017-03-10
|
* replaced "bot" with "bottom" in auto layout commandsLibravatar wil2017-01-14
|
* reworked "layout auto*" star commandsLibravatar wil2017-01-08
| | | | | | - "layout auto_left|auto_xxx" are now "layout auto xxx" - "layout incmaster <n>" is now "layout auto master [set|inc] <n>" - "layout incncol <n>" is now "layout auto ncol [set|inc] <n>"
* Indent cleanupsLibravatar wil2017-01-08
|
* [fix] cleanups suggested by Sway communityLibravatar wil2017-01-01
|
* changed "layout promote" command to "move first"Libravatar wil2017-01-01
| | | | This is more consistent with other Sway semantics.
* [fix] cycle auto layouts backwardsLibravatar wil2016-12-31
|
* cleanup in auto layoutsLibravatar wil2016-12-29
| | | | | | - added L_AUTO_FIRST/LAST instead of using explicit layouts. - when switching between auto layout that don't share the same major axis, invert the width/height of their child views to preserve their relative proportions.
* introduce next/prev as a direction for focus/move commands.Libravatar wil2016-12-29
|
* Added "layout incnmaster|incncol" commandsLibravatar wil2016-12-29
|
* Added Awesome/Monad type "auto" layoutsLibravatar wil2016-12-29
|
* fix layout switching (was broken because of workspace_layout)0.11-rc1Libravatar D.B2016-12-04
| | | | | | | For workspace containers, swayc_change_layout also changes ->layout alongside ->workspace_layout when it's a sensible thing to do. There is an additional test for 'layout toggle' command which ensures that containers will be tiled horizontally after toggling from tabbed or stacked.
* add workspace_layout to containerLibravatar D.B2016-12-04
| | | | | Add swayc_change_layout function, which changes either layout or workspace_layout, depending on the container type.