Implement new criterion 'workspace'.

If the match expression is a plain number (e.g., '99'), the number of a workspace will be compared strictly. Otherwise, the match expression is taken as a regular expression and compared against the workspace's name.
This allows all of the following:

for_window [workspace=5] ...
for_window [workspace="5:foo"] ...
for_window [workspace="foo"] ...

fixes #1769
This commit is contained in:
Ingo Bürk
2015-06-29 23:58:48 +02:00
parent 8df7e4ecb9
commit be406d036d
8 changed files with 55 additions and 2 deletions

View File

@ -17,6 +17,8 @@
use i3test i3_autostart => 0;
use X11::XCB qw(PROP_MODE_REPLACE);
my (@nodes);
##############################################################
# 1: test the following directive:
# for_window [class="borderless"] border none
@ -435,6 +437,27 @@ EOT
}
##############################################################
# 12: check that the criterion 'workspace' works
##############################################################
$config = <<"EOT";
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [workspace="trigger"] floating enable, mark triggered
EOT
$pid = launch_with_config($config);
cmd 'workspace trigger';
$window = open_window;
@nodes = @{get_ws('trigger')->{floating_nodes}};
cmp_ok(@nodes, '==', 1, 'one floating container on this workspace');
is($nodes[0]->{nodes}[0]->{mark}, 'triggered', "mark set for workspace criterion");
exit_gracefully($pid);
##############################################################
done_testing;