aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
Commit message (Collapse)AuthorAge
...
* 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).
* Implement popup_during_fullscreenLibravatar Ryan Dwyer2018-10-08
| | | | | | | | | | This introduces a new view_impl function: is_transient_for. Similar to container_has_ancestor but works using the surface parents rather than the tree. This patch modifies view_is_visible, container_at and so on to allow transient views to function normally when they're in front of a fullscreen view.
* Shim client.background and client.placeholderLibravatar Drew DeVault2018-10-07
| | | | | | | These are not supported by sway, but are valid i3 commands and should not cause config errors. Also includes a couple of minor touch-ups.
* Add configuration for raising containers on focusLibravatar Jonathan Buch2018-10-03
| | | | | | | * New configuration option: raise_floating (From the discussion on https://github.com/i3/i3/issues/2990) * By default, it still raises the window on focus, otherwise it will raise the window on click.
* Handle border options for gapsLibravatar Brian Ashworth2018-10-01
| | | | | | | | | | | | Fixes `hide_edge_borders smart` when gaps are in use. Implements `hide_edge_borders smart_no_gaps` and `smart_borders on|no_gaps|off`. Since `smart_borders on` is equivalent to `hide_edge_borders smart` and `smart_borders no_gaps` is equivalent to `hide_edge_borders smart_no_gaps`, I opted to just save the last value set for `hide_edge_borders` and restore that on `smart_borders off`. This simplifies the conditions for setting the border.
* Do not strip quotes for cmd_setLibravatar Brian Ashworth2018-09-30
|
* Do not strip quotes for exec or bind commandsLibravatar Brian Ashworth2018-09-30
| | | | | Leave quotes intact for cmd_exec, cmd_exec_always, cmd_bindcode, and cmd_bindsym
* Fix quote handling for commandsLibravatar Brian Ashworth2018-09-28
| | | | Quotes are now stripped for all arguments and stripped before anything is unescaped
* Implement support for input wildcardLibravatar Brian Ashworth2018-09-23
|
* Allow running commands on containers without focusing themLibravatar Ryan Dwyer2018-09-23
| | | | | | | | | | | | | | This adds a `con` argument to `execute_command` which allows you to specify the container to execute the command on. In most cases it leaves it as `NULL` which makes it use the focused node. We only set it when executing `for_window` criteria such as when a view maps. This means we don't send unnecessary IPC focus events, and fixes a crash when the criteria command is `move scratchpad` (because we can't give focus to a hidden scratchpad container). Each of the shell map handlers now check to see if the view has a workspace. It won't have a workspace if criteria has moved it to the scratchpad.
* Merge pull request #2671 from emersion/output-execute-no-focusLibravatar emersion2018-09-20
|\ | | | | Fix segfault when executing command without focus
| * Fix segfault when executing command without focusLibravatar emersion2018-09-19
| |
* | Introduce create_output command (for developer use)Libravatar Ryan Dwyer2018-09-19
|/ | | | Should help with testing hotplugging.
* Introduce tiling_drag directiveLibravatar Ryan Dwyer2018-09-11
|
* 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.
* Change _XOPEN_SOURCE defines to _POSIX_C_SOURCELibravatar sghctoma2018-09-03
|
* Merge remote-tracking branch 'upstream/master' into fix-freebsd-buildLibravatar sghctoma2018-09-03
|\
| * Implement focus_on_window_activationLibravatar Ryan Dwyer2018-09-02
| | | | | | | | Depends on https://github.com/swaywm/wlroots/pull/1223
| * Implement deprecated new_window and new_float commandsLibravatar Ryan Dwyer2018-09-01
| | | | | | | | | | | | | | | | | | May as well make it as easy as possible for users who are coming from i3. This also changes the `border` command to accept a thickness when setting the border to normal. This makes it work the same way as the `default_border` command. Eg. `border normal 5`
* | Fix feature macros for FreeBSDLibravatar sghctoma2018-08-30
|/ | | | | On FreeBSD, snprintf and vsnprintf are visible only if _XOPEN_SOURCE >= 600.
* commands: add nopLibravatar Ian Fan2018-08-18
|
* Write to swaynag pipe fd directly on config errorsLibravatar Brian Ashworth2018-08-03
|
* Show swaynag on config errorsLibravatar Brian Ashworth2018-08-03
|
* Implement scratchpadLibravatar Ryan Dwyer2018-07-23
| | | | | | | | | | | | | | Implements the following commands: * move scratchpad * scratchpad show * [criteria] scratchpad show Also fixes these: * Fix memory leak when executing command with criteria (use `list_free(views)` instead of `free(views)`) * Fix crash when running `move to` with no further arguments
* Implement floating_modifier and mouse operations for floating viewsLibravatar Ryan Dwyer2018-07-22
| | | | | | | | | | | | | | This implements the following: * `floating_modifier` configuration directive * Drag a floating window by its title bar * Hold mod + drag a floating window from anywhere * Resize a floating view by dragging the border * Resize a floating view by holding mod and right clicking anywhere on the view * Resize a floating view and keep aspect ratio by holding shift while resizing using either method * Mouse cursor turns into resize when hovering floating border or corner
* Implement force_display_urgency_hintLibravatar Ryan Dwyer2018-07-21
| | | | | | | | | | | | | The directive sets the timeout before an urgent view becomes normal again after switching to it from another workspace. Also: * When an xwayland surface removes the urgent hint while the timer is active, we now ignore the request. This happens as soon as the view receives focus, so it was effectively making the timer pointless. * The timeout is now only applied when switching to it from another workspace.
* Defer the focus commandsLibravatar Ryan Dwyer2018-07-19
|
* Implement default_floating_border command and adjust CSD behaviourLibravatar Ryan Dwyer2018-07-17
|
* Merge pull request #2276 from RyanDwyer/urgencyLibravatar Drew DeVault2018-07-16
|\ | | | | Implement urgency base functionality
| * Implement urgency base functionalityLibravatar Ryan Dwyer2018-07-16
| | | | | | | | | | | | Introduces a command to manually set urgency, as well as rendering of urgent views, sending the IPC event, removing urgency after focused for one second, and matching urgent views via criteria.
* | Implement no_focus commandLibravatar Ryan Dwyer2018-07-16
|/
* Make focus part of transactionsLibravatar Ryan Dwyer2018-07-15
| | | | | | | | | | | | Rather than maintain copies of the entire focus stack, this PR transactionises the focus by introducing two new properties to the container state and using those when rendering. * `bool focused` means this container has actual focus. Only one container should have this equalling true in its current state. * `struct sway_container *focus_inactive_child` points to the immediate child that was most recently focused (eg. for tabbed and stacked containers).
* 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.
* Implement floating_minimum_size and floating_maximum_sizeLibravatar Ryan Dwyer2018-07-11
|
* Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
|
* cmd_results_to_json: return copied string and properly free the jsonLibravatar Dominique Martinet2018-07-05
| | | | | | | The only user of this function would copy the string right away to get rid of the const flag anyway, and freeing a const string afterwards might work but is not meant to be done according to the json-c API.
* config_commands_command: make alloc failure check more permanentLibravatar Dominique Martinet2018-07-02
| | | | | | policy is accessed again later Found through static analysis
* Implement gaps (PR #2047)Libravatar Nate Symer2018-06-09
|
* Remove strip quoting and fix strncpy-overlapLibravatar Brian Ashworth2018-06-07
|
* Support runtime var expansion and set at runtimeLibravatar Brian Ashworth2018-06-05
|
* Address first round of review for generic blocksLibravatar Brian Ashworth2018-06-02
|
* Make command block implementation genericLibravatar Brian Ashworth2018-06-02
|
* Implement floatingLibravatar Ryan Dwyer2018-06-01
|
* Implement `floating enable`Libravatar Drew DeVault2018-06-01
|
* Implement config parser for workspace_layoutLibravatar Brian Ashworth2018-05-28
|
* Support i3's legacy force_focus_wrapping commandLibravatar Brian Ashworth2018-05-28
|
* Implement focus_wrappingLibravatar Brian Ashworth2018-05-27
|
* Implement swap commandLibravatar Brian Ashworth2018-05-26
|
* Implement show_marksLibravatar Ryan Dwyer2018-05-17
|
* Change unmark implemention to match i3'sLibravatar Ryan Dwyer2018-05-15
|