Bug 443548

Summary: Use a dynamic pipe menu for Fedora menu ?
Product: [Fedora] Fedora Reporter: Luke Macken <lmacken>
Component: openboxAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 9CC: pfrields
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-06-25 10:40:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 446438    
Bug Blocks:    

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">
                <command>%s</command>
              </action>
            </item>
        """ % (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:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

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-3.4.7.2-2.fc8,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-3.4.7.2-2.fc8, 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-3.4.7.2-2.fc8, 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.