i3-wsbar: replace %w with the width of the output (Thanks dothebart)

This fixes ticket #231
This commit is contained in:
Michael Stapelberg 2010-06-19 11:48:47 +02:00
parent a0d2069bb3
commit be49ed99f4
1 changed files with 6 additions and 2 deletions

View File

@ -136,9 +136,12 @@ sub got_outputs {
} }
my $x = $new{$name}->{rect}->{x}; my $x = $new{$name}->{rect}->{x};
my $w = $new{$name}->{rect}->{width};
my $launch = $command; my $launch = $command;
$launch =~ s/([^%])%x/$1$x/g; $launch =~ s/([^%])%x/$1$x/g;
$launch =~ s/([^%])%w/$1$w/g;
$launch =~ s/%%x/%x/g; $launch =~ s/%%x/%x/g;
$launch =~ s/%%w/%w/g;
$new{$name}->{cmd_input} = ''; $new{$name}->{cmd_input} = '';
my @cmd = ('/bin/sh', '-c', $launch); my @cmd = ('/bin/sh', '-c', $launch);
@ -245,10 +248,11 @@ i3-wsbar -c <dzen2-commandline> [options]
=item B<--command> <command> =item B<--command> <command>
This command (at the moment only dzen2 is supported) will be started for each This command (at the moment only dzen2 is supported) will be started for each
output. C<%x> will be replaced with the X coordinate of the output. output. C<%x> will be replaced with the X coordinate of the output, C<%w> will
be replaced with the width of the output.
Example: Example:
--command "dzen2 -dock -x %x" --command "dzen2 -dock -x %x -w %w"
=item B<--input-on> <list-of-RandR-outputs> =item B<--input-on> <list-of-RandR-outputs>