Skip to content

Commit

Permalink
Also check the XDG_DATA_DIRS paths for desktop files. (fixes #50)
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Apr 17, 2023
1 parent a2afe6d commit 43c33bf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions obmenu-generator
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl

# Copyright (C) 2010-2022 Daniel "Trizen" Șuteu <echo dHJpemVuQHByb3Rvbm1haWwuY29tCg== | base64 -d>.
# Copyright (C) 2010-2023 Daniel "Trizen" Șuteu <echo dHJpemVuQHByb3Rvbm1haWwuY29tCg== | base64 -d>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -24,7 +24,7 @@
# Name: obmenu-generator
# License: GPLv3
# Created: 25 March 2011
# Latest edit: 06 September 2022
# Edited: 17 April 2023
# https://github.com/trizen/obmenu-generator

use 5.014;
Expand Down Expand Up @@ -298,8 +298,19 @@ if ($CONFIG{VERSION} != $version) {
dump_configuration();
}

#<<<
my @desktop_files_paths = do {
my %seen;
grep { !$seen{$_}++ } (
($ENV{XDG_DATA_DIRS} ? split(/:/, $ENV{XDG_DATA_DIRS}) : ()),
@{$CONFIG{'Linux::DesktopFiles'}{desktop_files_paths}},
);
};
#>>>

my $desk_obj = Linux::DesktopFiles->new(
%{$CONFIG{'Linux::DesktopFiles'}},
desktop_files_paths => \@desktop_files_paths,

categories => [map { exists($_->{cat}) ? $_->{cat}[0] : () } @$SCHEMA],

Expand Down

0 comments on commit 43c33bf

Please sign in to comment.