# have a look at bindings
next unless $line =~ /^bind/;
- my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)[ \t]+([^ \t]+)[ \t]+(.*)/);
+ my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)\s+([^\s]+)\s+(.*)/);
return 0 if $command =~ /^layout/ ||
$command =~ /^floating/ ||
$command =~ /^workspace/ ||
# skip everything but workspace lines
next unless defined($statement) and $statement eq 'workspace';
- my ($number, $params) = ($parameters =~ /[ \t]+([0-9]+) (.+)/);
+ my ($number, $params) = ($parameters =~ /\s+([0-9]+)\s+(.+)/);
# save workspace name (unless the line is actually a workspace assignment)
$workspace_names{$number} = $params unless $params =~ /^output/;
# workspace_bar is gone, you should use i3bar now
if ($statement eq 'workspace_bar') {
- $workspace_bar = ($parameters =~ /[ \t+](yes|true|on|enable|active)/);
+ $workspace_bar = ($parameters =~ /\s+(yes|true|on|enable|active)/);
print "# XXX: REMOVED workspace_bar line. There is no internal workspace bar in v4.\n";
next;
}
# one form of this is still ok (workspace assignments), the other (named workspaces) isn’t
if ($statement eq 'workspace') {
- my ($number, $params) = ($parameters =~ /[ \t]+([0-9]+) (.+)/);
+ my ($number, $params) = ($parameters =~ /\s+([0-9]+)\s+(.+)/);
if ($params =~ /^output/) {
print "$line\n";
next;
stack-limit
);
- my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)[ \t]+([^ \t]+)[ \t]+(.*)/);
+ my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)\s+([^\s]+)\s+(.*)/);
# turn 'bind' to 'bindcode'
$statement = 'bindcode' if $statement eq 'bind';
# goto command is now obsolete due to criteria + focus command
if ($command =~ /^goto/) {
- my ($mark) = ($command =~ /^goto (.*)/);
+ my ($mark) = ($command =~ /^goto\s+(.*)/);
print qq|$statement $key [con_mark="$mark"] focus\n|;
return;
}
# the jump command is also obsolete due to criteria + focus
if ($command =~ /^jump/) {
- my ($params) = ($command =~ /^jump (.*)/);
+ my ($params) = ($command =~ /^jump\s+(.*)/);
if ($params =~ /^"/) {
# jump ["]window class[/window title]["]
($params) = ($params =~ /^"([^"]+)"/);
}
if (!$replaced && $command =~ /^focus/) {
- my ($what) = ($command =~ /^focus (.*)/);
- $what =~ s/[ \t]//g;
+ my ($what) = ($command =~ /^focus\s+(.*)/);
+ $what =~ s/\s//g;
if ($what eq 'ft') {
$what = 'mode_toggle';
} elsif ($what eq 'floating' || $what eq 'tiling') {
}
if ($command =~ /^mode/) {
- my ($parameters) = ($command =~ /^mode (.*)/);
+ my ($parameters) = ($command =~ /^mode\s+(.*)/);
print qq|$statement $key mode "$parameters"\n|;
return;
}
if ($command =~ /^resize/) {
# OLD: resize <left|right|top|bottom> [+|-]<pixels>\n")
# NEW: resize <grow|shrink> <direction> [<px> px] [or <ppt> ppt]
- my ($direction, $sign, $px) = ($command =~ /^resize (left|right|top|bottom) ([+-])([0-9]+)/);
+ my ($direction, $sign, $px) = ($command =~ /^resize\s+(left|right|top|bottom)\s+([+-])([0-9]+)/);
my $cmd = 'resize ';
$cmd .= ($sign eq '+' ? 'grow' : 'shrink') . ' ';
if ($direction eq 'top') {
$output = migrate_config('bindsym Mod1+f resize bottom +23');
ok(line_exists($output, qr|^bindsym Mod1\+f resize grow down 23 px$|), 'resize bottom changed');
+#####################################################################
+# also resizing, but with indention this time
+#####################################################################
+
+$output = migrate_config("bindsym Mod1+f resize left \t +10");
+ok(line_exists($output, qr|^bindsym Mod1\+f resize grow left 10 px$|), 'resize left changed');
+
#####################################################################
# check whether jump's parameters get changed correctly
#####################################################################