aboutsummaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
Commit message (Collapse)AuthorAge
* Introduce pid criteria tokenLibravatar Ryan Dwyer2020-02-27
| | | | | | | | | | This can be used as a workaround to flag terminal windows as urgent when commands are completed, until urgency is introduced in the Wayland protocol. Configure your shell to run `swaymsg "[pid=$PPID] urgent enable"` when commands are completed, and use a terminal which uses one process per window.
* criteria: match containers without viewLibravatar Anders2020-02-04
| | | | | | | | Closes #4929 Replaces criteria_get_views with criteria_get_containers which can return containers without views when the criteria only contains container properties.
* criteria: make literal comparison for __focused__ valuesLibravatar Ronan Pigott2019-10-27
|
* Avoid adding duplicate criteria for no_focus and commandLibravatar Ashkan Kiani2019-07-27
|
* criteria: fix __focused__ when no focus or unsetLibravatar Brian Ashworth2019-03-23
| | | | | | | | | | | | | | | | | | | | | | | | This fixes the behavior of `__focused__` when there is no focused view to match i3's behavior of successfully matching no views instead of returning an error of a missing value. It also applies the same logic when a token is not applicable (or unset) for a view such as `app_id` for a focused xwayland view or `class` for a focused xdg-shell view. This adds an `autofail` boolean to `struct criteria`. If it is set to `true`, then `criteria_matches_view` will immediately bail out as a no match. If `autofail` is set, the criteria will also not be considered empty by `criteria_is_empty`. To set this new `autofail` property, `get_focused_prop` will now take in a boolean pointer of the same name. If `__focused__` is supported for the token and there is no focused view or the focused view does not have a value for the token, then the boolean will be set to true. In `parse_token`, the boolean value will be checked and if set to true, then `criteria->autofail` will be set to true and `parse_token` will bail successfully. Tokens will still be parsed to make sure the whole criteria is syntactically valid, which is also why `&criteria->autofail` is not passed to `get_focused_prop` and a local boolean is declared in `parse_token`.
* criteria: change workspace to support regexLibravatar Brian Ashworth2019-03-12
| | | | | This changes the workspace criteria to support regex instead of basic strings. This matches i3's behavior.
* fix "directive argument is null" errorsLibravatar Jeff Peeler2019-03-09
|
* Revert "Add some missing frees."Libravatar Connor E2019-02-01
| | | | This reverts commit b5d95f264d5b08f6228e05be680ee36fc06ca6d6.
* 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.
* Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
| | | | And make sure we don't define both in the same source file.
* Use #if instead of #ifdefLibravatar emersion2018-11-18
|
* Add some missing frees.Libravatar Connor E2018-11-13
|
* Move view marks properties to container structLibravatar Ryan Dwyer2018-11-01
| | | | | Like border properties, this will be needed to implement layout saving and restoring.
* Parse missing i3 window typesLibravatar Christian2018-10-21
| | | | fixes the parsing part of #2906
* 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 tiling criteriaLibravatar Ryan Dwyer2018-10-03
|
* Parse floating criteriaLibravatar Ragnis Armus2018-09-30
|
* Fix inversed condition in criteriaLibravatar 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.
* Implement window_role criteria tokenLibravatar Ryan Dwyer2018-09-04
| | | | Depends on https://github.com/swaywm/wlroots/pull/1226
* move criteria "instance", "class" and "window_role" inside HAVE_XWAYLAND ifdefs"Libravatar Pascal Pascher2018-09-03
|
* Fixed window_type with disabled xwayland support.Libravatar Pascal Pascher2018-09-03
|
* Implement window_type criteria tokenLibravatar Ryan Dwyer2018-09-01
|
* Remove layout.cLibravatar Ryan Dwyer2018-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | When we have type safety we'll need to have functions for workspace_add_tiling and so on. This means the existing container functions will be just for containers, so they are being moved to container.c. At this point layout.c doesn't contain much else, so I've relocated everything and removed the file. * container_swap and its static functions have been moved to the swap command and made static. * container_recursive_resize has been moved to the resize command and made static. * The following have been moved to container.c: * container_handle_fullscreen_reparent * container_insert_child * container_add_sibling * container_add_child * container_remove_child * container_replace_child * container_split * enum movement_direction and sway_dir_to_wlr have been moved to util.c. Side note: Several commands included layout.h which then included root.h. With layout.h gone, root.h has to be included by those commands.
* Implement iterators per container typeLibravatar Ryan Dwyer2018-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove container_for_each_descendant_bfsLibravatar Ryan Dwyer2018-08-11
| | | | | | | The function was not used. Also renames container_for_each_descendant_dfs to just container_for_each_descendant.
* commands: better type for con_id string lengthLibravatar Ian Fan2018-08-06
|
* commands: allow __focused__ for con_id criterionLibravatar Ian Fan2018-08-06
|
* commands: allow "first", "last", "newest" and "recent" as values for urgent ↵Libravatar Ian Fan2018-08-06
| | | | criteria
* more style fixes, reorder config.h includeLibravatar Pascal Pascher2018-07-25
|
* more style fixes, included "sway/config.h" where neededLibravatar Pascal Pascher2018-07-25
|
* Added meson option "enable_xwayland" (default: true) to enable/disable ↵Libravatar Pascal Pascher2018-07-24
| | | | xwayland support
* Store scratchpad list in sway_root instead of serverLibravatar Ryan Dwyer2018-07-23
|
* 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
* Free individual criteria in free_configLibravatar frsfnrrg2018-07-17
| | | | Also free cmd_list when cleaning up a struct criteria.
* 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.
* Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
|
* sway/criteria: gcc string truncation warning fixLibravatar Dominique Martinet2018-06-08
|
* Replace is_floating boolean with functionLibravatar Ryan Dwyer2018-06-01
|
* Implement floatingLibravatar Ryan Dwyer2018-06-01
|
* Rename view_get_type to view_get_shellLibravatar Ryan Dwyer2018-05-27
|
* Add shell criteria tokenLibravatar Ryan Dwyer2018-05-27
| | | | Closes #2044.
* Implement marksLibravatar Ryan Dwyer2018-05-15
|
* Initialise error_arg to NULL in criteria_parseLibravatar Ryan Dwyer2018-05-14
|
* Fix double free in criteriaLibravatar Ryan Dwyer2018-05-14
|
* Revert "Revert "Merge pull request #1953 from RyanDwyer/criteria-focused""Libravatar Ryan Dwyer2018-05-14
| | | | | | | This reverts commit ac0e62584f6101277b76622a7274866cd50f615c. This reimplements the criteria __focused__ commit in preparation for fixing a known bug.
* Revert "Revert "Merge pull request #1943 from RyanDwyer/criteria-improvements""Libravatar Ryan Dwyer2018-05-14
| | | | | | | This reverts commit 32a572cecfd0f6072a78ce0a381a2f8365f9010a. This reimplements the criteria overhaul in preparation for fixing a known bug.
* Revert "Merge pull request #1943 from RyanDwyer/criteria-improvements"Libravatar Drew DeVault2018-05-12
| | | | | This reverts commit 3e1bf721c69cb6df70c3dc3d3d4933e987339676, reversing changes made to 2217518bd554d0f11dafa7ec4e8f35f2e4762fbd.
* Revert "Merge pull request #1953 from RyanDwyer/criteria-focused"Libravatar Drew DeVault2018-05-12
| | | | | This reverts commit 2511adffc29996b64d01d85b3de31de9a2af9096, reversing changes made to 3e1bf721c69cb6df70c3dc3d3d4933e987339676.
* Implement __focused__ criteriaLibravatar Ryan Dwyer2018-05-12
|