Bug 402377 - kf5 doesn't honor XDG_MENU_PREFIX at all
Summary: kf5 doesn't honor XDG_MENU_PREFIX at all
Status: REPORTED
Alias: None
Product: frameworks-kded
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.28.0
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-20 12:12 UTC by Franklin Weng
Modified: 2025-07-13 18:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Screenshot -- wrong behavior (197.14 KB, image/png)
2018-12-20 12:17 UTC, Franklin Weng
Details
Screenshot -- the correct menu (182.23 KB, image/png)
2018-12-20 12:18 UTC, Franklin Weng
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Franklin Weng 2018-12-20 12:12:51 UTC
SUMMARY
It looks like that kf5 does not honor the XDG_MENU_PREFIX environment variable at all.  When I set it to another menu prefix, it won't read the menu file I want, but still read /etc/xdg/menus/kf5-applications.menu.  Originally I found it in Kubuntu 16.04 and was wondering if it is a bug in Kubuntu or KDE, but this time I installed KDE (5.28.0) in Debian Stretch (9.6.0) and saw the same problem.  Besides, in LxQT, which uses KDE Framework 5, has the same problem too.

Not sure if this problem is in KF5 or Qt5.

STEPS TO REPRODUCE
1. sudo add-key adv --keyserver keyserver.ubuntu.com --recv-keys 4CD565B5
2. sudo apt update; sudo apt install ezgo-menu
3. restart X window (by restarting displaying manager) and re-login
4. the XDG_MENU_PREFIX is set to "ezgo-" in /etc/X11/Xsession.d/33-ezgo-menu and the environment variable (examined by running 'env') is also set to "ezgo-".  But it still reads kf5-applications.menu.
5. with root privileges, run
   cd /etc/xdg/menus
   mv kf5-applications.menu kf5-applications.menu.bak
   ln -s ezgo-applications.menu kf5-applications.menu
   and re-login, the ezgo menu worked.

OBSERVED RESULT
kf5-applications.menu is always used no matter what I set to XDG_MENU_PREFIX

EXPECTED RESULT
It should follow the environment variable XDG_MENU_PREFIX

SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 5.8.6 
KDE Frameworks Version: 5.28
Qt Version: 5.7.1

ADDITIONAL INFORMATION
Comment 1 Franklin Weng 2018-12-20 12:17:14 UTC
Created attachment 117024 [details]
Screenshot -- wrong behavior

The environment variable XDG_MENU_PREFIX=ezgo- 
but the application menu is still kf5 menu.
(Attach another image for comparing later)
Comment 2 Franklin Weng 2018-12-20 12:18:39 UTC
Created attachment 117025 [details]
Screenshot -- the correct menu

The correct menu was shown when I create a symbolic link "kf5-applications.menu" pointing to "ezgo-applications.menu", i.e., the system thinks my ezgo-applications.menu is kf5 menu.

XDG_MENU_PREFIX does not matter at all.
Comment 3 Christoph Feck 2019-01-17 03:35:38 UTC
I see XDG_MENU_PREFIX in locateMenuFile(), see https://cgit.kde.org/kservice.git/tree/src/sycoca/vfolder_menu.cpp#n731

But I am not sure if what you see is related to kservice or kded.
Comment 4 Franklin Weng 2019-01-17 06:12:11 UTC
(In reply to Christoph Feck from comment #3)
> I see XDG_MENU_PREFIX in locateMenuFile(), see
> https://cgit.kde.org/kservice.git/tree/src/sycoca/vfolder_menu.cpp#n731
> 
> But I am not sure if what you see is related to kservice or kded.

I've searched the code for many times, and didn't see anywhere forcing XDG_MENU_PREFIX to be "kf5-" either.

However, even the environment variable is correctly set (to other value), kf5 would still look for kf5-applications.menu only.  It does not act like this when in KDE 4.