]> git.sur5r.net Git - i3/i3/blobdiff - i3-dmenu-desktop
i3-dmenu-desktop: improve error message when dmenu cannot be found
[i3/i3] / i3-dmenu-desktop
index 794120356e8dd8a15db063dd786302c7719c75bb..e0a35b8dbb87c19d4d2f795ee80c3611241c139c 100755 (executable)
@@ -45,7 +45,7 @@ my $result = GetOptions(
     'dmenu=s' => \$dmenu_cmd,
     'entry-type=s' => \@entry_types,
     'version' => sub {
-        say "dmenu-desktop 1.3 © 2012 Michael Stapelberg";
+        say "dmenu-desktop 1.4 © 2012 Michael Stapelberg";
         exit 0;
     },
     'help' => sub {
@@ -306,7 +306,14 @@ for my $app (keys %apps) {
 
 # open2 will just make dmenu’s STDERR go to our own STDERR.
 my ($dmenu_out, $dmenu_in);
-my $pid = open2($dmenu_out, $dmenu_in, $dmenu_cmd);
+my $pid = eval {
+    open2($dmenu_out, $dmenu_in, $dmenu_cmd);
+} or do {
+    print STDERR "$@";
+    say STDERR "Running dmenu failed. Is dmenu installed at all? Try running dmenu -v";
+    exit 1;
+};
+
 binmode $dmenu_in, ':utf8';
 binmode $dmenu_out, ':utf8';
 
@@ -382,6 +389,7 @@ $exec =~ s/%c/$name/g;
 # XXX: Icons are not implemented. Is the complexity (looking up the path if
 # only a name is given) actually worth it?
 #$exec =~ s/%i/--icon $icon/g;
+$exec =~ s/%i//g;
 
 # location of .desktop file
 $exec =~ s/%k/$location/g;
@@ -493,7 +501,7 @@ command), and "libreoffice-writer" (type = filename).
 
 =head1 VERSION
 
-Version 1.3
+Version 1.4
 
 =head1 AUTHOR