]> git.sur5r.net Git - i3/i3/blobdiff - i3-dmenu-desktop
Clarify userguide description of urgent_workspace configuration
[i3/i3] / i3-dmenu-desktop
index e0a35b8dbb87c19d4d2f795ee80c3611241c139c..cccc1dc56cbcaca59ee7c3976aaa7b4a78079f49 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 # vim:ts=4:sw=4:expandtab
 #
-# © 2012 Michael Stapelberg
+# © 2012-2013 Michael Stapelberg
 #
 # No dependencies except for perl ≥ v5.10
 
@@ -45,7 +45,7 @@ my $result = GetOptions(
     'dmenu=s' => \$dmenu_cmd,
     'entry-type=s' => \@entry_types,
     'version' => sub {
-        say "dmenu-desktop 1.4 © 2012 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' ||
@@ -346,7 +347,13 @@ if (exists($choices{$choice})) {
         last;
     }
     if (!defined($app)) {
-        die "Invalid input: “$choice” does not match any application.";
+        warn "Invalid input: “$choice” does not match any application. Trying to execute nevertheless.";
+        $app->{Name} = '';
+        $app->{Exec} = $choice;
+        # We assume that the app is old and does not support startup
+        # notifications because it doesn’t ship a desktop file.
+        $app->{StartupNotify} = 0;
+        $app->{_Location} = '';
     }
 }
 
@@ -397,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}) {
@@ -501,7 +512,7 @@ command), and "libreoffice-writer" (type = filename).
 
 =head1 VERSION
 
-Version 1.4
+Version 1.5
 
 =head1 AUTHOR