diff options
author | loungecube <cube@hannen.at> | 2017-05-15 05:02:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-15 05:02:09 +0200 |
commit | 838616a1657ebe0906444307dc42fc5063d800d6 (patch) | |
tree | 1d3e3b0d2957e6551e9c54b6e228d5973e064866 /i3-dmenu-desktop | |
parent | 9178c5b8ca2b5c09ba96397ce3303d552125ede4 (diff) | |
download | i3-838616a1657ebe0906444307dc42fc5063d800d6.tar.gz i3-838616a1657ebe0906444307dc42fc5063d800d6.zip |
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.
Diffstat (limited to 'i3-dmenu-desktop')
-rwxr-xr-x | i3-dmenu-desktop | 8 |
1 files changed, 5 insertions, 3 deletions
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) { |