Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-09-04 01:13:28

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Menus messed up yet again

I need to find out what is messing up my menus and figure out how to stop it.

I do a lot of video editing, for which I have 50+ programs installed. Scrolling through 'Multimedia' got to be a pain, so several years ago I found the ~/.config.menus/xfce-applications.menu and figured out how to edit it. It took me two days of work, mostly due to having to learn the syntax in the file. One of the things I did was to create three folders, splitting 'Multimedia' into Multimedia-Editors, Multimedia-Players and Multimedia-Subtitles.

About three months ago I went to launch one of the subtitle editors, and discovered, to my horror, that my three folders were gone. Most of the programs were in a re-created Multimedia folder, although a dozen or more were completely missing. I went to ~/.config/menus, and there was a new xfce-applications.menu with the current date stamp. My old file was still there, so after a quick renaming I was back in business. Of course, I would never have done this myself. Was it part of an Xubuntu update? Something else? I never figured it out.

Today it has happened again. Except that this time my custom menu file has been edited and my three folders deleted from it, with a new Multimedia folder inserted, again containing most of the contents of my three custom folders. The time stamp on my custom menu file remains in 2019, when I created it. I don't understand how this can be.

My /home folder is rsync-ed to another drive as a backup nightly, but it is a mirror, so the original of my file has been replaced by the new bogus version. I must now recreate it from scratch. That is, unless I can figure out an alternative or better way to add menu folders.

I hoped to use Alacarte or MenuLibre to assist with this, but neither allow me to do what they say I can do. I tried to create a new folder, but the OK button does nothing. I tried just to create a new launch item for an existing program, but the browse option won't display anything executable, and if I type the filename in manually the OK button still won't work. I tried launching the menu editors from the command line with sudo, but both programs still lock me out of any editing functions. They used to work. What happened?

I haven't yet tried working with the .desktop files, because most of them are in /usr/share/applications where you have to be root to edit them, and others are scattered around in ~/. I thought of editing the .desktop files for each multimedia app, but specifying a menu folder that doesn't exist isn't likely to work.

I did find six files in ~/.local/share/desktop-directories, two for each of my missing folders, but none has a list of entries that are supposed to be displayed, and I haven't yet found any documentation about what these files do. They are just short text files, looking somewhat like a .desktop file, but terminating in .directory. I'm especially interested in these files in hopes that I could use them to restore my missing folders (which were listed in my own .menu file), and then just edit the .desktop files to specify the specific folders where they are to appear.

I hope someone can explain what is going on and/or point me to some documentation for dummies.

Offline

#2 2023-09-04 10:41:34

JmaCWQ
Member
Registered: 2022-12-06
Posts: 39

Re: Menus messed up yet again

I know this isn't what you're wanting but works ok and gets a similar result, only not from the Menu.
When I want multiple apps to select from for a particular 'category' I create multiple launchers on the Panel.
If wanting to do what you are I'd create 3.
In one I'd put launchers for all the apps from Multimedia-Editors, in another I'd put launchers for all the apps in Multimedia-Players and the 3rd the apps for Multimedia-Subtitles.

I have created 4 launchers on my own Panel that between them contain a total of over 70 individual app launchers.
It does take a little while to initially create them and set them up how desired, re-order the list, change icons or whatever, but once done nothing messes with them and they remain unchanged until I want to change something.

One of mine.
Any with multiple launchers have the little arrow displayed.
I find them quick and easy to get at and operate.

launcher.png

Offline

#3 2023-09-04 17:46:41

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Menus messed up yet again

@JmaCWQ: Thanks for the reply. Your idea is not a bad one and if I'd thought of it years ago before I created my custom ~/.config/menus/xfce-applications.menu I might have done it your way. However, I have had some success in recreating my menus and by the end of today I should be back where I was.

I discovered why Alacarte, MenuLibre, LX Menu Editor and MX Menu Editor all failed to work: The problem was that the applications widget in the panel hadn't adopted the menu file in its incarnation after I made an initial small edit to it. Once I solved that problem they all allowed me to create new entries, although they still cannot create a new folder. When the OK button failed to work an error message explaining why would have been useful (Note to devs). And the documentation should make it clear that these utilities can create entries, but not folders. Or if my problem with creating folders is due to a failure to understand the proper procedure, then error messages and better documentation is called for.

Failing to create folders with menu editors means creating a new folder requires adding it manually to the xfce-applications.menu file, and then re-pointing the panel applications widget to it. That wasn't as tough as it had been when I first started this journey years ago. All I had to do was copy a small existing folder in the file, paste it back in below, and then edit its title. Once I got the menu editors working I used Alacarte to create at least one new entry in each of my three newly re-created custom folders, whereupon each custom folder finally appeared in the panel application widget. And finally, the bogus re-created Multimedia folder is still in the xfce-applications.menu file, containing a line for each application. Rather than create all the entries with Alacarte (time-consuming) I can just copy and paste them from the Multimedia folder into the correct one of my three custom folders, and ultimately delete the Multimedia folder.

During all of this work in the xfce-applications.menu I was reminded of a problem with editing it, (it's a markup file, whatever that is), i.e., there is apparently no way to make a line a remark or comment. For example, in a bash script you can create all kinds of instructions and comments that will be ignored when the script is run, simply by putting a # at the beginning of the line, or the point in the line where the rest of the line is to become just a comment. That would be extremely handy in editing the xfce-applications.menu, but none of my net searches have turned up the secret for how to do this. For sure the # character doesn't do it.

My final (original) problem continues: I still don't know what caused this disaster, except that it certainly wasn't me. More importantly, I haven't figured out how to stop it from happening again. I have three network attached storage devices which should be safe from dist-updates and dist-upgrades, so I can certainly make backups there. I would like to protect the file from being edited by anything or anyone but me, but I don't know if that is even possible, and if so, how to do it. It ought to be possible; this is, after all, Linux. smile

Last edited by John Jason Jordan (2023-09-04 17:47:14)

Offline

#4 2023-09-05 16:04:15

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 265

Re: Menus messed up yet again

Greetings to you, and my sympathies for your menu "dilemma" ...

Based on what I found via Dr. Google, your distro's default menu(s) are originally located in /etc/xdg/menus/* ... In Xfce v 4.16 and 4.18, these files are in xml-format (though prior versions my use a different markup)... Later-on they will be propagated/copied to ~./config/menus/* to provide the operative menus for each user.

Could that process be overriden/tweaked persistently on a per-user basis? Idk -- I am not a distro-developer myself. However, it would make sense to save genuine backup copies of the menus in ./config under ~/.local/menus, compare them (via script) during login with those in ~/.config and refresh/restore them if there's a difference. Just a thought ...

Cheers, m4a

PS: Personally, I prefer to and extensively use the multi-launch button scenario/design discussed above -- i find it safer to create, manage, backup & restore imho.


Linux Mint 21.2 -- xfce 4.18 ... Apple iMAC -- Dell & HP Desktops and Laptops -- Family & Community Support

Offline

#5 2023-09-05 18:28:16

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Menus messed up yet again

mint4all wrote:

Based on what I found via Dr. Google, your distro's default menu(s) are originally located in /etc/xdg/menus/* ... In Xfce v 4.16 and 4.18, these files are in xml-format (though prior versions my use a different markup)... Later-on they will be propagated/copied to ~./config/menus/* to provide the operative menus for each user.

Could that process be overridden/tweaked persistently on a per-user basis? Idk -- I am not a distro-developer myself. However, it would make sense to save genuine backup copies of the menus in ./config under ~/.local/menus, compare them (via script) during login with those in ~/.config and refresh/restore them if there's a difference. Just a thought.

Thanks for that information; it never occurred to me that the file in ~/.config/menus was just for me, and the main version of the fie is elsewhere. I never think of such things because I live alone and I'm the only user on my computers. Just now I looked in /etc/xdg, and you're right, there is another xfce-applications.menu file. Looking at it with Mousepad it looks like a really basic slimmed down menu, with no installed programs, not even the ones installed with a fresh install of the OS. That file couldn't be the source of my problems because when the trouble happens all my stuff is mostly still in the menu; it's just my custom folders that are gone and everything is moved to re-created default menus. I hate to sound paranoid, but something targeted just me.

Comparing files at login is a good idea, except that under normal use I log in only every few months, usually because a dist-update requires a restart. My computers run continuously 24/7.

It's also hard to believe that something/someone on the net is hacking me. I have a gigabit fiber connection which goes through a custom flashed router with firewall, then to ethernet; no wifi here, and I connect via a VPN, currently a server in Stockholm. More importantly, there's nothing here to attract a hacker, and even if the hacker just wants to commit random malice, messing up only the launch menus sounds silly. No, it must be something on this computer that is doing it, possibly some tool that I use myself without realizing that it has a secondary evil purpose. And if that's the case, tracking down the culprit might be next to impossible, although I suspect some little used xfce utility, something that few ever use, and something with a configuration setting that only I have set up. That's also highly unlikely, but I'm grasping at straws here.

My xfce-application.menu file is now fixed. It took ten hours, although only a couple hours of that were spent on actually doing the work; the rest of the time was spent online looking at how-tos.

For the time being I just made a copy on an external Thunderbolt 3 drive which, in turn, is mirrored every night to a NAS. That gives me three copies, but with nightly mirror backups, if the file is altered, in 24 hours the backup will also be the altered file.

I'm thinking of an rsync script to be run manually, coupled with an automated daily popup with two buttons, 'Run menu file backup? Yes No.' If I click on Yes the script will copy the file to a folder on an internal disk that is not used for my mirrored backups. That's the best idea I can come up with. Alternative suggestions welcome!

Offline

#6 2023-09-06 08:41:01

gogogadget
Member
Registered: 2023-03-19
Posts: 17

Re: Menus messed up yet again

John Jason Jordan wrote:

I'm thinking of an rsync script to be run manually, coupled with an automated daily popup with two buttons, 'Run menu file backup? Yes No.' If I click on Yes the script will copy the file to a folder on an internal disk that is not used for my mirrored backups. That's the best idea I can come up with. Alternative suggestions welcome!

Or you could make it completely automatic with a timer, associated to a service, which launch your script every x minutes/hours.

Regarding your menu problem I can't help since I use a launcher, the only time I use the menu is for some apps I use once a year and i don't remember their names. smile


Xfce+gtk3-classic (no CSD)+Picom

Offline

#7 2023-09-06 19:51:41

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Menus messed up yet again

gogogadget wrote:
John Jason Jordan wrote:

I'm thinking of an rsync script to be run manually, coupled with an automated daily popup with two buttons, 'Run menu file backup? Yes No.' If I click on Yes the script will copy the file to a folder on an internal disk that is not used for my mirrored backups. That's the best idea I can come up with. Alternative suggestions welcome!

Or you could make it completely automatic with a timer, associated to a service, which launch your script every x minutes/hours.

No, it can't be automatic. Since forever I've had an rsync script to back up / and /home to an external drive, set by cron to run at 3am every day. And that's what caused my present mess. *Something* (not yet figured out what it is) overwrites my ~/.config/menus/xfce-applications.menu file, replacing all my custom folders, and does so without changing the filename or timestamp. It's random, so it's unlikely I would realize this has happened before the next 3am backup script, so after 3am my only backup would be the new bogus file and I have no backup of the original file. That's what happened to me this time, and I had to recreate the file manually myself, taking over a day's work.

I need to run the script manually myself, and only after verifying that the xfce-applications.menu file is the correct one.

Offline

#8 2023-09-06 21:47:11

gogogadget
Member
Registered: 2023-03-19
Posts: 17

Re: Menus messed up yet again

John Jason Jordan wrote:

Since forever I've had an rsync script to back up / and /home to an external drive, set by cron to run at 3am every day. And that's what caused my present mess. *Something* (not yet figured out what it is) overwrites my ~/.config/menus/xfce-applications.menu file, replacing all my custom folders, and does so without changing the filename or timestamp.

I have been using Borg+Borgmatic and now Borg+Emborg, I backup /etc and some directories in home every 2 hours and it never messed with my system.


Xfce+gtk3-classic (no CSD)+Picom

Offline

#9 2023-09-06 23:12:53

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 265

Re: Menus messed up yet again

@ JJJ

This may be a good time to visit, then tweak, your menu file's access "permissions". Thunar's file-permission's tab provides access rights for the file's "Owner", "Group"-access, and "Others"-access. To narrow this down, I would first deny access to "Others" first, then later to deny access to whatever "Group" is setup. Then wait and see if the mess-up happens again.

Who, btw, is the "Owner" of the menu file? Is it you, or root? Yes, this could be done via CLI, but Thunar is sooo confinient ...

Cheers, m4a


Linux Mint 21.2 -- xfce 4.18 ... Apple iMAC -- Dell & HP Desktops and Laptops -- Family & Community Support

Offline

#10 2023-09-07 06:11:10

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Menus messed up yet again

mint4all wrote:

This may be a good time to visit, then tweak, your menu file's access "permissions". Thunar's file-permission's tab provides access rights for the file's "Owner", "Group"-access, and "Others"-access. To narrow this down, I would first deny access to "Others" first, then later to deny access to whatever "Group" is setup. Then wait and see if the mess-up happens again. Who, btw, is the "Owner" of the menu file? Is it you, or root? Yes, this could be done via CLI, but Thunar is sooo convenient.

I have Thunar, of course, but these days I've been using Caja, a fork of Nautilus. But it doesn't matter; all the GUI file managers offer the same permissions options. I am the sole user on this computer, no one else even has physical access to it. I have read/write permissions and so does everyone in the group JJJ, which has only me as a member. No one else can access it. The bare-bones file in /etc/xdg is owned by root, of course, but that file can't have anything to do with this issue. For years the only other creature that has been inside the house has been the cat. I've seen him trying to use the keyboard, but frankly, his typing sucks so bad he couldn't possibly have caused this mess.

As I have mentioned here previously, my internet connection is via a custom-flashed router with firewall, and goes to the internet through a VPN server in Stockholm. It's inconceivable to me that someone on the net could even get access to the computer, and if by some feat they did, why would they only mess up my menu file?

At this point I have to conclude that's something on this computer, most likely something in Ubuntu or Xfce4, or an installed program. I'm thinking of a setting that I've inadvertently turned on, or some feature that gets triggered by something, like maybe a funny typo. Xfce4 is near the top of my suspect list, but only because the file is part of Xfce4; nothing else even knows it is there. But having said that I have four menu editors installed: Mx Menu Editor, LX Menu Editor, Alacarte, and MenuLibre. I launched them a couple days ago while trying to fix the mess, but otherwise they haven't been run for years. Nevertheless, they clearly belong at the top of the suspect list.
Edit: I just launched each of the four menu editors one at a time, poked around for a minute or two, then closed it. After each one I refreshed the Applications widget in the panel, then looked at the menus. None were changed. Oh well. sad

Last edited by John Jason Jordan (2023-09-07 07:28:53)

Offline

#11 2023-09-07 15:37:53

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 265

Re: Menus messed up yet again

I must admit that I never had a need to tweak xfce's menu(s). I see now that Dr. Gogle pointed me to https://wiki.xfce.org/howto/customize-menu for some useful background info. It would appear, to anyway, that for apps to appear in a (possibly new) "sub-menu" the app's .desktop file must be edited by way of adding the requisite "submenu" in the category entry(s) ...

Finally, create .desktop files in your ~/.local/share/applications folder as shown above to populate the submenu. In order to be displayed in the submenu, add your custom category to the “Categories” list. One of these files, let's call it thunar-home.desktop, might look like this:

[Desktop Entry]
Version=1.0
Type=Application
Exec=/usr/local/bin/thunar /usr/home/yourname
Icon=file-manager
StartupNotify=false
Categories=X-Folders;
OnlyShowIn=XFCE
Name=home
Comment=home displayed in Thunar

With all this in place, you should have a new submenu called “Folders” using the file manager icon. The submenu entry shown above should display your home directory in Thunar. You can of course add more entries as shortcuts to common places like /cdrom, /stick, /, or whatever you see fit.

My question: did you modify your apps' .desktop files accordingly? If not, that would explain why your apps disappear from your sub-menus whenever to menu file is being re-parsed during caching ... Just a thought.

Re. pemissions: based on what ou said, imho the "messing-up" process thus clearly points to user-space, that would be you -- that exludes everbody else, incl. processes owned by root. That narrows the search a bit, imho.

Cheers, m4a


Linux Mint 21.2 -- xfce 4.18 ... Apple iMAC -- Dell & HP Desktops and Laptops -- Family & Community Support

Offline

#12 2023-09-07 21:49:04

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Menus messed up yet again

mint4all wrote:

I must admit that I never had a need to tweak xfce's menu(s). I see now that Dr. Google pointed me to https://wiki.xfce.org/howto/customize-menu for some useful background info. It would appear, to anyway, that for apps to appear in a (possibly new) "sub-menu" the app's .desktop file must be edited by way of adding the requisite "submenu" in the category entry(s).
With all this in place, you should have a new submenu called “Folders” using the file manager icon. The submenu entry shown above should display your home directory in Thunar. You can of course add more entries as shortcuts to common places like /cdrom, /stick, /, or whatever you see fit.
My question: did you modify your apps' .desktop files accordingly? If not, that would explain why your apps disappear from your sub-menus whenever to menu file is being re-parsed during caching ... Just a thought.
Re. pemissions: based on what ou said, imho the "messing-up" process thus clearly points to user-space, that would be you -- that exludes everbody else, incl. processes owned by root. That narrows the search a bit, imho

I have long known about .desktop files and occasionally edit, add, or delete them. But I should add that if I edit a .desktop file whose 'categories' line says 'Multimedia;' and add 'Multimedia-Editors to;' to the line, the application will still not show up in Multimedia-Editors unless 1) the Multimedia-Editors folder has been properly created in the xfce-applications.menu file with the application's .desktop file listed in it and, 2) the Applications widget in the panel has been refreshed. (Note that I use the Applications plugin, not the Whisker Menu plugin.) To refresh the plugin requires a number of steps: 1) right-click on the plugin in the panel and select Properties, which will pop up a little window. 2) At the bottom of the window there are two checkboxes. By default 'Use default menu' will be selected, but you need the second one 'Use custom menu file,' which has a (too tiny) file manager icon at the end. 3) Click on the file manager icon and select your xfce-applications.menu file, then on Open in the upper right corner. 4) Your plugin will still not be refreshed until you click on Close in the Properties window, at which point the panel will shudder for a millisecond or two. Now your Applications plugin should show your new folder with the application in it.

To create the folder means creating something like this in the xfce-applications.menu file:

<Menu>
        <Name>Education</Name>
        <Directory>xfce-education.directory</Directory>
        <Layout>
            <Merge type="menus"/>
            <Filename>menulibre-new-launcher.desktop</Filename>
            <Filename>PSPP-Statistics.desktop</Filename>
            <Filename>Praat.desktop</Filename>
            <Filename>SleepyHead.desktop</Filename>
            <Filename>SleepyHead-Appimage.desktop</Filename>
            <Filename>OSCAR.desktop</Filename>
            <Merge type="files"/>
        </Layout>
    </Menu>

And then at the end of the file there is a section like this, where you must add a line for your new folder:

<Layout>
        <Filename>xfce4-run.desktop</Filename>
        <Separator/>
        <Menuname>Settings</Menuname>
        <Menuname>Accessories</Menuname>
        <Menuname>Development</Menuname>
        <Menuname>Education</Menuname>
        <Menuname>Files</Menuname>
        <Menuname>Games</Menuname>
        <Menuname>Graphics</Menuname>
        <Filename>xfhelp4.desktop</Filename>
        <Menuname>Network</Menuname>
        <Menuname>Multimedia-Editors</Menuname>
        <Menuname>Multimedia-Players</Menuname>
        <Menuname>Multimedia-Subtitles</Menuname>
        <Menuname>Multimedia-Audio</Menuname>
        <Menuname>Optical-Drives</Menuname>
        <Menuname>Office</Menuname>
        <Menuname>Other</Menuname>
        <Menuname>System</Menuname>
        <Filename>xfce4-about.desktop</Filename>
    </Layout>

Once you understand the process it is simple to create folders just by copying and pasting an existing small folder, and then editing it with its new name and adding the new name to the Layout section. And then, of course, saving the .menu file and refreshing the panel plugin.

Here's the part where my knowledge is kind of dim: If I edit a .desktop file in /usr/share/applications by adding the new folder to its categories line, the application will still not show up in your new folder until it has been added to your menu file and the panel plugin has been refreshed. The line to add it to your new folder should be like this: <Filename>Praat.desktop</Filename>. Strangely, adding the new folder to the .desktop file's category line does not automatically make it appear, and if its <Filename>(name).desktop</Filename> is properly in the .menu file the application will still show up in the new folder, regardless of what's in its .desktop file. The categories line in the .desktop file and the <Filename></Filename> line in the .menu file seem to do the same thing, perhaps with sometimes cross purposes, and I don't understand exactly how it is supposed to work. I did edit the categories line in each program's .desktop file if it's in one of my my new folders and added its new folder.

Offline

#13 2023-09-08 19:16:06

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 265

Re: Menus messed up yet again

Thanks for your through write-up! VERY educational ... Afaict, you've gone through all the requisite steps (note: i am NO authority in this matter!). Btw: i came across an interesting discussion @ https://bbs.archlinux.org/viewtopic.php?id=184335  Well worth a good reading ...

Since we now know that `xfdesktop` parses the menu's particulars, it would appear that under certain conditions (ie toggling the custom-menu switch to "off" by accident) your personal menu gets over-written with the fully-expanded default menu, xml et al). Alas, I have not found any documentation on this (assumed) behavior.

So then, for the time being and strictly as a workaround, why not make your personal menu file "read-only" and wait for an error message to show up (popup or in the log files) if and when an over-write is being attempted? You could even go further, and create a new launcher button with the "xfdesktop --menu" command that obviates the use of the "Applications Menu" applet/widget in the panel; that's what I setup for my sticky-fingered users to keep them out of menu-trouble (ie editing & demolishing the default menu).

Cheers, m4a


Linux Mint 21.2 -- xfce 4.18 ... Apple iMAC -- Dell & HP Desktops and Laptops -- Family & Community Support

Offline

#14 2023-09-10 02:41:57

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Menus messed up yet again

Today I discovered a launch menu item 'Web' located under the Internet folder. Launching it I discovered that it had no program name in the title bar, and its Help > About was equally obtuse. After a couple hours I finally found it ith 'ps aux |grep web.' It turned out to be the epiphany browser, installed by snap. There was no .desktop file in the 'Network' folder.

Because it was a snap install explains why it was apparently another snap that didn't create a .desktop file, and added an Applications menu item without modifying the xfce-applications.menu file. This is so wrong! I thought the Linux world decided to standardize on .desktop files as the source of application launch menu entries. I guess snap is above trivia like adhering to standards. And I now have another suspect in my list of possible culprits that messed up my menus.

Edit: I have further discovered that the .desktop file for Brave Browser is also missing, another application that was installed by snap. Yet there is a launch entry in Applications > Internet, even though there is no mention of it in the xfce-applications.menu file. Snap apparently changes the menu file somehow to add a launcher, but without creating a .desktop file or (hang on to your hats) changing the timestamp on the xfce-applications.menu file.

Last edited by John Jason Jordan (2023-09-10 07:16:18)

Offline

Board footer

Powered by FluxBB