aboutsummaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
Commit message (Collapse)AuthorAge
...
* 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
|
* Don't unescape \\ in criteriaLibravatar Ryan Dwyer2018-05-11
|
* Overhaul criteria implementationLibravatar Ryan Dwyer2018-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* address feedbackLibravatar Tony Crisci2018-04-08
|
* criteria match containersLibravatar Tony Crisci2018-04-08
|
* Fix oversights from previous pull requestLibravatar Tony Crisci2018-03-29
|
* Revert "Merge pull request #1653 from swaywm/revert-1647-refactor-tree"Libravatar Tony Crisci2018-03-29
| | | | | This reverts commit 472e81f35d689d67cda241acafda91c688d61046, reversing changes made to 6b7841b11ff4cd35f54d69dc92029855893e5ce0.
* Revert "Refactor tree"Libravatar Drew DeVault2018-03-29
|
* rename container_for_each_descendentLibravatar Tony Crisci2018-03-29
|
* address feedbackLibravatar Tony Crisci2018-03-29
|
* rename container functionsLibravatar Tony Crisci2018-03-29
|
* move tree includes to their own directoryLibravatar Tony Crisci2018-03-29
|
* criteria cleanupLibravatar Tony Crisci2018-01-21
|
* implement property criteriaLibravatar Tony Crisci2018-01-21
|
* view interfaceLibravatar Tony Crisci2018-01-21
|
* basic command criteriaLibravatar Tony Crisci2018-01-20
|
* Move sway's internal tree code to sway/tree/Libravatar Drew DeVault2017-11-11
|
* Fix #12910.15-rc1Libravatar Drew DeVault2017-10-08
|
* commands: allow criterion values to be unquotedLibravatar lbonn2017-10-08
| | | | | | | | Sometimes it doesn't really make sense to quote them (numeric values for example) In that case, the value is parsed until the next space or the end of the whole criteria expression
* commands: implement 3 missing criteria from i3Libravatar lbonn2017-10-08
| | | | | | * con_id * floating * tiling
* FreeBSD fixesLibravatar johalun2017-06-06
| | | | | | | Increase _POSIX_SOURCE value where needed. Increase _XOPEN_SOURCE value where needed. Conditionally link to libcap (only on Linux). Possibly some trailing whitespace fixes (automatic).
* Implement no_focusLibravatar Drew DeVault2017-04-26
| | | | Ref #2
* Added designated initaliser, to prevent any possible problem withLibravatar Scott Anderson2017-04-07
| | | | ordering
* Changed regular expressions to use PCRE for i3 compatibilityLibravatar Scott Anderson2017-04-07
|
* Improve criteria handlingLibravatar Calvin Lee2017-04-05
| | | | | | | | | | | | | | 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.
* Impliment i3-style marksLibravatar Calvin Lee2017-04-03
| | | | | | | | This commit adds three commands to sway: `show_marks`, `mark` and `unmark`. Marks are displayed right-aligned in the window border as i3 does. Marks may be found using criteria. Fixes #1007
* UnGNUify the codebaseLibravatar Drew DeVault2017-03-10
|
* Merge pull request #1053 from Hummer12007/__focused__Libravatar Drew DeVault2017-01-18
|\ | | | | Support __focused__ as a valid criterion
| * Support __focused__ as a valid criterionLibravatar Mykyta Holubakha2017-01-19
| | | | | | | | | | | | This reflects i3 behavior (see i3/i3#1770) Scrapping focused support will probably break some existing configs
* | Add window instance supportLibravatar Mykyta Holubakha2017-01-19
|/
* Reorganize includesLibravatar Drew DeVault2016-09-01
|
* criteria: Code formatting.Libravatar S. Christoffer Eliesen2015-11-25
|
* criteria: Add. Learn for_window command.Libravatar S. Christoffer Eliesen2015-11-25
A criteria is a string in the form of `[class="regex.*" title="str"]`. It is stored in a struct with a list of *tokens* which is a attribute/value pair (stored as a `crit_token` struct). Most tokens will also have a precompiled regex stored that will be used during criteria matching. for_window command: When a new view is created its metadata is tested against all stored criteria, and if a match is found the associated command list is executed. Unfortunately some metadata is not available in sway at the moment (specifically `instance`, `window_role` and `urgent`). Any criteria string that tries to match an unsupported attribute will fail. (Note that while the criteria code can be used to parse any criteria string it is currently only used by the `for_window` command.)