[SOLVED] in fluxbox, ~/.fluxbox/menu file overwritten

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED] in fluxbox, ~/.fluxbox/menu file overwritten

Postby r0b0tl0ve » Jun 8th, '13, 10:54

Every so often, the ~/.fluxbox/menu file, which controls the right-click menu for fluxbox, gets overwritten and replaced by the systemwide menu file. Why is this happening?

In the meantime, I have changed ~/.fluxbox/menu to be immutable, with `chattr +i`
Last edited by isadora on Jun 29th, '13, 11:13, edited 2 times in total.
Reason: Cosmetical alteration in subject ;)
r0b0tl0ve
 
Posts: 22
Joined: Apr 12th, '13, 02:00

Re: in fluxbox, ~/.fluxbox/menu file overwritten [RESOLVED]

Postby r0b0tl0ve » Jun 18th, '13, 11:11

I found the cause: in /etc/menu.d, the script named "fluxbox" does something kind of silly: it checks for a user-generated menu, and if it exists, it overwrites it. I have edited out that logic on my own system; I'll file a bug for this. Here's the patch:
Code: Select all
--- fluxbox.old   2013-06-18 02:01:28.610514703 -0700
+++ fluxbox   2013-06-18 02:01:55.725843341 -0700
@@ -1,10 +1,6 @@
 #!/bin/sh
 
-if [ "$USER_MENU" = "1" ]; then
- OUTPUTDIR=$HOME/.fluxbox
-else
- OUTPUTDIR=/etc/X11/fluxbox
-fi
+OUTPUTDIR=/etc/X11/fluxbox
 
 if [ "$VERBOSE" = "1" ]; then
  echo "writing to $OUTPUTDIR/menu"
r0b0tl0ve
 
Posts: 22
Joined: Apr 12th, '13, 02:00

Re: in fluxbox, ~/.fluxbox/menu file overwritten [RESOLVED]

Postby djennings » Jun 18th, '13, 14:44

IceWM does exactly the same thing.

Did you find out how the environment variable $USER_MENU gets set? If the menu is going to be written depending on that variable, it would be nice to know how it gets defined.
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK

Re: in fluxbox, ~/.fluxbox/menu file overwritten [RESOLVED]

Postby r0b0tl0ve » Jun 18th, '13, 20:19

It gets set by /usr/bin/update-menus, which gets triggered when the file named ".menu-updates.stamp" is present in one of /var/lib/menu/ or $HOME. /usr/bin/update-menus is called by /etc/X11/xinit.d/update-menus. I suspect .menu-updates.stamp gets added when you install an rpm which adds or changes a menu item.

In any case, updating the menu is a good thing, it's the overzealous script in /etc/menu.d that is bad. There is a script there for icewm; too. Here's the patch:

Code: Select all
--- icewm.old   2013-06-18 11:23:56.464184933 -0700
+++ icewm   2013-06-18 11:24:56.865879012 -0700
@@ -1,10 +1,6 @@
 #!/bin/sh
 
-if [ "$USER_MENU" = "1" ]; then
- OUTPUTDIR=$HOME/.icewm
-else
- OUTPUTDIR=/usr/share/X11/icewm/
-fi
+OUTPUTDIR=/usr/share/X11/icewm/
 
 echo "prog \"Terminal\" /usr/share/icons/mini/terminals_section.png /usr/bin/xvt" > $OUTPUTDIR/menu
r0b0tl0ve
 
Posts: 22
Joined: Apr 12th, '13, 02:00

Re: in fluxbox, ~/.fluxbox/menu file overwritten [RESOLVED]

Postby djennings » Jun 19th, '13, 00:25

OK I think I understand how it works now. Installing a new package triggers /usr/bin/update-menus which runs as root and set USER_MENU=0

/usr/bin/update-menus runs through the files in /etc/menu.d and will write the system wide menus (not the user menus) it will touch the file /var/lib/menu/.menu-updates.stamp so when users log on they can detect the change.

When a user logs on the file /etc/X11/xinit.d/menu is run which detects the presence of /var/lib/menu/.menu-updates.stamp and runs update-menus again this time with the -u option which forces the creation of user menus in your /home

At no point does it try to test if you have edited your own menu. The scripts do what they are intended to do. It is just not what you would like them to do :-(
If you change the menu file in ~/.fluxbox.init you can use your own menu definition.
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest