From: Michael Stapelberg Date: Tue, 11 Dec 2012 21:43:06 +0000 (+0100) Subject: i3-dmenu-desktop: skip .desktop files with Type != Application X-Git-Tag: 4.4~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5a63b64fb81429da0486713aaae47da945403b9f;p=i3%2Fi3 i3-dmenu-desktop: skip .desktop files with Type != Application --- diff --git a/i3-dmenu-desktop b/i3-dmenu-desktop index af525ae2..20c7fbea 100755 --- a/i3-dmenu-desktop +++ b/i3-dmenu-desktop @@ -35,7 +35,7 @@ my $result = GetOptions( 'dmenu=s' => \$dmenu_cmd, 'entry-type=s' => \$entry_type, 'version' => sub { - say "dmenu-desktop 1.1 © 2012 Michael Stapelberg"; + say "dmenu-desktop 1.2 © 2012 Michael Stapelberg"; exit 0; }, 'help' => sub { @@ -157,7 +157,8 @@ for my $file (values %desktops) { if ($key =~ /^Name/) { $names{$key} = $value; } elsif ($key eq 'Exec' || - $key eq 'TryExec') { + $key eq 'TryExec' || + $key eq 'Type') { $apps{$base}->{$key} = $value; } elsif ($key eq 'NoDisplay' || $key eq 'Hidden' || @@ -204,6 +205,10 @@ my %choices; for my $app (keys %apps) { my $name = $apps{$app}->{Name}; + # Don’t try to use .desktop files which don’t have Type=application + next if (!exists($apps{$app}->{Type}) || + $apps{$app}->{Type} ne 'Application'); + # Don’t offer apps which have NoDisplay == true or Hidden == true. # See http://wiki.xfce.org/howto/customize-menu#hide_menu_entries # for the difference between NoDisplay and Hidden. @@ -446,7 +451,7 @@ command) and both (type = both). =head1 VERSION -Version 1.1 +Version 1.2 =head1 AUTHOR