aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.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
* Delete old damage tracking codeLibravatar Alexander Orzechowski2024-01-18
| | | | The new scene graph abstraction handles this for us.
* scene_graph: Maintain `wlr_scene_node`s for the sway tree.Libravatar Alexander Orzechowski2024-01-18
|
* Use output_match_name_or_id() in workspace functionsLibravatar Simon Ser2023-04-14
|
* workspace_create: Don't allow NULL nameLibravatar Alexander Orzechowski2022-11-11
|
* Use wl_signal_emit_mutable()Libravatar Simon Ser2022-11-10
| | | | | This function fixes segfaults when emitting a signal potentially removes arbitrary listeners.
* sway: replace noop_output by fallback_outputLibravatar Simon Zeni2021-11-25
| | | | | wlroots removed the support for the noop backend. Instead we rely on the headless backend to provide the fallback output.
* Add smart_gaps inverse_outer commandLibravatar bR3iN2021-10-29
| | | | | | Add a subcommand for `smart_gaps` that enables outer gaps only on workspaces with exactly one visible child. Also add documentation for `smart_gaps toggle`.
* 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.
* workspace: reap empty parents when adding tilesLibravatar Ronan Pigott2021-04-26
|
* 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.
* workspace: rework workspace prev|next like i3Libravatar Ronan Pigott2020-12-20
| | | | | Changes workspace prev|next commands to visit each numbered or named workspace first before considering workspace from the other category
* introduce workspace_squashLibravatar Ronan Pigott2020-12-20
| | | | | | | | | | | | | | | | | | workspace_squash is container_flatten in the reverse direction. Instead of eliminating redundant splits that are parents of the target container, it eliminates pairs of redundant H/V splits that are children of the workspace. Splits are redundant if a con and its grandchild have the same layout, and the immediate child has the opposite split. For example, layouts are transformed like: H[V[H[app1 app2]] app3] -> H[app1 app2 app3] i3 uses this operation to simplify the tree after moving heavily nested containers to a higher level in the tree via an orthogonal move.
* Change workspace_layout to match i3 behaviorLibravatar Ronan Pigott2020-12-20
| | | | | | | In i3, the workspace_layout command does not affect the workspace layout. Instead, new workspace level containers are wrapped in the desired layout and the workspace layout always defaults to the output orientation.
* tree/container: introduce `container_is_sticky[_or_child]` functionsLibravatar Tudor Brindus2020-11-11
| | | | | | | | | | 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.)
* output: evacuate sticky containers only if new output has a workspaceLibravatar mwenzkowski2020-10-27
| | | | | | | Sticky floating containers on an otherwise empty workspace can only be evacuated if the new output has an active workspace. The noop output may not have one and in that case we have to move the whole workspace to the new output.
* commands/move: unwrap workspace container on move to new workspaceLibravatar Tudor Brindus2020-07-01
| | | | | | | | | 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.
* tree/view: fix smart gaps when ancestor container is tabbed or stackedLibravatar Tudor Brindus2020-06-08
| | | | Fixes #5406.
* workspace_split: focus middle if workspace focusedLibravatar Brian Ashworth2019-08-14
| | | | | In workspace_split, the middle container that wraps the workspace's children should be focused for any seat that is focusing the workspace
* workspace: do not destroy if any seat is focusingLibravatar Brian Ashworth2019-08-13
| | | | | | | Since each seat has its own focus, do not destroy a workspace until it is no longer focused by any seat. This prevents seats from being forced to evacuate the workspace just because another seat switched focus away from it
* workspace: prefer identifiers for output priorityLibravatar Brian Ashworth2019-08-13
| | | | | | | | | | Since output names can change in various configurations, including DisplayPort MST, prefer output identifiers for the output priority. Users can still use `workspace <ws> output <names-or-ids>`, but any output that is programmatically added to the list will be added under the output identifier. If the output name exists in the list (from the user workspace output configs), then that will be retained instead of switching to the output identifier for that output.
* Sanity check gaps on the outside of the workspaceLibravatar Pedro Côrte-Real2019-07-15
| | | | | | | Avoid gaps that are too large around the workspace that you end up without any usable space for children. Fixes #4308
* Avoid negative outer gapsLibravatar Pedro Côrte-Real2019-07-15
| | | | | | Make sure we never let the gaps around the workspace go negative. Fixes #4304
* Rework gaps code to be simpler and correctLibravatar Pedro Côrte-Real2019-07-15
| | | | | | | | | | | | | Instead of tracking gaps per child apply gaps in two logical places: 1. In tiled containers use the layout code to add the gaps between windows. This is much simpler and guarantees that the sizing of children is correct. 2. In the workspace itself apply all the gaps around the edge. Here we're in the correct position to size inner and outer gaps correctly and decide on smart gaps in a single location. Fixes #4296
* ws-output-priority: fix logic issue in find_outputLibravatar Brian Ashworth2019-06-23
| | | | | | | The function used for comparing two output names in the workspace output priority lists was inverted. This was causing priority to not be stored correctly resulting in workspaces not always being restored or moved to the desired outputs
* 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
* cmd_move: respect workspace layout when insertingLibravatar Brian Ashworth2019-04-24
| | | | | | | | | | | | When moving a container to become a direct child of the workspace and the workspace's layout is tabbed or stacked, wrap it in a container with the same layout. This allows for the following: - Run `layout tabbed|stacked` on an empty workspace (or use `workspace_layout tabbed|stacked` in the config) - Open some views - Move one of the views in any direction - Open another view - The new container should also be `tabbed`/`stacked`
* Set prev_workspace_name based off of focusLibravatar Brian Ashworth2019-03-14
| | | | | | | | | This moves setting `seat->prev_workspace_name` from `workspace_switch` to `set_workspace`. `workspace_switch` is only called when using a `workspace` command to change the workspace so any workspace change based on criteria was not altering `seat->prev_workspace_name`. By moving it to `set_workspace`, which is called by `seat_set_focus`, it will change any time focus changes to a node on a different workspace
* 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.
* workspace_next_name: fallback to next available numberLibravatar Brian Ashworth2019-02-17
| | | | | | | | This changes `workspace_next_name` to use the next available number as the workspace name instead of the number of outputs. This fixes the case where a number that is already in use could be returned. The workspace numbers in use have no relation to the number of outputs so it makes more sense to use the lowest available number
* Add workspace {prev,next}_on_output --createLibravatar Drew DeVault2019-02-17
| | | | This creates the next workspace if you hit the end.
* seat: allow tree focus changes while layer focusedLibravatar Brian Ashworth2019-02-14
| | | | | | This allows the focused inactive tree node and visible workspaces to be changed while a surface layer has focus. The layer temporarily loses focus, the tree focus changes, and the layer gets refocused.
* workspace_get_initial_output: handle focused layerLibravatar Brian Ashworth2019-02-11
| | | | | | | When a layer surface is focused, `seat_get_focused_workspace` will be NULL. This changes `workspace_get_initial_output` to use output of the focus inactive. If the focus inactive is also NULL, then either the first output or the noop output will be used as fallbacks.
* Use noop output when there's no outputs connectedLibravatar Ryan Dwyer2019-01-22
| | | | | Instead of having NULL workspace->output pointers, use a noop output. This should be safer.
* 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.
* Combine output_by_name and output_by_identifierLibravatar Brian Ashworth2018-12-20
| | | | | | | | This combines `output_by_name` and `output_by_identifier` into a single function called `output_by_name_or_id`. This allows for output identifiers to be used in all commands, simplifies the logic of the callers, and is more efficient since worst case is a single pass through the output list.
* Allow output ids and wildcard for workspace outputLibravatar Brian Ashworth2018-12-17
| | | | | | | | | This allows for output identifiers and to be used in the `workspace <workspace> output <outputs...>` command. Previously, only output names would be allowed. If an output identifier was given, it would never match an output. This also allows for the wildcard character (`*`) to be specified, which can be used to generate a list of workspace names that should be used when generating new workspaces
* list.c: rename free_flat_list to list_free_items_and_destroyLibravatar Ian Fan2018-12-09
|
* 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.
* Use output identifier for workspace configLibravatar Robinhuett2018-10-27
|
* Rebase the cursor after applying transactionsLibravatar Ryan Dwyer2018-10-25
| | | | | | | | | | | | This approaches cursor rebasing from a different angle. Rather than littering the codebase with cursor_rebase calls and using transaction callbacks, this just runs cursor_rebase after applying every transaction - but only if there's outputs connected, because otherwise it causes a crash during shutdown. There is one known case where we still need to call cursor_rebase directly, and that's when running `seat seat0 cursor move ...`. This command doesn't set anything as dirty so no transaction occurs.
* 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).
* Merge pull request #2870 from RyanDwyer/refactor-input-managerLibravatar emersion2018-10-20
|\ | | | | Minor refactor of input manager
| * Minor refactor of input managerLibravatar Ryan Dwyer2018-10-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The input manager is a singleton object. Passing the sway_input_manager argument to each of its functions is unnecessary, while removing the argument makes it obvious to the caller that it's a singleton. This patch removes the argument and makes the input manager use server.input instead. On a similar note: * sway_input_manager.server is removed in favour of using the server global. * seat.input is removed because it can get it from server.input. Due to a circular dependency, creating seat0 is now done directly in server_init rather than in input_manager_create. This is because creating seats must be done after server.input is set. Lastly, it now stores the default seat name using a constant and removes a second reference to seat0 (in input_manager_get_default_seat).
* | Fix crash when view unmaps while no outputs connectedLibravatar Ryan Dwyer2018-10-20
|/ | | | | | | | | | | | | | | | | When a view unmaps, we call workspace_consider_destroy. This function assumed the workspace would always have an output, but this is not the case when hotplugged down to zero. The function now handles this and allows itself to be destroyed when there is no output. This means that workspace_begin_destroy must remove the workspace from the root->saved_workspaces list to avoid an eventual dangling pointer, so it does that now. Lastly, when an output is plugged in again and it has to create a new initial workspace for it, we must emit the workspace::init IPC event otherwise swaybar shows no workspaces at all. I guess when you start sway, swaybar is started after the workspace has been created which is why this hasn't been needed earlier.
* Introduce cursor_rebaseLibravatar Ryan Dwyer2018-10-19
| | | | | This function "rebases" the cursor on top of whatever is underneath it, without triggering any focus changes.
* 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.