Bug 443548 - Use a dynamic pipe menu for Fedora menu ?
Summary: Use a dynamic pipe menu for Fedora menu ?
Alias: None
Product: Fedora
Classification: Fedora
Component: openbox
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact: Fedora Extras Quality Assurance
Depends On: 446438
TreeView+ depends on / blocked
Reported: 2008-04-22 06:22 UTC by Luke Macken
Modified: 2016-09-20 02:38 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-06-25 10:40:40 UTC
Type: ---

Attachments (Terms of Use)

Description Luke Macken 2008-04-22 06:22:14 UTC
With the following code, we could ship openbox with a dynamic Fedora pipe menu.

import gobject
import gmenu
def walk_menu(entry):
    if entry.get_type() == gmenu.TYPE_DIRECTORY:
        print '<menu id="%s" label="%s">' % (entry.menu_id, entry.get_name())
        map(walk_menu, entry.get_contents())
        print '</menu>'
    elif entry.get_type() == gmenu.TYPE_ENTRY and not entry.is_excluded:
        print """
            <item label="%s">
              <action name="Execute">
        """ % (entry.get_name(), entry.get_exec())

print "<openbox_pipe_menu>"
map(walk_menu, gmenu.lookup_tree('applications.menu').root.get_contents())
print "</openbox_pipe_menu>"

...then, in the default menu configuration, all you have to put is:

     <menu id="fedora" label="Fedora" execute="/path/to/script.py" />

I initially wrote this script for the security spin (more details here:
http://lewk.org/blog/securitylivecd), but I think many people would find it
useful.  This is just a suggestion up for discussion.  What do you think?

Comment 1 Miroslav Lichvar 2008-04-22 12:27:01 UTC
I was thinking about adding gnome menus to the default menu for some time, but
wasn't able to finish it.

There are already written some utils that we could use:

- obx-xdgmenu (not packaged in Fedora) which does the same as your script, just
written in C, but it doesn't replace character & -> &amp; and similar, so "Sound
& Video" menu doesn't work. The script you posted probably has the same problem ;-).

- obmenu package has obm-xdg, unfortunately it doesn't seem to work well with
Fedora menus.

If you fix the problem with & character in the script and add an option to
create arbitrary menus (I think settings and preferences would be nice to have),
I'll be happy to include it.

If possible I'd like to keep openbox dependencies minimal and not add
gnome-menus (and python) to them. Do you think creating a -menus subpackage is a
good idea? A wrapper to switch between the pipe-menus and the hardcoded menus
when the subpackage is not installed would be needed.

Comment 2 Bug Zapper 2008-05-14 09:55:02 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:

Comment 3 Miroslav Lichvar 2008-05-14 16:44:36 UTC
I've included the script with some minor modifications in the package. Thanks!

Comment 4 Fedora Update System 2008-05-20 14:55:22 UTC
openbox-,obconf-2.0.3-2.fc8 has been submitted as an update for Fedora 8

Comment 5 Fedora Update System 2008-05-21 11:00:04 UTC
openbox-, obconf-2.0.3-2.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update openbox obconf'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-4207

Comment 6 Luke Macken 2008-05-27 19:45:48 UTC
No update for Fedora 9?

Comment 7 Fedora Update System 2008-06-20 19:11:46 UTC
openbox-, obconf-2.0.3-2.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.