aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
AgeCommit message (Collapse)Author
2018-08-25Merge branch 'master' into commandsRyan Dwyer
2018-08-24Refactor destroy functions and save workspaces when there's no outputsRyan Dwyer
This changes the destroy functions to the following: * output_begin_destroy * output_destroy * workspace_begin_destroy * workspace_destroy * container_begin_destroy * container_destroy * view_begin_destroy * view_destroy The terminology was `destroy` and `free`, and it has been changed to `begin_destroy` and `destroy` respectively. When the last output is disconnected, its workspaces will now be stashed in the root. Upon connection of a new output they will be restored. There is a new function `workspace_consider_destroy` which decides whether the given workspace should be destroyed or not (ie. empty and not visible). Calling container_begin_destroy will no longer automatically reap the parents. In some places we want to reap the parents and in some we don't, so this is left to the caller. container_reap_empty_recursive and container_reap_empty have been combined into one function and it will recurse up the tree.
2018-08-21Replace enum resize_edge with wlr_edgesRyan Dwyer
2018-08-20commands: implement move absoluteIan Fan
2018-08-20Send output enter/leave events correctlyRyan Dwyer
Previously we used a reparent event to detect when a view changes parent, then sent an output enter/leave to the surfaces if needed. This worked for tiling views but not floating views, as floating views can intersect another output without changing parent. The solution implemented for floating views also applies cleanly to tiling views, so the previous method has been completely replaced and the reparent event has been removed. This introduces a new function container_discover_outputs. This function compares the container's `current` position to the outputs, sends enter and leave events as needed, and keeps track of which outputs it's intersecting in a new `container->outputs` list. If it has entered a new output with a different scale then the title and marks textures will also be recreated at the new scale. The function is called when a transaction applies. This is convenient as it means we don't have to call it from various places. There is imperfect rendering when a floating view overlaps two outputs with different scales. It renders correctly for the most recently entered output, but there is only one title texture so it renders incorrectly on the old output. Fixes #2482
2018-08-19Replace hacky L_FLOATING container with a listRyan Dwyer
Workspaces previously had a magical `workspace->floating` container, which had a layout of L_FLOATING and whose children were actual floating views. This allowed some conveniences, but was a hacky solution because the container has to be exempt from focus, coordinate transactions with the workspace, and omit emitting IPC events (which we didn't do). This commit changes it to be a list directly in the sway_workspace. The L_FLOATING layout is no longer used so this has been removed as well. * Fixes incorrect check in the swap command (it checked if the containers had the L_FLOATING layout, but this layout applied to the magical container). * Introduces workspace_add_floating
2018-08-18commands: move newly-stickied containers to focused workspaceIan Fan
2018-08-18commands: prevent focusing mode with no containersIan Fan
Explicitly fail when trying to focus tiling/floating when there are no tiling/floating containers.
2018-08-18commands: complete assign commandIan Fan
2018-08-18commands: saner workspace number handlingIan Fan
2018-08-18commands: handle quoted exec commandIan Fan
2018-08-18commands: fix documentation formatting mistakes for move commandIan Fan
2018-08-18commands: require set variable to start with $Ian Fan
2018-08-18commands: add nopIan Fan
2018-08-18Implement iterators per container typeRyan Dwyer
This introduces the following `for_each` functions: * root_for_each_workspace * root_for_each_container * output_for_each_workspace * output_for_each_container * workspace_for_each_container And introduces the following `find` functions: * root_find_output * root_find_workspace * root_find_container * output_find_workspace * output_find_container * workspace_find_container * container_find_child And removes the following functions: * container_descendants * container_for_each_descendant * container_find This change is preparing the way for demoting sway_container. Eventually these functions will accept and return sway_outputs, sway_workspaces and sway_containers (meaning a C_CONTAINER or C_VIEW). This change also makes it easy to handle abnormalities like the workspace floating list, root's scratchpad list and (once implemented) root's saved workspaces list for when there's no connected outputs.
2018-08-18Rename container_sort_workspaces and container_wrap_childrenRyan Dwyer
This commit renames container_sort_workspaces to output_sort_workspaces and moves it to output.c. This also renames container_wrap_children to workspace_wrap_children and moves it to workspace.c. This function is only called with workspaces.
2018-08-17Refactor seat_get_focus functionsRyan Dwyer
Fixes #2467. This commit introduces seat_get_focus_inactive_floating to supplement seat_get_focus_inactive_tiling, and uses it during `focus mode_toggle` which fixes a focus bug. This also refactors the seat_get_focus_inactive functions so that they do their selection logic themselves rather than offloading it to seat_get_focus_by_type which was getting bloated. seat_get_focus_by_type is now removed. Lastly, this commit changes seat_get_focus to just return the first container in the focus stack rather than looping and calling seat_get_focus_by_type.
2018-08-12Implement resizing tiled containers via cursorRyan Dwyer
* The OP_RESIZE seat operation has been renamed to OP_RESIZE_FLOATING, and OP_RESIZE_TILING has been introduced. * Similar to the above, seat_begin_resize and handle_resize_motion have been renamed and tiling variants introduced. * resize.c's resize_tiled has to be used, so container_resize_tiled has been introduced in resize.c to allow external code to call it.
2018-08-11Remove container_for_each_descendant_bfsRyan Dwyer
The function was not used. Also renames container_for_each_descendant_dfs to just container_for_each_descendant.
2018-08-10Implement resize set <width> <height> for tiled containersRyan Dwyer
Unlike i3, this implementation allows px measurements. Also fixes a sane size check.
2018-08-10Implement resize grow|shrink <direction> <amount> for tiled containersRyan Dwyer
2018-08-08Don't call swaynag_log for bg when not readingBrian Ashworth
2018-08-08Allow a fallback color to be specified for swaybgBrian Ashworth
This allows for a color to be set when the wallpaper does not fill the entire output. If specified, the fallback color is also used when the image path is inaccessible.
2018-08-08Deny moving a sticky container to workspace if it's the same outputRyan Dwyer
Rationale: Sticky containers are always assigned to the visible workspace. The basic idea here is to check the destination's output (move.c:190). But if the command was `move container to workspace x` then a workspace might have been created for it. We could destroy the workspace in this case, but that results in unnecessary IPC events. To avoid this, the logic for `move container to workspace x` has been adjusted. It now delays creating the workspace until the end, and uses `workspace_get_initial_output` to determine and check the output before creating it.
2018-08-07Fix crash when running `move container to workspace back_and_forth`Ryan Dwyer
The back_and_forth condition is intended to be handled in the else-if block, but this was never reached because it remained in the first block's conditions.
2018-08-06Merge branch 'master' into workspace-move-to-outputBrian Ashworth
2018-08-07Move workspace moving code out of container_move_toRyan Dwyer
container_move_to handled moving containers to new parents, as well as moving workspaces to new outputs. This commit removes the workspace-moving code from this function and introduces workspace_move_to_output. Moving workspaces using container_move_to only happened from the move command, so it's been implemented as a static function in that file. Simplifying container_move_to makes it easier for me to fix some issues in #2420.
2018-08-06commands: fix workspace edge casesIan Fan
2018-08-06commands: check for special workspaces in workspace & move commandsIan Fan
2018-08-06commands: add optional flags to moveIan Fan
2018-08-06commands: complete workspace implementationIan Fan
Allow optional --no-auto-back-and-forth flag, as well as refactoring some logic
2018-08-06commands: fix layout implementation (also better name for previous split layout)Ian Fan
2018-08-06commands: complete move implementationIan Fan
2018-08-06commands: complete layout implementationIan Fan
2018-08-04Move workspace pid code to root.cRyan Dwyer
2018-08-04Separate root-related codeRyan Dwyer
This creates a root.c and moves bits and pieces from elsewhere into it. * layout_init has been renamed to root_create and moved into root.c * root_destroy has been created and is called on shutdown * scratchpad code has been moved into root.c, because hidden scratchpad containers are stored in the root struct
2018-08-03Write to swaynag pipe fd directly on config errorsBrian Ashworth
2018-08-03Show swaynag on config errorsBrian Ashworth
2018-08-03Deny "move container" when an empty workspace is focusedRyan Dwyer
2018-08-02Merge pull request #2404 from RyanDwyer/move-containers-when-workspace-focusedDrew DeVault
Allow moving containers when workspace itself is focused
2018-08-02Reset signal mask after forkMarien Zwart
wlroots uses wl_event_loop_add_signal to handle SIGUSR1 from Xwayland. wl_event_loop_add_signal works by masking the signal and receiving it from a signalfd. The signal mask is preserved across fork and exec, so subprocesses spawned by Sway start with SIGUSR1 masked. Most subprocesses do not expect this and never unmask the signal, resulting in missing functionality or unexpected behavior for processes that use SIGUSR1 (such as i3status). Fix this by unmasking all signals between fork and exec.
2018-08-02Allow moving containers when workspace itself is focusedRyan Dwyer
2018-08-01ipc: prevent emitting a workspace::focus event when moving a container to a ↵Ian Fan
different workspace or output When a container is moved from, say, workspace 1 to workspace 2, workspace 2 is focused in order to arrange the windows before focus is moved back to workspace 1, which caused a workspace:focus event from workspace 2 to workspace 1 to be emitted. This commit inhibits that event.
2018-08-01ipc: add workspace::reload eventIan Fan
2018-08-01ipc: add binding eventIan Fan
2018-08-01ipc: add window::mark eventIan Fan
2018-08-01ipc: add barconfig_update event on config reloadIan Fan
2018-07-31Create list for mouse binds when creating new modeBrian Ashworth
2018-07-28Send floating container to scratchpad when a child is focusedRyan Dwyer
2018-07-28Fix focus mode_toggle from a child of a floating containerRyan Dwyer
Also fixes a crash when unfloating a window. It needs to add it back to the tiling tree as a sibling rather than a child, because the reference container might be a view.