Bug 178320 - kdelibs: use $XDG_CONFIG_DIRS (or $XDG_MENU_PREFIX)
Summary: kdelibs: use $XDG_CONFIG_DIRS (or $XDG_MENU_PREFIX)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: kdelibs
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Than Ngo
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-01-19 14:02 UTC by Rex Dieter
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-09-30 11:03:52 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
upstream patch to enable use of XDG_MENU_PREFIX (1.11 KB, patch)
2006-12-07 14:28 UTC, Rex Dieter
no flags Details | Diff

Description Rex Dieter 2006-01-19 14:02:42 UTC
Not sure of the original motivation, but I think it's time has come and gone.  
Problems: 
1.  When in use, it doesn't show any subsubmenus, ie Office->More Applications 
2.  Wreaks havoc with menu editors, like kmenuedit and kiosktool

Comment 1 Rex Dieter 2006-01-23 19:05:35 UTC
I cleaner implementation (that actually follows spec) would be to set  
$XDG_CONFIG_DIRS to point to a different location (holding applications.menu).  

Comment 2 Rex Dieter 2006-01-23 19:06:41 UTC
It's vitally important this get fixed before (wide) deployment of menu 
editors. 

Comment 3 Rex Dieter 2006-04-29 04:02:00 UTC
Problem being that if/when anyone *does* use a menu editor, menus can (not
always?) end up blank.

Only workaround is to undo any previous menu mods:
remove/rename ~/.config/menus
run: kbuildsycoca

Comment 4 Rex Dieter 2006-05-02 13:18:34 UTC
Have I mentioned this hack makes using $XDG_CONFIG_DIRS non-functional? (:

Comment 5 Rex Dieter 2006-05-03 14:17:14 UTC
Here's the implementation I've been using for awhile now in kde-redhat packaging:

1.  Drop use of 
Patch7: kdelibs-3.4.0-menu.patch
which hard-codes use of /etc/xdg/menus/kde-applications.menu

2.  Use this snippet in kdelibs.spec:
## menus 
pushd $RPM_BUILD_ROOT%{_sysconfdir}/xdg/menus/
mv applications.menu kde-applications.menu
ln -s applications-merged kde-applications-merged
popd
## xdg.d/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xdg.d/kde/menus
pushd    $RPM_BUILD_ROOT%{_sysconfdir}/xdg.d/kde/menus
ln -s ../../../xdg/menus/kde-applications.menu applications.menu
popd

You could alternatively simply move /etc/xdg/menus/applications.menu to
/etc/xdg.d/kde/menus/applications.menu and skip the symlinks (I don't think they
help backward-compatibility-wise anyway).

3.  Set $XDG_CONFIG_DIRS

I chose to do this in kdebase, creating
/etc/kde/env/kde-menus.sh
containing:
## from http://standards.freedesktop.org/menu-spec/latest/
# XDG_CONFIG_DIRS: where to look for menu config(s)
if [ -z "${XDG_CONFIG_DIRS}" ]; then
  XDG_CONFIG_DIRS=/etc/xdg.d/kde:/etc/xdg
  export XDG_CONFIG_DIRS
fi

It's not completely clear to me (from reading the spec) whether including
/etc/xdg explicitly in XDG_CONFIG_DIRS is absolutely required, but I figured it
doesn't hurt either.

Comment 6 Than Ngo 2006-05-04 17:47:42 UTC
it's fixed in new kdelibs-3.5.2-3/kdebase-3.5.2-7. Thanks for your report.

Comment 7 Rex Dieter 2006-07-18 16:35:33 UTC
Arg, I see kdelibs-3.4.0-menu.patch is back, which effectively disables the use
of $XDG_CONFIG_DIRS.

Comment 8 Rex Dieter 2006-07-18 16:38:51 UTC
I suspect kdelibs-3.4.0-menu.patch was reintroduced, because of reported crashes
due to its removal (notably from users who had previously used kmenuedit and had
~/.config/menu bits referencing kde-applications.menu).

Comment 9 Rex Dieter 2006-09-29 13:18:39 UTC
ping, any comment?

I'm (still) receiving reports about kiosktool not working correctly due to this.

Comment 10 Ngo Than 2006-09-30 11:03:52 UTC
ok, i have reread the menu-spec. We should avoid adding of extra directories for
KDE menu. I think the correct fix is to use XDG_MENU_PREFIX as in menu-spec .

there's the fix

cat /etc/kde/env/env.sh
if [ -z "${XDG_MENU_PREFIX}" ] ; then
        XDG_MENU_PREFIX="kde-"
        export XDG_MENU_PREFIX
fi

install KDE applications.menu into /etc/xdg/menus/kde-applications.menu

The fix will be included in next kdelibs-3.5.4-9.fc6.

Comment 11 Rex Dieter 2006-09-30 22:51:06 UTC
Nice, even better, thanks.

Comment 12 Rex Dieter 2006-12-07 14:27:17 UTC
Your idea of trying to use XDG_MENU_PREFIX was a good one, but unfortunately
kdelibs didn't support it (as of 3.5.5).  I'll attach a patch recently applied
upstream to address that, so that we can try it out.

Comment 13 Rex Dieter 2006-12-07 14:28:58 UTC
Created attachment 143053 [details]
upstream patch to enable use of XDG_MENU_PREFIX

Comment 14 Than Ngo 2006-12-07 15:34:34 UTC
yes i have seen the fix commited in 3.5 tree, it will be included in next 
kdelibs rebuild. I hope it will not cause any menu problem with 
XDG_MENU_PREFIX.

Anyway thanks for your attached patch!

Comment 15 Rex Dieter 2007-01-10 18:51:23 UTC
I've confirmed that using XDG_MENU_PREFIX (with patch) now works as advertised.
 yay.


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