aboutsummaryrefslogtreecommitdiff
path: root/sway/criteria.c
AgeCommit message (Collapse)Author
2018-07-23Store scratchpad list in sway_root instead of serverRyan Dwyer
2018-07-23Implement scratchpadRyan Dwyer
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
2018-07-17Free individual criteria in free_configfrsfnrrg
Also free cmd_list when cleaning up a struct criteria.
2018-07-16Implement urgency base functionalityRyan Dwyer
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.
2018-07-09Update for swaywm/wlroots#1126emersion
2018-06-08sway/criteria: gcc string truncation warning fixDominique Martinet
2018-06-01Replace is_floating boolean with functionRyan Dwyer
2018-06-01Implement floatingRyan Dwyer
2018-05-27Rename view_get_type to view_get_shellRyan Dwyer
2018-05-27Add shell criteria tokenRyan Dwyer
Closes #2044.
2018-05-15Implement marksRyan Dwyer
2018-05-14Initialise error_arg to NULL in criteria_parseRyan Dwyer
2018-05-14Fix double free in criteriaRyan Dwyer
2018-05-14Revert "Revert "Merge pull request #1953 from RyanDwyer/criteria-focused""Ryan Dwyer
This reverts commit ac0e62584f6101277b76622a7274866cd50f615c. This reimplements the criteria __focused__ commit in preparation for fixing a known bug.
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-12Revert "Merge pull request #1953 from RyanDwyer/criteria-focused"Drew DeVault
This reverts commit 2511adffc29996b64d01d85b3de31de9a2af9096, reversing changes made to 3e1bf721c69cb6df70c3dc3d3d4933e987339676.
2018-05-12Implement __focused__ criteriaRyan Dwyer
2018-05-11Don't unescape \\ in criteriaRyan Dwyer
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-04-08address feedbackTony Crisci
2018-04-08criteria match containersTony Crisci
2018-03-29Fix oversights from previous pull requestTony Crisci
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-29rename container_for_each_descendentTony Crisci
2018-03-29address feedbackTony Crisci
2018-03-29rename container functionsTony Crisci
2018-03-29move tree includes to their own directoryTony Crisci
2018-01-21criteria cleanupTony Crisci
2018-01-21implement property criteriaTony Crisci
2018-01-21view interfaceTony Crisci
2018-01-20basic command criteriaTony Crisci
2017-11-11Move sway's internal tree code to sway/tree/Drew DeVault
2017-10-08Fix #1291Drew DeVault
2017-10-08commands: allow criterion values to be unquotedlbonn
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
2017-10-08commands: implement 3 missing criteria from i3lbonn
* con_id * floating * tiling
2017-06-06FreeBSD fixesjohalun
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).
2017-04-26Implement no_focusDrew DeVault
Ref #2
2017-04-07Added designated initaliser, to prevent any possible problem withScott Anderson
ordering
2017-04-07Changed regular expressions to use PCRE for i3 compatibilityScott Anderson
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.
2017-04-03Impliment i3-style marksCalvin Lee
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
2017-03-10UnGNUify the codebaseDrew DeVault
2017-01-18Merge pull request #1053 from Hummer12007/__focused__Drew DeVault
Support __focused__ as a valid criterion
2017-01-19Support __focused__ as a valid criterionMykyta Holubakha
This reflects i3 behavior (see i3/i3#1770) Scrapping focused support will probably break some existing configs
2017-01-19Add window instance supportMykyta Holubakha
2016-09-01Reorganize includesDrew DeVault
2015-11-25criteria: Code formatting.S. Christoffer Eliesen
2015-11-25criteria: Add. Learn for_window command.S. Christoffer Eliesen
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.)