i3-dmenu-desktop: skip .desktop files with Type != Application

This commit is contained in:
Michael Stapelberg 2012-12-11 22:43:06 +01:00
parent 60db534a08
commit 5a63b64fb8
1 changed files with 8 additions and 3 deletions

View File

@ -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};
# Dont try to use .desktop files which dont have Type=application
next if (!exists($apps{$app}->{Type}) ||
$apps{$app}->{Type} ne 'Application');
# Dont 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