Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Staging:C
xdg-menu
xdg-menu-twm.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xdg-menu-twm.patch of Package xdg-menu
--- xdg_menu +++ xdg_menu @@ -1320,6 +1320,62 @@ return 1; } +sub output_twm_menu ($;$$) +{ + my ($menu, $toplevel, $path) = @_; + + my $output = ''; + + $path = '' unless defined $path; + + $toplevel = 1 unless defined $toplevel; + + my $menu_name = $menu->{'PrepName'}; + my $menu_id = "$path-" . $menu->{'Name'}; + $menu_id =~ s/\s/_/g; + + $menu_id = 'xdg_menu' if $toplevel; + + foreach my $entry (@{$menu->{'entries'}}) { + if ($entry->{type} eq 'menu') { + $output .= output_twm_menu($entry->{'menu'}, 0, $menu_id); + } + } + + $output .= "menu \"$menu_id\" {\n"; + $output .= "\"$menu_name\" f.title\n"; + + foreach my $entry (@{$menu->{'entries'}}) { + if ($entry->{type} eq 'desktop') { + my $desktop = $entry->{desktop}; + + my $name = $desktop->{'PrepName'}; + my $exec = $desktop->{'PrepExec'}; + my $color = ''; + + $exec =~ s/"/\\"/g; + + $color = ' ("red":"grey")' if $desktop->{'X-KDE-SubstituteUID'} eq '1' || $desktop->{'X-KDE-SubstituteUID'} eq 'true'; + + $output .= "\"$name\"$color f.exec \"$exec&\"\n"; + } + elsif ($entry->{type} eq 'menu') { + my $name = $entry->{'menu'}{'PrepName'}; + my $id = "$menu_id-" . $entry->{'menu'}{'Name'}; + + $id =~ s/\s/_/g; + + $output .= "\"$name\" f.menu \"$id\"\n"; + } + else { + print STDERR "wrong menu entry type: $entry->{type}"; + } + + } + $output .= "}\n"; + + return $output; +} sub output_wmaker_menu ($;$) { @@ -2101,6 +2157,11 @@ $output = output_openbox3_pipe_menu($menu) } +elsif ($format eq 'twm') { + + print STDERR "WARNING: twm does not support umlauts. Parameter --language '' to output plain ASCII.\n" unless $language eq ''; + $output = output_twm_menu($menu) +} elsif ($format eq 'readable') { $output = output_readable($menu)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor