From 35aec2f03849a6238e4d216270b3ed9e9ef252a5 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 13 Jul 2013 17:47:10 +0200 Subject: [PATCH] i3-dmenu-desktop: honor Path= key (Thanks Alexander) fixes #1041 --- i3-dmenu-desktop | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/i3-dmenu-desktop b/i3-dmenu-desktop index cf5b41e0..cccc1dc5 100755 --- a/i3-dmenu-desktop +++ b/i3-dmenu-desktop @@ -45,7 +45,7 @@ my $result = GetOptions( 'dmenu=s' => \$dmenu_cmd, 'entry-type=s' => \@entry_types, 'version' => sub { - say "dmenu-desktop 1.4 © 2012-2013 Michael Stapelberg"; + say "dmenu-desktop 1.5 © 2012-2013 Michael Stapelberg"; exit 0; }, 'help' => sub { @@ -175,6 +175,7 @@ for my $file (values %desktops) { $names{$key} = $value; } elsif ($key eq 'Exec' || $key eq 'TryExec' || + $key eq 'Path' || $key eq 'Type') { $apps{$base}->{$key} = $value; } elsif ($key eq 'NoDisplay' || @@ -403,6 +404,10 @@ $exec =~ s/%k/$location/g; # Literal % characters are represented as %%. $exec =~ s/%%/%/g; +if (exists($app->{Path}) && $app->{Path} ne '') { + $exec = 'cd ' . $app->{Path} . ' && ' . $exec; +} + my $nosn = ''; my $cmd; if (exists($app->{Terminal}) && $app->{Terminal}) { @@ -507,7 +512,7 @@ command), and "libreoffice-writer" (type = filename). =head1 VERSION -Version 1.4 +Version 1.5 =head1 AUTHOR