/usr/share/fvwm/fvwm-menu-desktop-config.fpl is in fvwm 1:2.6.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | # Uage: Module FvwmPerl -l fvwm-menu-desktop-config.fpl
# This script generates an FvwmForm similar to the FvwmForm-Desktop by
# Dan Espen but inserts the found xdg menus dynamically into the Form
# before processed.
# Author: Thomas Funk <t.funk@web.de>
# Version: 1.4
package MenuConfig;
use File::Basename;
use strict;
use warnings;
#open(MSG ,">>/tmp/log.txt") || die "Error $!";
my $modname = 'FvwmForm-XDGMenu-Config';
my $all = `fvwm-menu-desktop --get-menus all`;
my $selected = `fvwm-menu-desktop --get-menus desktop`;
my @all_filelist = split(/ /,$all);
my @selected_filelist = split(/ /,$selected);
my %all_menus = ();
my %selected__menus = ();
my $max_length = 0;
foreach my $path (@selected_filelist) {
my ($filename, $directories, $suffix) = fileparse($path, qr/\.[^.]*/);
push (@{$selected__menus{$directories}}, $filename);
}
my $i = 1;
foreach my $path (@all_filelist) {
# qr matched against the end of the $filename.
# The matching portion is removed and becomes the $suffix.
my ($filename, $directories, $suffix) = fileparse($path, qr/\.[^.]*/);
my $name = "MEN" . $filename;
push (@{$all_menus{$directories}{$i}}, ($filename, $name, "off"));
next if !defined $selected__menus{$directories};
foreach my $hit (@{$selected__menus{$directories}}) {
if ($filename eq $hit) {
pop (@{$all_menus{$directories}{$i}});
push (@{$all_menus{$directories}{$i}}, "on");
}
}
$max_length = length($filename) if ($max_length < length($filename));
$i++;
}
my $fvwmform_commands = "
DestroyModuleConfig ${modname}: *
*${modname}: Title \"\$[gt.Fvwm XDGMenu Config]\"
*${modname}: WarpPointer
#*${modname}: Line center
#*${modname}: Text \"\$[gt.Fvwm XDGMenu Config]\"
#*${modname}: Line
*${modname}: Separator
*${modname}: Line center
*${modname}: Text \"\$[gt.Available Menus]\"
*${modname}: Line
";
if (scalar keys %all_menus != 0) {
foreach my $key (sort( keys %all_menus)) {
$fvwmform_commands .= "
*${modname}: Line left
*${modname}: Text \"\$[gt.Menus in]\"
*${modname}: Text \" $key\"
*${modname}: Line left
*${modname}: Selection meth multiple
";
my $m_count = 0;
foreach my $count (sort(keys %{$all_menus{$key}})) {
my $menu = $all_menus{$key}{$count};
my $newstring = $menu->[0] . ' ' x eval($max_length-length($menu->[0]));
$fvwmform_commands .= "*${modname}: Choice $menu->[1] $menu->[1] $menu->[2] \"$newstring\"
";
$m_count++;
if ($m_count == 4) {
$fvwmform_commands .= "
*${modname}: Line left
*${modname}: Selection meth multiple
";
$m_count = 0;
}
}
$fvwmform_commands .= "
*${modname}: Line left
*${modname}: Text \" \"
";
}
}
else {
$fvwmform_commands .= "
*${modname}: Line center
*${modname}: Text \"\$[gt.No menus found! Check why from within a terminal with]\"
*${modname}: Line center
*${modname}: Text \"'fvwm-menu-desktop -v'\"
*${modname}: Line left
*${modname}: Text \" \"
";
}
$fvwmform_commands .= "
*${modname}: Separator
*${modname}: Line center
*${modname}: Text \"\$[gt.Options]\"
*${modname}: Button continue \"\$[gt.Help]\"
*${modname}: Command Module FvwmForm FvwmForm-XDGOptionsHelp
*${modname}: Line
*${modname}: Line Left
*${modname}: Text \"\$[gt.Include in Menu? ]\"
*${modname}: Selection SelItype single
*${modname}: Choice IncludeConfig IncludeConfig off \"\$[gt.Config ]\"
*${modname}: Choice IncludeRegen IncludeRegen off \"\$[gt.Regenerate ]\"
*${modname}: Choice IncludeBoth IncludeBoth on \"\$[gt.Both ]\"
*${modname}: Choice IncludeNone IncludeNone off \"\$[gt.None ]\"
*${modname}: Line Left
*${modname}: Text \"\$[gt.Use Icons? ]\"
*${modname}: Selection SelItype single
*${modname}: Choice IconsOn IconsOn off \"\$[gt.Yes ]\"
*${modname}: Choice IconsOff IconsOff on \"\$[gt.No ]\"
*${modname}: Text \"\$[gt. ]\"
*${modname}: Text \"\$[gt.Icon size: ]\"
*${modname}: Input Size 2 \"\"
*${modname}: Text \"\$[gt. (Default is 24)]\"
*${modname}: Line Left
*${modname}: Text \"\$[gt.Use Titles? ]\"
*${modname}: Selection SelItype single
*${modname}: Choice TitlesOn TitlesOn on \"\$[gt.Yes ]\"
*${modname}: Choice TitlesOff TitlesOff off \"\$[gt.No ]\"
*${modname}: Text \"\$[gt. ]\"
*${modname}: Text \"\$[gt.Used Icon theme: ]\"
*${modname}: Input Theme 20 \"\"
*${modname}: Line left
*${modname}: Text \"\$[gt.Directory Icon: ]\"
*${modname}: Input DirIcon 20 \"gnome-fs-directory\"
*${modname}: Text \"\$[gt. ]\"
*${modname}: Text \"\$[gt.Application Icon: ]\"
*${modname}: Input AppIcon 20 \"gnome-applications\"
*${modname}: Line left
*${modname}: Text \"\$[gt.Top Menu Name: ]\"
*${modname}: Input Title 20 \"XDGMenu\"
*${modname}: Text \"\$[gt. ]\"
*${modname}: Text \"\$[gt.Insert Menu Into: ]\"
*${modname}: Input InsertInto 20 \"\"
*${modname}: Line left
*${modname}: Text \"\$[gt.Icon directory: ]\"
*${modname}: Input IconDir 30 \"~/.fvwm/icons\"
*${modname}: Text \"\$[gt. (Directory for converted icons)]\"
*${modname}: Line left
*${modname}: Text \"\$[gt.Output path: ]\"
*${modname}: Input Path 30 \"\$FVWM_USERDIR/.XDGMenu\"
*${modname}: Text \"\$[gt. (Full path to store output)]\"
*${modname}: Line left
*${modname}: Line
*${modname}: Separator
*${modname}: Line
*${modname}: Line expand
*${modname}: Button continue \"\$[gt.Save Menu]\"
*${modname}: Command PipeRead 'fvwm-menu-desktop \\
\$(IconsOn\?--enable-mini-icons )\\
\$(Size\?-s \$(Size) )\\
\$(TitlesOn\?--with-titles )\\
\$(TitlesOff\?--without-titles )\\
--include-items \$(IncludeConfig\?config)\\
\$(IncludeRegen\?regenerate)\\
\$(IncludeBoth\?both)\\
\$(IncludeNone\?none) \\
\$(IconDir\?--mini-icon-dir \$(IconDir) )\\
\$(DirIcon\?--dir-icon \$(DirIcon) )\\
\$(AppIcon\?--app-icon \$(AppIcon) )\\
\$(InsertInto\?--insert-in-menu \$(InsertInto) )\\
\$(Title\?--title \$(Title) )\\
\$(Theme\?--theme \$(Theme) )\\
--set-menus \"\\
";
foreach my $key (keys %all_menus) {
foreach my $file (keys %{$all_menus{$key}}) {
my $menu = $all_menus{$key}{$file};
$fvwmform_commands .= "\$($menu->[1]\?$key$menu->[0].menu )\\\n";
}
}
$fvwmform_commands .= "\" \$(Path\? > \$(Path)) 2>> ~/.xsession-errors && echo \"Read \$(Path\? \$(Path))\"'
*${modname}: Button continue \"\$[gt.Save and Regenerate]\"
# Before saving the data, remove any previously saved data:
*${modname}: Command DestroyModuleConfig ${modname}Default: *
*${modname}: Command !( /bin/echo \\
\"# This file last created by ${modname} on: `/bin/date`.\"; /bin/echo \\
";
foreach my $key (keys %all_menus) {
foreach my $count (keys %{$all_menus{$key}}) {
my $menu = $all_menus{$key}{$count};
$fvwmform_commands .= " '*${modname}Default: $menu->[1] \$($menu->[1]\?on) ' ; /bin/echo \\
";
}
}
$fvwmform_commands .= ") > \$FVWM_USERDIR/.${modname}
*${modname}: Command !(/bin/echo \\
'*${modname}Default: IncludeConfig\$(IncludeConfig\?on) ' ; /bin/echo \\
'*${modname}Default: IncludeRegen \$(IncludeRegen\?on) ' ; /bin/echo \\
'*${modname}Default: IncludeBoth \$(IncludeBoth\?on) ' ; /bin/echo \\
'*${modname}Default: IncludeNone \$(IncludeNone\?on) ' ; /bin/echo \\
'*${modname}Default: IconsOn \$(IconsOn\?on) ' ; /bin/echo \\
'*${modname}Default: IconsOff \$(IconsOff\?on) ' ; /bin/echo \\
'*${modname}Default: Size \$(Size) ' ; /bin/echo \\
'*${modname}Default: TitlesOn \$(TitlesOn\?on) ' ; /bin/echo \\
'*${modname}Default: TitlesOff \$(TitlesOff\?on) ' ; /bin/echo \\
'*${modname}Default: Theme \$(Theme) ' \\
) >> \$FVWM_USERDIR/.${modname}
*${modname}: Command !(/bin/echo \\
'*${modname}Default: Title \$(Title) ' ; /bin/echo \\
'*${modname}Default: InsertInto \$(InsertInto) ' ; /bin/echo \\
'*${modname}Default: Path \$(Path) ' ; /bin/echo \\
'*${modname}Default: IconDir \$(IconDir) ' ; /bin/echo \\
'*${modname}Default: DirIcon \$(DirIcon) ' ; /bin/echo \\
'*${modname}Default: AppIcon \$(AppIcon) ' \\
) >> \$FVWM_USERDIR/.${modname}
*${modname}: Command PipeRead 'fvwm-menu-desktop'
*${modname}: Button continue \"\$[gt.Save]\"
# Before saving the data, remove any previously saved data:
*${modname}: Command DestroyModuleConfig ${modname}Default: *
*${modname}: Command !( /bin/echo \\
\"# This file last created by ${modname} on: `/bin/date`.\"; /bin/echo \\
";
foreach my $key (keys %all_menus) {
foreach my $count (keys %{$all_menus{$key}}) {
my $menu = $all_menus{$key}{$count};
$fvwmform_commands .= " '*${modname}Default: $menu->[1] \$($menu->[1]\?on) ' ; /bin/echo \\
";
}
}
$fvwmform_commands .= ") > \$FVWM_USERDIR/.${modname}
*${modname}: Command !(/bin/echo \\
'*${modname}Default: IncludeConfig\$(IncludeConfig\?on) ' ; /bin/echo \\
'*${modname}Default: IncludeRegen \$(IncludeRegen\?on) ' ; /bin/echo \\
'*${modname}Default: IncludeBoth \$(IncludeBoth\?on) ' ; /bin/echo \\
'*${modname}Default: IncludeNone \$(IncludeNone\?on) ' ; /bin/echo \\
'*${modname}Default: IconsOn \$(IconsOn\?on) ' ; /bin/echo \\
'*${modname}Default: IconsOff \$(IconsOff\?on) ' ; /bin/echo \\
'*${modname}Default: Size \$(Size) ' ; /bin/echo \\
'*${modname}Default: TitlesOn \$(TitlesOn\?on) ' ; /bin/echo \\
'*${modname}Default: TitlesOff \$(TitlesOff\?on) ' ; /bin/echo \\
'*${modname}Default: Theme \$(Theme) ' \\
) >> \$FVWM_USERDIR/.${modname}
*${modname}: Command !(/bin/echo \\
'*${modname}Default: Title \$(Title) ' ; /bin/echo \\
'*${modname}Default: InsertInto \$(InsertInto) ' ; /bin/echo \\
'*${modname}Default: Path \$(Path) ' ; /bin/echo \\
'*${modname}Default: IconDir \$(IconDir) ' ; /bin/echo \\
'*${modname}Default: DirIcon \$(DirIcon) ' ; /bin/echo \\
'*${modname}Default: AppIcon \$(AppIcon) ' \\
) >> \$FVWM_USERDIR/.${modname}
*${modname}: Button restart \"\$[gt.Reset]\"
*${modname}: Command Nop
*${modname}: Button continue \"\$[gt.Help]\"
*${modname}: Command Module FvwmForm FvwmForm-XDGMenuHelp
*${modname}: Button quit \"\$[gt.Close]\"
*${modname}: Command Nop
# Tell ${modname} to read vars from .${modname}Default file:
*${modname}: UseData .${modname} *${modname}Default
";
# We are just asked to open a window, give fvwm a chance to do it
::unlock();
$fvwmform_commands =~ s/^\s+//; # trim leading whitespace
::command(qq[
$fvwmform_commands
FvwmForm ${modname}
]);
#print MSG "$fvwmform_commands\n\n";
#close(MSG);
# Local Variables:
# mode: perl
# End:
|