From 5a63b64fb81429da0486713aaae47da945403b9f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 11 Dec 2012 22:43:06 +0100 Subject: [PATCH] i3-dmenu-desktop: skip .desktop files with Type != Application --- i3-dmenu-desktop | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 -- 2.39.5