aboutsummaryrefslogtreecommitdiff
path: root/include/sway/criteria.h
AgeCommit message (Collapse)Author
2019-07-27Avoid adding duplicate criteria for no_focus and commandAshkan Kiani
2019-03-23criteria: fix __focused__ when no focus or unsetBrian Ashworth
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`.
2019-03-12criteria: change workspace to support regexBrian Ashworth
This changes the workspace criteria to support regex instead of basic strings. This matches i3's behavior.
2018-11-18Use #if instead of #ifdefemersion
2018-09-03move criteria "instance", "class" and "window_role" inside HAVE_XWAYLAND ifdefs"Pascal Pascher
2018-09-03Fixed window_type with disabled xwayland support.Pascal Pascher
2018-09-01Implement window_type criteria tokenRyan Dwyer
2018-08-18commands: complete assign commandIan Fan
2018-07-25reverted includes of "sway/config.h" and replaced with "config.h" from meson ↵Pascal Pascher
build
2018-07-24style fixes, exclude sway/desctop/xwayland.c when enable_xwayland: falsePascal Pascher
2018-07-24Added meson option "enable_xwayland" (default: true) to enable/disable ↵Pascal Pascher
xwayland support
2018-07-16Implement no_focus commandRyan Dwyer
2018-05-27Add shell criteria tokenRyan Dwyer
Closes #2044.
2018-05-14Revert "Revert "Merge pull request #1943 from RyanDwyer/criteria-improvements""Ryan Dwyer
This reverts commit 32a572cecfd0f6072a78ce0a381a2f8365f9010a. This reimplements the criteria overhaul in preparation for fixing a known bug.
2018-05-12Revert "Merge pull request #1943 from RyanDwyer/criteria-improvements"Drew DeVault
This reverts commit 3e1bf721c69cb6df70c3dc3d3d4933e987339676, reversing changes made to 2217518bd554d0f11dafa7ec4e8f35f2e4762fbd.
2018-05-11Overhaul criteria implementationRyan Dwyer
The criteria struct now uses properties for each token type rather than the list_t list of tokens. The reason for this is that different token types have different data types: pcre, string and number to name a few. This solution should be more flexible moving forward. A bonus of this is that criteria is now easier to understand when looking at the struct definition. The criteria parser has been rewritten because the previous one didn't support valueless pairs (eg. [class="foo" floating]). Criteria now has types. Types at the moment are CT_COMMAND, CT_ASSIGN_WORKSPACE and CT_ASSIGN_OUTPUT. i3 uses types as well. Previously the assign command was creating a criteria with 'move to workspace <name>' as its command, but this caused the window to appear briefly on the focused workspace before being moved to the assigned workspace. It now creates the view directly in the assigned workspace. Each view will only execute a given criteria once. This is achieved by storing a list of executed criteria in the view. This is the same strategy used by i3. Escaping now works properly. Previously you could do things like [class="Fire\"fox"] and the stored value would be 'Fire\"fox', but it should be (and now is) 'Fire"fox'. The public functions in criteria.c are now all prefixed with criteria_. Xwayland views now listen to the set_title, set_class and set_window_type events and criteria will be run when these happen. XDG shell has none of these events so it continues to update the title in handle_commit. Each view type's get_prop function has been split into get_string_prop and get_int_prop because some properties like the X11 window ID and window type are numeric. The following new criteria tokens are now supported: * id (X11 window ID) * instance * tiling * workspace
2018-03-29Revert "Merge pull request #1653 from swaywm/revert-1647-refactor-tree"Tony Crisci
This reverts commit 472e81f35d689d67cda241acafda91c688d61046, reversing changes made to 6b7841b11ff4cd35f54d69dc92029855893e5ce0.
2018-03-29Revert "Refactor tree"Drew DeVault
2018-03-29remove swayc_t typedefTony Crisci
2018-03-29move tree includes to their own directoryTony Crisci
2018-01-21criteria cleanupTony Crisci
2018-01-20basic command criteriaTony Crisci
2017-11-18Move everything to sway/old/Drew DeVault
2017-04-26Implement no_focusDrew DeVault
Ref #2
2017-04-05Improve criteria handlingCalvin Lee
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.
2016-09-01Reorganize includesDrew DeVault