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-box.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xdg-menu-box.patch of Package xdg-menu
diff -ur xdg-menu.orig/xdg_menu xdg-menu/xdg_menu --- xdg-menu.orig/xdg_menu 2004-11-30 13:23:12.459157549 +0100 +++ xdg-menu/xdg_menu 2004-11-30 13:28:27.640045633 +0100 @@ -26,6 +26,7 @@ my $die_on_error = 0; my $verbose = 0; +my $fullmenu = 0; my @language_keys; @@ -1410,6 +1411,40 @@ sub output_blackbox_menu ($;$) { + my ($menu, $indent) = @_; + + my $output = ''; + + $output .= "[begin] (Menu)\n"; + $output .= "[exec] (xterm) {xterm}\n[separator]\n"; + $output .= output_blackbox_inner_menu ($menu, $indent); + $output .= "[separator]\n"; + $output .= '[config] (Configuration) + [workspaces] (Workspace) + [submenu] (System Styles) {Choose a style...} + [stylesdir] (/usr/share/blackbox/styles) + [stylesdir] (/usr/share/fluxbox/styles) + [stylesdir] (/usr/share/openbox/styles) + [end] + [submenu] (User Styles) {Choose a style...} + [stylesdir] (~/.blackbox/styles) + [stylesdir] (~/.fluxbox/styles) + [stylesdir] (~/.openbox/styles) + [end] + [separator] + [exec] (Run Command) {bbrun -a -w} + [exec] (Lock Screen) {xlock} + [restart] (Restart) {} + [exit] (Logout) +[end] +'; + $output .= "[end]\n"; + return $output; +} + + +sub output_blackbox_inner_menu ($;$) +{ my ($menu, $indent) = @_; my $output = ''; @@ -1432,7 +1467,7 @@ $output .= " [exec] ($name) {$exec}\n"; } elsif ($entry->{type} eq 'menu') { - $output .= output_blackbox_menu ($entry->{'menu'}, $indent + 1); + $output .= output_blackbox_inner_menu ($entry->{'menu'}, $indent + 1); } else { print STDERR "wrong menu entry type: $entry->{type}"; @@ -1570,6 +1605,94 @@ return $output; } +sub output_openbox3_menu ($;$) +{ + my ($menu, $indent) = @_; + + my $output = ''; + + $output .= '<?xml version="1.0" encoding="UTF-8"?> + +<openbox_menu xmlns="http://openbox.org/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://openbox.org/ + file:///usr/share/openbox/menu.xsd">'; + $output .= "<menu id=\"xdg\" label=\"xdg\">\n"; + $output .= output_openbox3_inner_menu ($menu, $indent); + $output .= "</menu>\n"; + $output .= ' <menu id="root-menu" label="Openbox 3"> + <item label="xterm"> + <action name="Execute"><execute>xterm</execute></action> </item> + <separator /> + <menu id="KDE Menu" label="KDE Menu" /> + <separator /> + <menu id="client-list-menu" /> + <separator /> + <menu id="ob-menu" label="openbox3"> + <item label="ob conf"><action name="Execute"><execute>obconf</execute></action></item> + <item label="reconfigure"><action name="Reconfigure" /></item> + </menu> + <separator /> + <item label="lock screen"><action name="Execute"><execute>xlock -remote -nice 19 -mode blank -geometry 1x1 -enablesaver</execute></action></item> + <separator /> + <item label="Exit"><action name="Exit" /></item> + </menu>'; + $output .= "</openbox_menu>\n"; + return $output; +} + +sub output_openbox3_pipe_menu ($;$) +{ + my ($menu, $indent) = @_; + + my $output = ''; + + $output .= "<openbox_pipe_menu>\n"; + $output .= output_openbox3_inner_menu ($menu, $indent); + $output .= "</openbox_pipe_menu>\n"; + return $output; +} + +sub output_openbox3_inner_menu ($;$) +{ + my ($menu, $indent) = @_; + + my $output = ''; + + $indent = 0 unless defined $indent; + my $menu_name = $menu->{'PrepName'}; + + $output .= ' ' x $indent; + $output .= "<menu id=\"" . quote_xml($menu_name) . "\" label=\"".quote_xml($menu_name) . "\">\n"; +# $output .= "<menu label=\"".quote_xml($menu_name) . "\">\n"; + + foreach my $entry (@{$menu->{'entries'}}) { + if ($entry->{type} eq 'desktop') { + my $desktop = $entry->{desktop}; + + my $name = $desktop->{'PrepName'}; + my $exec = $desktop->{'PrepExec'}; + + $output .= ' ' x $indent; + $output .= " <item label=\"". quote_xml($name)."\">\n"; + $output .= " <action name=\"Execute\"><execute>$exec</execute></action>\n"; + $output .= " </item>\n"; + } + elsif ($entry->{type} eq 'menu') { + $output .= output_openbox3_inner_menu ($entry->{'menu'}, $indent + 1); + } + else { + print STDERR "wrong menu entry type: $entry->{type}"; + } + + } + $output .= ' ' x $indent; + $output .= "</menu> <!-- $menu_name -->\n"; + + return $output; +} + + sub output_readable ($;$) { my ($menu, $indent) = @_; @@ -1862,6 +1985,7 @@ my $help; GetOptions("format=s" => \$format, + "fullmenu" => \$fullmenu, "desktop=s" => \$desktop_name, "charset=s" => \$charset, "language=s" => \$language, @@ -1885,13 +2009,18 @@ Usage: xdg_menu [--format <format>] [--desktop <desktop>] [--charset <charset>] [--language <language>] - [--root-menu <root-menu>] [--die-on-error] [--help] + [--root-menu <root-menu>] [--die-on-error] + [--fullmenu] [--help] format - output format - possible formats: WindowMaker, fvwm2, blackbox, - icewm, readable + possible formats: WindowMaker, fvwm2, icewm, + blackbox, fluxbox, openbox, + xfce4, openbox3, openbox3-pipe, + readable default: WindowMaker - + + fullmenu - output a full menu and not only a submenu + desktop - desktop name for NotShowIn and OnlyShowIn default: the same as format @@ -1942,17 +2071,35 @@ $output = output_fvwm2_menu($menu) } -elsif ($format eq 'blackbox') { - - $output = output_blackbox_menu($menu) -} elsif ($format eq 'icewm') { - $output = output_icewm_menu($menu) + $output = output_icewm_menu($menu) } elsif ($format eq 'xfce4') { - $output = output_xfce4_menu($menu) + $output = output_xfce4_menu($menu) +} +elsif ($format eq 'blackbox' || ($format eq 'openbox') || ($format eq 'fluxbox') ) { + if ($fullmenu) { + $output = output_blackbox_menu($menu) + } + else + { + $output = output_blackbox_inner_menu($menu) + } +} +elsif ($format eq 'openbox3') { + if ($fullmenu) { + $output = output_openbox3_menu($menu) + } + else + { + $output = output_openbox3_inner_menu($menu) + } +} +elsif ($format eq 'openbox3-pipe') { + + $output = output_openbox3_pipe_menu($menu) } elsif ($format eq 'readable') {
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