bluesabre / menulibre

MenuLibre is an advanced menu editor that provides modern features in a clean, easy-to-use interface.
https://bluesabre.org/menulibre
GNU General Public License v3.0
212 stars 17 forks source link

Include tags are removed from all folders and replaced with layout on save #76

Open extradium opened 3 years ago

extradium commented 3 years ago

When clicking "save", regardless of whether any applications folders have been altered, MenuLibre strips all <Include>CategoryName</Include> tags from ~/.config/menus/xfce-applications.menu, and writes all existing desktop entries into the <Layout>...</Layout> section for that folder.

This results in any menu entries which are enumerated by their category in the .desktop file being hidden from the main menu. Any additional .desktop files which are created and not manually entered into the layout for that folder are ignored and so do not appear in the menu. These items then need to be explicitly included by manually editing the xfce-applications.menu file before they will show in the applications menu.

Steps to reproduce: (You must start with a xfce-applications.menu which has not been affected by this bug, ie has not ever been saved with MenuLibre)

  1. Create a valid desktop file in ~/.local/share/applications/
  2. Ensure valid entry on "Categories=" line (such as Network/Utilities/Development) corresponds to a folder already displayed in your menu
  3. Assert the new item appeared under relevant category
  4. Open Menulibre, click save, exit Menulibre
  5. Create a second valid desktop file, using same "Categories=" line as in step 2
  6. Assert new item does not appear in applications menu under relevant category

Ideally, a menu folder/category should not be altered on save if the user has not made any changes to that folder/category. Currently, clicking "save" under any circumstance will modify all folders in the XFCE4 applications menu, applying sometimes undesirable layout/ordering to ALL menu items, and thereby ignoring ALL "categories" information in .desktop files.

A solution would be to simply leave the <Include> tags intact, and ensure the <Merge type="files"/> tag is placed under the desktop filenames within the <Layout> tags. This would retain the ordering selected by the user, while appending newly installed .desktop files relevant to that category at the bottom of the list.

A simple checkbox labelled "Display all apps in category", corresponding to the retention of the <Include> tags would be a simple way to offer choice to the user.