From: Michael Stapelberg Date: Sun, 31 Jul 2011 21:11:05 +0000 (+0200) Subject: i3-migrate-config-to-v4: drop the .pl suffix X-Git-Tag: 4.0~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8353b9625d8da911c7fff35e74f321d356f3aa2c;p=i3%2Fi3 i3-migrate-config-to-v4: drop the .pl suffix As lintian (a Debian package checker) mentions, it is more clever to install it without the extension, since the implementation language might change. --- diff --git a/DEPENDS b/DEPENDS index 71abc3b2..ea7133a5 100644 --- a/DEPENDS +++ b/DEPENDS @@ -35,5 +35,5 @@ All of them are available at CPAN, see http://search.cpan.org/ Use your distribution’s packages or cpan(1) to install them. - i3-migrate-config-to-v4.pl is implemented in Perl, but it has no dependencies + i3-migrate-config-to-v4 is implemented in Perl, but it has no dependencies besides Perl 5.10. diff --git a/Makefile b/Makefile index 7a904320..3bdffbb4 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ install: all $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/include/i3 $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/share/xsessions $(INSTALL) -m 0755 i3 $(DESTDIR)$(PREFIX)/bin/ - $(INSTALL) -m 0755 i3-migrate-config-to-v4.pl $(DESTDIR)$(PREFIX)/bin/ + $(INSTALL) -m 0755 i3-migrate-config-to-v4 $(DESTDIR)$(PREFIX)/bin/ test -e $(DESTDIR)$(SYSCONFDIR)/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)$(SYSCONFDIR)/i3/config test -e $(DESTDIR)$(SYSCONFDIR)/i3/config.keycodes || $(INSTALL) -m 0644 i3.config.keycodes $(DESTDIR)$(SYSCONFDIR)/i3/config.keycodes $(INSTALL) -m 0644 i3.welcome $(DESTDIR)$(SYSCONFDIR)/i3/welcome @@ -93,7 +93,7 @@ dist: distclean [ ! -d i3-${VERSION} ] || rm -rf i3-${VERSION} [ ! -e i3-${VERSION}.tar.bz2 ] || rm i3-${VERSION}.tar.bz2 mkdir i3-${VERSION} - cp i3-migrate-config-to-v4.pl i3.config.keycodes DEPENDS GOALS LICENSE PACKAGE-MAINTAINER TODO RELEASE-NOTES-${VERSION} i3.config i3.desktop i3.welcome pseudo-doc.doxygen i3-wsbar Makefile i3-${VERSION} + cp i3-migrate-config-to-v4 i3.config.keycodes DEPENDS GOALS LICENSE PACKAGE-MAINTAINER TODO RELEASE-NOTES-${VERSION} i3.config i3.desktop i3.welcome pseudo-doc.doxygen i3-wsbar Makefile i3-${VERSION} cp -r src i3-msg i3-nagbar i3-config-wizard yajl-fallback include man i3-${VERSION} # Only copy toplevel documentation (important stuff) mkdir i3-${VERSION}/docs diff --git a/PACKAGE-MAINTAINER b/PACKAGE-MAINTAINER index 633b2d7e..3d9a8e18 100644 --- a/PACKAGE-MAINTAINER +++ b/PACKAGE-MAINTAINER @@ -26,7 +26,7 @@ On debian, this looks like this: mkdir -p $(CURDIR)/debian/i3-wm/usr/share/man/man1 cp man/*.1 $(CURDIR)/debian/i3-wm/usr/share/man/man1 -Please make sure that i3-migrate-config-to-v4.pl and i3-config-wizard are +Please make sure that i3-migrate-config-to-v4 and i3-config-wizard are installed with i3. The Perl script is necessary to (automatically) convert v3 configs to v4. The wizard provides the possibility to create a keysym-based config with the user’s preferred modifier and should be started on the first diff --git a/RELEASE-NOTES-4.0 b/RELEASE-NOTES-4.0 index a9a91134..14ecbfa1 100644 --- a/RELEASE-NOTES-4.0 +++ b/RELEASE-NOTES-4.0 @@ -40,7 +40,7 @@ now. • As the configuration file needs new commands (and a few options are obsolete), you need to change it. To make this process a little bit easier - for you, this release comes with the script i3-migrate-config-to-v4.pl. Just + for you, this release comes with the script i3-migrate-config-to-v4. Just run it on your current config file and it will spit out a v4 config file to stdout. To make things even better, i3 automatically detects v3 config files and calls that script, so you never end up with a non-working config :). diff --git a/debian/changelog b/debian/changelog index bfcbc324..aeca9a2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,7 +14,7 @@ i3-wm (4.0-1) unstable; urgency=low of all Firefox windows. * As the configuration file needs new commands (and a few options are obsolete), you need to change it. To make this process a little bit easier - for you, this release comes with the script i3-migrate-config-to-v4.pl. Just + for you, this release comes with the script i3-migrate-config-to-v4. Just run it on your current config file and it will spit out a v4 config file to stdout. To make things even better, i3 automatically detects v3 config files and calls that script, so you never end up with a non-working config :). diff --git a/i3-migrate-config-to-v4 b/i3-migrate-config-to-v4 new file mode 100755 index 00000000..5f20cba1 --- /dev/null +++ b/i3-migrate-config-to-v4 @@ -0,0 +1,358 @@ +#!/usr/bin/env perl +# vim:ts=4:sw=4:expandtab +# +# script to migrate an old config file (i3 < 4.0) to the new format (>= 4.0) +# this script only uses modules which come with perl 5.10 +# +# reads an i3 v3 config from stdin and spits out a v4 config on stdout +# exit codes: +# 0 = the input was a v3 config +# 1 = the input was already a v4 config +# (the config is printed to stdout nevertheless) +# +# © 2011 Michael Stapelberg and contributors, see LICENSE + +use strict; +use warnings; +use Getopt::Long; +use v5.10; + +# is this a version 3 config file? disables auto-detection +my $v3 = 0; +my $result = GetOptions('v3' => \$v3); + +# reads stdin +sub slurp { + local $/; + <>; +} + +my @unchanged = qw( + font + set + mode + exec + assign + floating_modifier + focus_follows_mouse + ipc-socket + ipc_socket + client.focused + client.focused_inactive + client.unfocused + client.urgent + client.background +); + +my %workspace_names; +my $workspace_bar = 1; + +my $input = slurp(); +my @lines = split /\n/, $input; + +# remove whitespaces in the beginning of lines +@lines = map { s/^[ \t]*//g; $_ } @lines; + +# Try to auto-detect if this is a v3 config file. +sub need_to_convert { + # If the user passed --v3, we need to convert in any case + return 1 if $v3; + + for my $line (@lines) { + # only v4 configfiles can use bindcode or workspace_layout + return 0 if $line =~ /^bindcode/ || + $line =~ /^workspace_layout/ || + $line =~ /^force_focus_wrapping/; + + # have a look at bindings + next unless $line =~ /^bind/; + + my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)[ \t]+([^ \t]+)[ \t]+(.*)/); + return 0 if $command =~ /^layout/ || + $command =~ /^floating/ || + $command =~ /^workspace/ || + $command =~ /^focus (left|right|up|down)/ || + $command =~ /^border (normal|1pixel|none)/; + } + + return 1; +} + +if (!need_to_convert()) { + # If this is already a v4 config file, we will spit out the lines + # and exit with return code 1 + print $input; + exit 1; +} + +# first pass: get workspace names +for my $line (@lines) { + next if $line =~ /^#/ || $line =~ /^$/; + + my ($statement, $parameters) = ($line =~ /([a-zA-Z._-]+)(.*)/); + + # skip everything but workspace lines + next unless defined($statement) and $statement eq 'workspace'; + + my ($number, $params) = ($parameters =~ /[ \t]+([0-9]+) (.+)/); + + # save workspace name (unless the line is actually a workspace assignment) + $workspace_names{$number} = $params unless $params =~ /^output/; +} + +for my $line (@lines) { + # directly use comments and empty lines + if ($line =~ /^#/ || $line =~ /^$/) { + print "$line\n"; + next; + } + + my ($statement, $parameters) = ($line =~ /([a-zA-Z._-]+)(.*)/); + + # directly use lines which have not changed between 3.x and 4.x + if (!defined($statement) || (lc $statement ~~ @unchanged)) { + print "$line\n"; + next; + } + + # new_container changed only the statement name to workspace_layout + if ($statement eq 'new_container') { + # TODO: new_container stack-limit + print "workspace_layout$parameters\n"; + next; + } + + # workspace_bar is gone, you should use i3bar now + if ($statement eq 'workspace_bar') { + $workspace_bar = ($parameters =~ /[ \t+](yes|true|on|enable|active)/); + print "# XXX: REMOVED workspace_bar line. There is no internal workspace bar in v4.\n"; + next; + } + + # new_window changed the parameters from bb to none etc. + if ($statement eq 'new_window') { + if ($parameters =~ /bb/) { + print "new_window none\n"; + } elsif ($parameters =~ /bp/) { + print "new_window 1pixel\n"; + } elsif ($parameters =~ /bn/) { + print "new_window normal\n"; + } else { + print "# XXX: Invalid parameter for new_window, not touching line:\n"; + print "$line\n"; + } + next; + } + + # bar colors are obsolete, need to be configured in i3bar + if ($statement =~ /^bar\./) { + print "# XXX: REMOVED $statement, configure i3bar instead.\n"; + print "# Old line: $line\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]+) (.+)/); + if ($params =~ /^output/) { + print "$line\n"; + next; + } else { + print "# XXX: workspace name will end up in the corresponding bindings.\n"; + next; + } + } + + if ($statement eq 'bind' || $statement eq 'bindsym') { + convert_command($line); + next; + } + + print "# XXX: migration script could not handle line: $line\n"; +} + +# +# Converts a command (after bind/bindsym) +# +sub convert_command { + my ($line) = @_; + + my @unchanged_cmds = qw( + exec + mark + kill + restart + reload + exit + stack-limit + ); + + my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)[ \t]+([^ \t]+)[ \t]+(.*)/); + + # turn 'bind' to 'bindcode' + $statement = 'bindcode' if $statement eq 'bind'; + + # check if it’s one of the unchanged commands + my ($cmd) = ($command =~ /([a-zA-Z_-]+)/); + if ($cmd ~~ @unchanged_cmds) { + print "$statement $key $command\n"; + return; + } + + # simple replacements + my @replace = ( + qr/^s/ => 'layout stacking', + qr/^d/ => 'layout default', + qr/^T/ => 'layout tabbed', + qr/^f($|[^go])/ => 'fullscreen', + qr/^fg/ => 'fullscreen global', + qr/^t/ => 'floating toggle', + qr/^h/ => 'focus left', + qr/^j($|[^u])/ => 'focus down', + qr/^k/ => 'focus up', + qr/^l/ => 'focus right', + qr/^mh/ => 'move left', + qr/^mj/ => 'move down', + qr/^mk/ => 'move up', + qr/^ml/ => 'move right', + qr/^bn/ => 'border normal', + qr/^bp/ => 'border 1pixel', + qr/^bb/ => 'border none', + qr/^bt/ => 'border toggle', + qr/^pw/ => 'workspace prev', + qr/^nw/ => 'workspace next', + ); + + my $replaced = 0; + for (my $c = 0; $c < @replace; $c += 2) { + if ($command =~ $replace[$c]) { + $command = $replace[$c+1]; + $replaced = 1; + last; + } + } + + # goto command is now obsolete due to criteria + focus command + if ($command =~ /^goto/) { + my ($mark) = ($command =~ /^goto (.*)/); + 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 (.*)/); + if ($params =~ /^"/) { + # jump ["]window class[/window title]["] + ($params) = ($params =~ /^"([^"]+)"/); + + # check if a window title was specified + if ($params =~ m,/,) { + my ($class, $title) = ($params =~ m,([^/]+)/(.+),); + print qq|$statement $key [class="$class" title="$title"] focus\n|; + } else { + print qq|$statement $key [class="$params"] focus\n|; + } + return; + } else { + # jump [ column row ] + print "# XXX: jump workspace is obsolete in 4.x: $line\n"; + return; + } + } + + if (!$replaced && $command =~ /^focus/) { + my ($what) = ($command =~ /^focus (.*)/); + $what =~ s/[ \t]//g; + if ($what eq 'ft') { + $what = 'mode_toggle'; + } elsif ($what eq 'floating' || $what eq 'tiling') { + # those are unchanged + } else { + print "# XXX: focus is obsolete in 4.x: $line\n"; + return; + } + print qq|$statement $key focus $what\n|; + return; + } + + if ($command =~ /^mode/) { + my ($parameters) = ($command =~ /^mode (.*)/); + print qq|$statement $key mode "$parameters"\n|; + return; + } + + # the parameters of the resize command have changed + if ($command =~ /^resize/) { + # OLD: resize [+|-]\n") + # NEW: resize [ px] [or ppt] + my ($direction, $sign, $px) = ($command =~ /^resize (left|right|top|bottom) ([+-])([0-9]+)/); + my $cmd = 'resize '; + $cmd .= ($sign eq '+' ? 'grow' : 'shrink') . ' '; + $cmd .= "$direction "; + $cmd .= "$px px"; + print qq|$statement $key $cmd\n|; + return; + } + + # switch workspace + if ($command =~ /^[0-9]+/) { + my ($number) = ($command =~ /^([0-9]+)/); + if (exists $workspace_names{$number}) { + print qq|$statement $key workspace $workspace_names{$number}\n|; + return; + } else { + print qq|$statement $key workspace $number\n|; + return; + } + } + + # move to workspace + if ($command =~ /^m[0-9]+/) { + my ($number) = ($command =~ /^m([0-9]+)/); + if (exists $workspace_names{$number}) { + print qq|$statement $key move workspace $workspace_names{$number}\n|; + return; + } else { + print qq|$statement $key move workspace $number\n|; + return; + } + } + + # With Container-commands are now obsolete due to different abstraction + if ($command =~ /^wc/) { + $command =~ s/^wc//g; + my $wc_replaced = 0; + for (my $c = 0; $c < @replace; $c += 2) { + if ($command =~ $replace[$c]) { + $command = $replace[$c+1]; + $wc_replaced = 1; + last; + } + } + if (!$wc_replaced) { + print "# XXX: migration script could not handle command: $line\n"; + } else { + # NOTE: This is not 100% accurate, as it only works for one level + # of nested containers. As this is a common use case, we use 'focus + # parent; $command' nevertheless. For advanced use cases, the user + # has to modify his config. + print "$statement $key focus parent; $command\n"; + } + return; + } + + if ($replaced) { + print "$statement $key $command\n"; + } else { + print "# XXX: migration script could not handle command: $line\n"; + } +} + + +# add an i3bar invocation automatically if no 'workspace_bar no' was found +if ($workspace_bar) { + print "\n"; + print "# XXX: Automatically added a call to i3bar to provide a workspace bar\n"; + print "exec i3status | i3bar -d\n"; +} diff --git a/i3-migrate-config-to-v4.pl b/i3-migrate-config-to-v4.pl deleted file mode 100755 index 5f20cba1..00000000 --- a/i3-migrate-config-to-v4.pl +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/env perl -# vim:ts=4:sw=4:expandtab -# -# script to migrate an old config file (i3 < 4.0) to the new format (>= 4.0) -# this script only uses modules which come with perl 5.10 -# -# reads an i3 v3 config from stdin and spits out a v4 config on stdout -# exit codes: -# 0 = the input was a v3 config -# 1 = the input was already a v4 config -# (the config is printed to stdout nevertheless) -# -# © 2011 Michael Stapelberg and contributors, see LICENSE - -use strict; -use warnings; -use Getopt::Long; -use v5.10; - -# is this a version 3 config file? disables auto-detection -my $v3 = 0; -my $result = GetOptions('v3' => \$v3); - -# reads stdin -sub slurp { - local $/; - <>; -} - -my @unchanged = qw( - font - set - mode - exec - assign - floating_modifier - focus_follows_mouse - ipc-socket - ipc_socket - client.focused - client.focused_inactive - client.unfocused - client.urgent - client.background -); - -my %workspace_names; -my $workspace_bar = 1; - -my $input = slurp(); -my @lines = split /\n/, $input; - -# remove whitespaces in the beginning of lines -@lines = map { s/^[ \t]*//g; $_ } @lines; - -# Try to auto-detect if this is a v3 config file. -sub need_to_convert { - # If the user passed --v3, we need to convert in any case - return 1 if $v3; - - for my $line (@lines) { - # only v4 configfiles can use bindcode or workspace_layout - return 0 if $line =~ /^bindcode/ || - $line =~ /^workspace_layout/ || - $line =~ /^force_focus_wrapping/; - - # have a look at bindings - next unless $line =~ /^bind/; - - my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)[ \t]+([^ \t]+)[ \t]+(.*)/); - return 0 if $command =~ /^layout/ || - $command =~ /^floating/ || - $command =~ /^workspace/ || - $command =~ /^focus (left|right|up|down)/ || - $command =~ /^border (normal|1pixel|none)/; - } - - return 1; -} - -if (!need_to_convert()) { - # If this is already a v4 config file, we will spit out the lines - # and exit with return code 1 - print $input; - exit 1; -} - -# first pass: get workspace names -for my $line (@lines) { - next if $line =~ /^#/ || $line =~ /^$/; - - my ($statement, $parameters) = ($line =~ /([a-zA-Z._-]+)(.*)/); - - # skip everything but workspace lines - next unless defined($statement) and $statement eq 'workspace'; - - my ($number, $params) = ($parameters =~ /[ \t]+([0-9]+) (.+)/); - - # save workspace name (unless the line is actually a workspace assignment) - $workspace_names{$number} = $params unless $params =~ /^output/; -} - -for my $line (@lines) { - # directly use comments and empty lines - if ($line =~ /^#/ || $line =~ /^$/) { - print "$line\n"; - next; - } - - my ($statement, $parameters) = ($line =~ /([a-zA-Z._-]+)(.*)/); - - # directly use lines which have not changed between 3.x and 4.x - if (!defined($statement) || (lc $statement ~~ @unchanged)) { - print "$line\n"; - next; - } - - # new_container changed only the statement name to workspace_layout - if ($statement eq 'new_container') { - # TODO: new_container stack-limit - print "workspace_layout$parameters\n"; - next; - } - - # workspace_bar is gone, you should use i3bar now - if ($statement eq 'workspace_bar') { - $workspace_bar = ($parameters =~ /[ \t+](yes|true|on|enable|active)/); - print "# XXX: REMOVED workspace_bar line. There is no internal workspace bar in v4.\n"; - next; - } - - # new_window changed the parameters from bb to none etc. - if ($statement eq 'new_window') { - if ($parameters =~ /bb/) { - print "new_window none\n"; - } elsif ($parameters =~ /bp/) { - print "new_window 1pixel\n"; - } elsif ($parameters =~ /bn/) { - print "new_window normal\n"; - } else { - print "# XXX: Invalid parameter for new_window, not touching line:\n"; - print "$line\n"; - } - next; - } - - # bar colors are obsolete, need to be configured in i3bar - if ($statement =~ /^bar\./) { - print "# XXX: REMOVED $statement, configure i3bar instead.\n"; - print "# Old line: $line\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]+) (.+)/); - if ($params =~ /^output/) { - print "$line\n"; - next; - } else { - print "# XXX: workspace name will end up in the corresponding bindings.\n"; - next; - } - } - - if ($statement eq 'bind' || $statement eq 'bindsym') { - convert_command($line); - next; - } - - print "# XXX: migration script could not handle line: $line\n"; -} - -# -# Converts a command (after bind/bindsym) -# -sub convert_command { - my ($line) = @_; - - my @unchanged_cmds = qw( - exec - mark - kill - restart - reload - exit - stack-limit - ); - - my ($statement, $key, $command) = ($line =~ /([a-zA-Z_-]+)[ \t]+([^ \t]+)[ \t]+(.*)/); - - # turn 'bind' to 'bindcode' - $statement = 'bindcode' if $statement eq 'bind'; - - # check if it’s one of the unchanged commands - my ($cmd) = ($command =~ /([a-zA-Z_-]+)/); - if ($cmd ~~ @unchanged_cmds) { - print "$statement $key $command\n"; - return; - } - - # simple replacements - my @replace = ( - qr/^s/ => 'layout stacking', - qr/^d/ => 'layout default', - qr/^T/ => 'layout tabbed', - qr/^f($|[^go])/ => 'fullscreen', - qr/^fg/ => 'fullscreen global', - qr/^t/ => 'floating toggle', - qr/^h/ => 'focus left', - qr/^j($|[^u])/ => 'focus down', - qr/^k/ => 'focus up', - qr/^l/ => 'focus right', - qr/^mh/ => 'move left', - qr/^mj/ => 'move down', - qr/^mk/ => 'move up', - qr/^ml/ => 'move right', - qr/^bn/ => 'border normal', - qr/^bp/ => 'border 1pixel', - qr/^bb/ => 'border none', - qr/^bt/ => 'border toggle', - qr/^pw/ => 'workspace prev', - qr/^nw/ => 'workspace next', - ); - - my $replaced = 0; - for (my $c = 0; $c < @replace; $c += 2) { - if ($command =~ $replace[$c]) { - $command = $replace[$c+1]; - $replaced = 1; - last; - } - } - - # goto command is now obsolete due to criteria + focus command - if ($command =~ /^goto/) { - my ($mark) = ($command =~ /^goto (.*)/); - 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 (.*)/); - if ($params =~ /^"/) { - # jump ["]window class[/window title]["] - ($params) = ($params =~ /^"([^"]+)"/); - - # check if a window title was specified - if ($params =~ m,/,) { - my ($class, $title) = ($params =~ m,([^/]+)/(.+),); - print qq|$statement $key [class="$class" title="$title"] focus\n|; - } else { - print qq|$statement $key [class="$params"] focus\n|; - } - return; - } else { - # jump [ column row ] - print "# XXX: jump workspace is obsolete in 4.x: $line\n"; - return; - } - } - - if (!$replaced && $command =~ /^focus/) { - my ($what) = ($command =~ /^focus (.*)/); - $what =~ s/[ \t]//g; - if ($what eq 'ft') { - $what = 'mode_toggle'; - } elsif ($what eq 'floating' || $what eq 'tiling') { - # those are unchanged - } else { - print "# XXX: focus is obsolete in 4.x: $line\n"; - return; - } - print qq|$statement $key focus $what\n|; - return; - } - - if ($command =~ /^mode/) { - my ($parameters) = ($command =~ /^mode (.*)/); - print qq|$statement $key mode "$parameters"\n|; - return; - } - - # the parameters of the resize command have changed - if ($command =~ /^resize/) { - # OLD: resize [+|-]\n") - # NEW: resize [ px] [or ppt] - my ($direction, $sign, $px) = ($command =~ /^resize (left|right|top|bottom) ([+-])([0-9]+)/); - my $cmd = 'resize '; - $cmd .= ($sign eq '+' ? 'grow' : 'shrink') . ' '; - $cmd .= "$direction "; - $cmd .= "$px px"; - print qq|$statement $key $cmd\n|; - return; - } - - # switch workspace - if ($command =~ /^[0-9]+/) { - my ($number) = ($command =~ /^([0-9]+)/); - if (exists $workspace_names{$number}) { - print qq|$statement $key workspace $workspace_names{$number}\n|; - return; - } else { - print qq|$statement $key workspace $number\n|; - return; - } - } - - # move to workspace - if ($command =~ /^m[0-9]+/) { - my ($number) = ($command =~ /^m([0-9]+)/); - if (exists $workspace_names{$number}) { - print qq|$statement $key move workspace $workspace_names{$number}\n|; - return; - } else { - print qq|$statement $key move workspace $number\n|; - return; - } - } - - # With Container-commands are now obsolete due to different abstraction - if ($command =~ /^wc/) { - $command =~ s/^wc//g; - my $wc_replaced = 0; - for (my $c = 0; $c < @replace; $c += 2) { - if ($command =~ $replace[$c]) { - $command = $replace[$c+1]; - $wc_replaced = 1; - last; - } - } - if (!$wc_replaced) { - print "# XXX: migration script could not handle command: $line\n"; - } else { - # NOTE: This is not 100% accurate, as it only works for one level - # of nested containers. As this is a common use case, we use 'focus - # parent; $command' nevertheless. For advanced use cases, the user - # has to modify his config. - print "$statement $key focus parent; $command\n"; - } - return; - } - - if ($replaced) { - print "$statement $key $command\n"; - } else { - print "# XXX: migration script could not handle command: $line\n"; - } -} - - -# add an i3bar invocation automatically if no 'workspace_bar no' was found -if ($workspace_bar) { - print "\n"; - print "# XXX: Automatically added a call to i3bar to provide a workspace bar\n"; - print "exec i3status | i3bar -d\n"; -} diff --git a/src/cfgparse.y b/src/cfgparse.y index ecfa6658..ae789576 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -115,7 +115,7 @@ next: } /* - * Calls i3-migrate-config-to-v4.pl to migrate a configuration file (input + * Calls i3-migrate-config-to-v4 to migrate a configuration file (input * buffer). * * Returns the converted config file or NULL if there was an error (for @@ -153,7 +153,7 @@ static char *migrate_config(char *input, off_t size) { NULL, /* will be replaced by the executable path */ NULL }; - exec_i3_utility("i3-migrate-config-to-v4.pl", argv); + exec_i3_utility("i3-migrate-config-to-v4", argv); } /* parent */ @@ -438,7 +438,7 @@ void parse_file(const char *f) { printf("\n"); printf("Please convert your config file to v4. You can use this command:\n"); printf(" mv %s %s.O\n", f, f); - printf(" i3-migrate-config-to-v4.pl %s.O > %s\n", f, f); + printf(" i3-migrate-config-to-v4 %s.O > %s\n", f, f); printf("****************************************************************\n"); printf("\n"); free(new); @@ -446,7 +446,7 @@ void parse_file(const char *f) { } else { printf("\n"); printf("**********************************************************************\n"); - printf("ERROR: Could not convert config file. Maybe i3-migrate-config-to-v4.pl\n"); + printf("ERROR: Could not convert config file. Maybe i3-migrate-config-to-v4\n"); printf("was not correctly installed on your system?\n"); printf("**********************************************************************\n"); printf("\n"); diff --git a/testcases/t/71-config-migrate.t b/testcases/t/71-config-migrate.t index e93ca9e7..4e97fb27 100644 --- a/testcases/t/71-config-migrate.t +++ b/testcases/t/71-config-migrate.t @@ -2,7 +2,7 @@ # vim:ts=4:sw=4:expandtab # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3 # -# Tests if i3-migrate-config-to-v4.pl correctly migrates all config file +# Tests if i3-migrate-config-to-v4 correctly migrates all config file # directives and commands # use i3test; @@ -27,7 +27,7 @@ sub migrate_config { print $fh $config; close($fh); - my $cmd = "sh -c 'exec " . abs_path("../i3-migrate-config-to-v4.pl") . " --v3 <$tmpfile'"; + my $cmd = "sh -c 'exec " . abs_path("../i3-migrate-config-to-v4") . " --v3 <$tmpfile'"; return [ split /\n/, qx($cmd) ]; }