KDE menus customization removed

I added my own custom menus to applications.menu in /etc/xdg/menus. During an update yesterday that file was replaced, wiping out my additions.

This isn't a big deal since I can just add them back to that file, just an irritation. However, it got me thinking that there must be a way to do this in the user folders that should let me merge menus without having to update the system level menu file.

I searched and searched, but I never did find out a way to do that. If anyone else has an easy answer to this, please let me know. My custom directory, application, and icons all work just fine from my home directory to override as I would expect, I just couldn't figure out how to use a default menu location, I'm not sure it exists, I'm just assuming it does. I tried creating a local share menus directory, but it didn't work. I couldn't find any details about the menus searching, only the others like

Maybe there's a code that would need to be in the applications.menu file for custom menus to get merged like there is for applications and directory files?

<DefaultAppDirs/> 
<DefaultDirectoryDirs/>

Here are the locations where I have my files.

/etc/xdg/menus 
⌁/.local/share/desktop-directories
⌁/.local/share/applications
/.local/share/icons

This is the code I used to add into the applications.menu file. My menu files are also sitting in /etc/xdg/menus.

<!-- Begin additions to applications.menu at /etc/xdg/menu -->
        <Menu>
                <Name>Dale's Sorted Menu</Name>
                <MergeFile>dale.menu</MergeFile>
                <MergeFile>dale-studio.menu</MergeFile>
                <MergeFile>parrot-applications.menu</MergeFile>
        </Menu>
<!-- End additions to applications.menu at /etc/xdg/menu  -->

Here's a sample of what my custom menu looks like.

After I make an update I'm refreshing the menus by typing:

sudo update-desktop-database
2 Likes

I know this Icon from somewhere! :joy:


Wew, that looks nice! I need to invest some time into this - maybe to create a Garuda custom menu :eyes::grin:
No idea why this was overwritten but Ill surely find out.

2 Likes

I have never bothered to go to the extent of creating custom sub-categories, but there should be a way of creating a persistent copy in your $HOME I would think.

If there is not, you could do this yourself by creating a pacman hook to recreate your configuration file after every update. If you figure out which packages are responsible for overwriting your custom changes you could have the pacman hook only trigger when those specific packages are updated.

Kind of like using a sledgehammer to swat a fly, but I'm rather fond of that myself. :rofl:

2 Likes

The update was most likly kde 5.21 it changes the app menu so it removes all customizations
But yeah a custom garuda catigory would be nise for garuda gamer welcome etc.

1 Like

:grin: I didn't know what the icon was from, I just knew it matched the dragon theme pretty well. I saw it was in the Beautyline set so I copied it to .face.icon. I really like the look and feel of Beautyline,

At the risk of getting way too deep into the weeds about icons, application, and desktop directory files, I only added custom icons for stuff that didn't have something by default, examples like command line programs. I add directories for my own category break outs and copy application files so I can override the default categories with my own choices. Everyone has a set of special customizations that they like, that's why we are on linux to begin with. This is one of mine.

I like to have icons in my menus even for many command line programs to keep them categorized with what I think the categories should be and so I can browse them at a glance. I also don't like having to remember the exact command to open them. So I create desktop files that call a script to open a dedicated shell for them, sort of like how parrot security does it (I stole the idea from parrot/kali/blackarch distros that all do something like this, parrot just was the first one that had how to start the shells as root in their scripts back when kali was still making you log in as root instead).

I have the runner execute the help command to remind me of the tools options on start up. I think this ease is part of why people use those distros, but I find there are so many tools you can't even keep track of them all. That's why I just install the ones I plan to use and steal the good ideas from the distros.

Now that I have the aur and chaotic aur I've got a lot easier time finding obscure tools without having to use some specialty distro. So far only a couple weren't available, and those were just because they were too out of date (which I hadn't realized initially).

Example:
Screenshot_8

1 Like

I'll keep looking for a way to do something in $HOME.

The pacman hook is a good idea, I hadn't thought of that, I'm new enough to pacman that I didn't know that was possible yet.

I was thinking about just having a script in my home directory to re-push, maybe I'll do something about it later, right now I have a workaround by just manually coping back.

1 Like

I dont know if you tried it yet, but kmenuedit seems to be the easy way:

Stuff will be saved in ~/.local/share/desktop-directories/ so its a way to do it in $HOME :grin:

Furthermore I think customisations are overwritten whenever this package is upgraded:

╭─nico@T440p in ~ took 1ms
╰─λ pacman -Qo /etc/xdg/menus/applications.menu
/etc/xdg/menus/applications.menu is owned by kservice-git 5.80.0_r874.gfc86866-1
3 Likes

No I hadn't tried Kmenuedit, I hadn't heard of it yet. This is actually my first time using KDE and every other gui tool I have tried for XDG compliant menus were inadequate so the thought hadn't even crossed my mind to check out another one, lol.

I hadn't realized that was there, although I see it's a simple right click to open it. I do some experimentation.

1 Like

I could be wrong, but I have a sneaking suspicion major KDE updates will result in your changes being wiped using this method as well .

Yes, I investigated this method last night. It creates a new menu file in ~/.config/menus and then it adds that menu to the bottom of the applications.menu in /etc/xdg/menus (essentially it's doing the same thing I was doing, but with it's menu file being stored somewhere else.

It's could be easier to do certain things with this tool, like moving an individual item from one menu to another (it makes all the include/exclude statements for you, which could be faster than doing it manually.

I suspect KDE might even have accounted for this tool so that it wouldn't remove the entry from the applications.menu on refresh, or maybe it was already there in the default and just didn't have anything to merge until I added something, which means I could make my mods to the applications-kmenuedit.menu instead of applications.menu and have them stay maybe.

One thing I did notice is that like with other tools for this that I've tried, you still get forced into an alphabetical order for the menu items even when you try to order them differently, this has to do with the way everything gets put into xml and then merged and deduped after you try to apply those rules I think. Also, even though the tool has ways to add separators those aren't used at all by KDE's menu and are ignored, I've seen this with other menus too, xfce will display these for example, so it's not that the commands are not being put into the config, it's that the menu isn't implementing that function - probably the same with both the ordering and the separator bars.

1 Like

I’m pretty sure on some updates you will lose your customizations. At least that’s what I found in the past, (so I just quit using this method).

Perhaps things have changed of late. Be sure to let us know.

1 Like

This all had me worried but I checked by right clicking on the 'Application Menu' and the first item is 'Edit Applications' and up poped the 'Kmenuedit'. Thanks for that. Kmenuedit has been apart of KDE for about 20 years.

gary

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.