aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemian <66596643+itodnerd@users.noreply.github.com>2022-12-06 17:23:10 +0100
committerGitHub <noreply@github.com>2022-12-06 17:23:10 +0100
commit1786b13f0dfd6280fc9111576e2fa4869091e773 (patch)
treedb16ec1b111c2797a9a338e6324222718e6a9d89
parentfd95a47183679c0c36e7fc0567f34c16fa64f723 (diff)
downloadi3-1786b13f0dfd6280fc9111576e2fa4869091e773.tar.gz
i3-1786b13f0dfd6280fc9111576e2fa4869091e773.zip
i3-dmenu-desktop: Allow more than one --entry-type (#5294)
Unlike in the man page, only one --entry-type is reasonable possible. On using multiple --entry-types and a command offers multiple, duplicates are removed i3-dmenu-desktop. See more at #5291 added --show-duplicates flag for this
-rwxr-xr-xi3-dmenu-desktop14
1 files changed, 10 insertions, 4 deletions
diff --git a/i3-dmenu-desktop b/i3-dmenu-desktop
index 6e26786d..581b47e3 100755
--- a/i3-dmenu-desktop
+++ b/i3-dmenu-desktop
@@ -46,9 +46,11 @@ sub slurp {
my @entry_types;
my $dmenu_cmd = 'dmenu -i';
+my $show_duplicates;
my $result = GetOptions(
'dmenu=s' => \$dmenu_cmd,
'entry-type=s' => \@entry_types,
+ 'show-duplicates' => \$show_duplicates,
'version' => sub {
say "dmenu-desktop 1.5 © 2012 Michael Stapelberg";
exit 0;
@@ -292,7 +294,7 @@ for my $app (keys %apps) {
}
$choices{$name} = $app;
- next;
+ next unless $show_duplicates;
}
if ((scalar grep { $_ eq 'command' } @entry_types) > 0) {
@@ -327,7 +329,7 @@ for my $app (keys %apps) {
if (!(scalar grep { $_ eq lc(basename($command)) } @keys) > 0) {
$choices{basename($command)} = $app;
}
- next;
+ next unless $show_duplicates;
}
if ((scalar grep { $_ eq 'filename' } @entry_types) > 0) {
@@ -518,7 +520,7 @@ system('i3-msg', $cmd) == 0 or die "Could not launch i3-msg: $?";
=head1 SYNOPSIS
- i3-dmenu-desktop [--dmenu='dmenu -i'] [--entry-type=name]
+ i3-dmenu-desktop [--dmenu='dmenu -i'] [--entry-type=name] [--show-duplicates]
=head1 DESCRIPTION
@@ -569,11 +571,15 @@ version of dmenu.
Display the (localized) "Name" (type = name), the command (type = command) or
the (*.desktop) filename (type = filename) in dmenu. This option can be
-specified multiple times.
+specified multiple times. Duplicates will be removed, see '--show-duplicates'.
Examples are "GNU Image Manipulation Program" (type = name), "gimp" (type =
command), and "libreoffice-writer" (type = filename).
+=item B<--show-duplicates>
+
+Show duplicates if '--entry-type' is specified multiple times.
+
=back
=head1 VERSION