diff options
author | dakkar <dakkar@thenautilus.net> | 2013-05-11 18:18:54 +0200 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2014-08-02 18:49:04 +0100 |
commit | 54dbf2012b0915ae43ef40b89c3ea2bb03818c2a (patch) | |
tree | 6e0c80e9c5d11226df94674eca9319a2d8813d6e /scripts | |
parent | the laptop looks better with white text (diff) | |
download | fvwm-crystal-54dbf2012b0915ae43ef40b89c3ea2bb03818c2a.tar.gz fvwm-crystal-54dbf2012b0915ae43ef40b89c3ea2bb03818c2a.tar.bz2 fvwm-crystal-54dbf2012b0915ae43ef40b89c3ea2bb03818c2a.zip |
use XDG apps descriptions for launcher
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/menu.pl | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/menu.pl b/scripts/menu.pl new file mode 100755 index 0000000..d9eeaeb --- /dev/null +++ b/scripts/menu.pl @@ -0,0 +1,44 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.016; +use Linux::DesktopFiles; +use List::Util 'first'; +use Data::Printer; + +my $d = Linux::DesktopFiles->new( + with_icons => 1, + full_icon_paths => 1, + skip_svg_icons => 1, + icon_dirs_last => ['/usr/share/icons/gnome'], +); + +my $f = $d->parse_desktop_files(); + +for my $cat (keys %$f) { + my @apps=@{$f->{$cat}}; + my $menu_name='/Applications/'.ucfirst(lc($cat)).'Panel'; + say "DestroyMenu $menu_name"; + say "AddToMenu $menu_name"; + for my $app (@apps) { + next unless $app->{Icon}; + printf qq{+ "%%%s%%\$[gt.%s]" Exec exec "%s"\n}, + $app->{Icon},$app->{Name},$app->{Exec}; + } + say ''; +} + +my $buttons=0; +for my $cat (keys %$f) { + my @apps=@{$f->{$cat}}; + my $app=first { $_->{Icon} } @apps; + next unless $app; + ++$buttons; + + my $menu_name='/Applications/'.ucfirst(lc($cat)).'Panel'; + printf qq{*ApplicationPanel: (1x1, Size 22 22, Icon "%s", \\\n},$app->{Icon}; + printf qq{Action (Mouse 1) Exec exec "%s", \\\n},$app->{Exec}; + printf qq{Action (Mouse 3) Menu %s \$[MenuPosition_S] )\n},$menu_name; +} + +say "SetEnv ApplicationPanelLength $buttons"; |