aboutsummaryrefslogtreecommitdiffstats
path: root/menu/xdg_menu
diff options
context:
space:
mode:
Diffstat (limited to 'menu/xdg_menu')
-rwxr-xr-xmenu/xdg_menu31
1 files changed, 26 insertions, 5 deletions
diff --git a/menu/xdg_menu b/menu/xdg_menu
index 931b373..06e1b20 100755
--- a/menu/xdg_menu
+++ b/menu/xdg_menu
@@ -1809,6 +1809,26 @@ sub output_openbox3_menu ($;$)
return $output;
}
+sub output_openbox3_submenu ($;$)
+{
+ 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 .= "</openbox_menu>\n";
+ return $output;
+}
+
+
sub output_openbox3_pipe_menu ($;$)
{
my ($menu, $indent) = @_;
@@ -1823,7 +1843,7 @@ sub output_openbox3_pipe_menu ($;$)
sub output_openbox3_inner_menu ($;$)
{
- my ($menu, $indent) = @_;
+ my ($menu, $indent, $lastmenu) = @_;
my $output = '';
@@ -1831,9 +1851,10 @@ sub output_openbox3_inner_menu ($;$)
my $menu_name = $menu->{'PrepName'};
$output .= ' ' x $indent;
- $output .= "<menu id=\"" . quote_xml($menu_name) . "\" label=\"".quote_xml($menu_name) . "\">\n";
+ $output .= "<menu id=\"" . quote_xml($menu_name) . quote_xml($lastmenu) . "\" label=\"".quote_xml($menu_name) . "\">\n";
# $output .= "<menu label=\"".quote_xml($menu_name) . "\">\n";
-
+ $lastmenu = $menu_name;
+
foreach my $entry (@{$menu->{'entries'}}) {
if ($entry->{type} eq 'desktop') {
my $desktop = $entry->{desktop};
@@ -1847,7 +1868,7 @@ sub output_openbox3_inner_menu ($;$)
$output .= " </item>\n";
}
elsif ($entry->{type} eq 'menu') {
- $output .= output_openbox3_inner_menu ($entry->{'menu'}, $indent + 1);
+ $output .= output_openbox3_inner_menu ($entry->{'menu'}, $indent + 1, $lastmenu);
}
else {
print STDERR "wrong menu entry type: $entry->{type}";
@@ -2267,7 +2288,7 @@ elsif ($format eq 'openbox3') {
}
else
{
- $output = output_openbox3_inner_menu($menu)
+ $output = output_openbox3_submenu($menu)
}
}
elsif ($format eq 'openbox3-pipe') {