Make floating_from and tiling_from criterion work in commands, too (#5278)
Fixes https://github.com/i3/i3/issues/5258
This commit is contained in:
parent
2ac6180b90
commit
1ba0eaca22
@ -57,6 +57,8 @@ state CRITERIA:
|
|||||||
ctype = 'urgent' -> CRITERION
|
ctype = 'urgent' -> CRITERION
|
||||||
ctype = 'workspace' -> CRITERION
|
ctype = 'workspace' -> CRITERION
|
||||||
ctype = 'machine' -> CRITERION
|
ctype = 'machine' -> CRITERION
|
||||||
|
ctype = 'floating_from' -> CRITERION_FROM
|
||||||
|
ctype = 'tiling_from' -> CRITERION_FROM
|
||||||
ctype = 'tiling', 'floating', 'all'
|
ctype = 'tiling', 'floating', 'all'
|
||||||
-> call cmd_criteria_add($ctype, NULL); CRITERIA
|
-> call cmd_criteria_add($ctype, NULL); CRITERIA
|
||||||
']' -> call cmd_criteria_match_windows(); INITIAL
|
']' -> call cmd_criteria_match_windows(); INITIAL
|
||||||
@ -64,6 +66,22 @@ state CRITERIA:
|
|||||||
state CRITERION:
|
state CRITERION:
|
||||||
'=' -> CRITERION_STR
|
'=' -> CRITERION_STR
|
||||||
|
|
||||||
|
state CRITERION_FROM:
|
||||||
|
'=' -> CRITERION_FROM_STR_START
|
||||||
|
|
||||||
|
state CRITERION_FROM_STR_START:
|
||||||
|
'"' -> CRITERION_FROM_STR
|
||||||
|
kind = 'auto', 'user'
|
||||||
|
-> call cmd_criteria_add($ctype, $kind); CRITERIA
|
||||||
|
|
||||||
|
state CRITERION_FROM_STR:
|
||||||
|
kind = 'auto', 'user'
|
||||||
|
-> CRITERION_FROM_STR_END
|
||||||
|
|
||||||
|
state CRITERION_FROM_STR_END:
|
||||||
|
'"'
|
||||||
|
-> call cmd_criteria_add($ctype, $kind); CRITERIA
|
||||||
|
|
||||||
state CRITERION_STR:
|
state CRITERION_STR:
|
||||||
cvalue = word
|
cvalue = word
|
||||||
-> call cmd_criteria_add($ctype, $cvalue); CRITERIA
|
-> call cmd_criteria_add($ctype, $cvalue); CRITERIA
|
||||||
|
1
release-notes/bugfixes/3-floating-from-tiling-from
Normal file
1
release-notes/bugfixes/3-floating-from-tiling-from
Normal file
@ -0,0 +1 @@
|
|||||||
|
The floating_from and tiling_from criteria now also work in commands
|
@ -14,7 +14,10 @@
|
|||||||
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
||||||
# (unless you are already familiar with Perl)
|
# (unless you are already familiar with Perl)
|
||||||
#
|
#
|
||||||
use i3test i3_config => <<EOT;
|
use i3test i3_autostart => 0;
|
||||||
|
use X11::XCB qw(PROP_MODE_REPLACE);
|
||||||
|
|
||||||
|
my $config = <<EOT;
|
||||||
# i3 config file (v4)
|
# i3 config file (v4)
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
for_window [tiling] mark --add tiling
|
for_window [tiling] mark --add tiling
|
||||||
@ -26,7 +29,8 @@ for_window [floating_from="auto"] mark --add floating_auto
|
|||||||
for_window [tiling_from="user"] mark --add tiling_user
|
for_window [tiling_from="user"] mark --add tiling_user
|
||||||
for_window [floating_from="user"] mark --add floating_user
|
for_window [floating_from="user"] mark --add floating_user
|
||||||
EOT
|
EOT
|
||||||
use X11::XCB qw(PROP_MODE_REPLACE);
|
|
||||||
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Check that the auto tiling / floating criteria work.
|
# Check that the auto tiling / floating criteria work.
|
||||||
@ -83,4 +87,45 @@ is_deeply($nodes[0]->{nodes}[0]->{marks}, [ 'B', 'floating_user' ], "Only 'float
|
|||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
|
exit_gracefully($pid);
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Verify floating_from/tiling_from works as command criterion (issue #5258).
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
$config = <<EOT;
|
||||||
|
# i3 config file (v4)
|
||||||
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
|
|
||||||
|
for_window [tiling] mark --add tiling
|
||||||
|
for_window [floating] mark --add floating
|
||||||
|
EOT
|
||||||
|
|
||||||
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
|
$tmp = fresh_workspace;
|
||||||
|
$A = open_window;
|
||||||
|
$B = open_floating_window;
|
||||||
|
|
||||||
|
@nodes = @{get_ws($tmp)->{nodes}};
|
||||||
|
cmp_ok(@nodes, '==', 1, 'one tiling container on this workspace');
|
||||||
|
is_deeply($nodes[0]->{marks}, [ 'tiling' ], "mark set for 'tiling' criterion");
|
||||||
|
|
||||||
|
@nodes = @{get_ws($tmp)->{floating_nodes}};
|
||||||
|
cmp_ok(@nodes, '==', 1, 'one floating container on this workspace');
|
||||||
|
is_deeply($nodes[0]->{nodes}[0]->{marks}, [ 'floating' ], "mark set for 'floating' criterion");
|
||||||
|
|
||||||
|
cmd '[tiling_from="auto" con_mark="tiling"] mark --add tiling_auto';
|
||||||
|
cmd '[floating_from="auto" con_mark="floating"] mark --add floating_auto';
|
||||||
|
|
||||||
|
@nodes = @{get_ws($tmp)->{nodes}};
|
||||||
|
cmp_ok(@nodes, '==', 1, 'one tiling container on this workspace');
|
||||||
|
is_deeply($nodes[0]->{marks}, [ 'tiling', 'tiling_auto' ], "mark set for 'tiling' criterion");
|
||||||
|
|
||||||
|
@nodes = @{get_ws($tmp)->{floating_nodes}};
|
||||||
|
cmp_ok(@nodes, '==', 1, 'one floating container on this workspace');
|
||||||
|
is_deeply($nodes[0]->{nodes}[0]->{marks}, [ 'floating', 'floating_auto' ], "mark set for 'floating' criterion");
|
||||||
|
|
||||||
|
exit_gracefully($pid);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user