Commit graph

11 commits

Author SHA1 Message Date
Scott Anderson 3a32be67ed Added designated initaliser, to prevent any possible problem with
ordering
2017-04-07 00:34:33 +12:00
Scott Anderson fe54a6725e Changed regular expressions to use PCRE for i3 compatibility 2017-04-07 00:16:06 +12:00
Calvin Lee 069d37f987 Improve criteria handling
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-05 22:07:23 -06:00
Calvin Lee 2445d27960 Impliment i3-style marks
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-04-03 11:48:37 -06:00
Drew DeVault 9aed9d9359 UnGNUify the codebase 2017-03-10 23:41:24 -05:00
Drew DeVault 7cc6f288d9 Merge pull request #1053 from Hummer12007/__focused__
Support __focused__ as a valid criterion
2017-01-18 22:54:19 -05:00
Mykyta Holubakha 28278864b4 Support __focused__ as a valid criterion
This reflects i3 behavior (see i3/i3#1770)

Scrapping focused support will probably break some existing configs
2017-01-19 03:58:31 +02:00
Mykyta Holubakha e714fbcbec Add window instance support 2017-01-19 03:14:59 +02:00
Drew DeVault 416417a54c Reorganize includes 2016-09-01 08:18:37 -04:00
S. Christoffer Eliesen 5483fe1883 criteria: Code formatting. 2015-11-25 14:59:07 +01:00
S. Christoffer Eliesen a06cb7cd01 criteria: Add. Learn for_window command.
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.)
2015-11-25 14:34:33 +01:00