From: loungecube Date: Mon, 15 May 2017 03:02:09 +0000 (+0200) Subject: prevent multiple menu items per .desktop entry X-Git-Tag: 4.14~26^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F2772%2Fhead;p=i3%2Fi3 prevent multiple menu items per .desktop entry If a .desktop entry is being added to the list of Menu items by its "Name" field, it should not be added again by its command or filename. If it is being added by its command, it should not be added again by its filename. --- diff --git a/i3-dmenu-desktop b/i3-dmenu-desktop index 1d29a69f..aee5dc2f 100755 --- a/i3-dmenu-desktop +++ b/i3-dmenu-desktop @@ -279,6 +279,7 @@ for my $app (keys %apps) { } $choices{$name} = $app; + next; } if ((scalar grep { $_ eq 'command' } @entry_types) > 0) { @@ -310,9 +311,10 @@ for my $app (keys %apps) { # Don’t add “geany” if “Geany” is already present. my @keys = map { lc } keys %choices; - next if (scalar grep { $_ eq lc(basename($command)) } @keys) > 0; - - $choices{basename($command)} = $app; + if (!(scalar grep { $_ eq lc(basename($command)) } @keys) > 0) { + $choices{basename($command)} = $app; + } + next; } if ((scalar grep { $_ eq 'filename' } @entry_types) > 0) {