modification for fixmenus

What features/apps/bugfixes needed in a future Puppy
Post Reply
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

modification for fixmenus

#1 Post by MU »

I run fixmenus from .xinitrc, and each time a windowmanager is restarted (Muppy uses a special technique for this).
This assures, that it is always up to date, also if new dotpups were installed or other changes were made in /usr/share/applications.

However this is an unnecessary slowdown, if the menu did not change since the last restart.
So I added now some lines, that will check that.
If no change is detected, the fixmenus exits before it starts to fix anything.

It uses 2 checks, the size of /usr/share/applications reported by "du", and the number of chars counted by "ls".
This should be quite reliable.

The following code is from Puppy 301.
I also added a patch to keep JWMs theme, that otherwise is overwritten by fixmenus, and in the end I call another script that translates it.

The new code is called "patch2".

Mark

/usr/sbin/fixmenus

Code: Select all

#!/bin/sh
#v2.14 Puppy now has XDG menus.
#this script builds the menus from template files.
#Any templates can be placed into /etc/xdg/templates, and the file must be
#named to show its final destination. For example, the template for JWM:
# _root_.jwmrc
#...the '_' will be converted to a '/', so the generated JWM config file is:
# /root/.jwmrc

#-- patch by MU
theme=`grep '<Include>/root/.jwm/themes' /root/.jwmrc`

#-- patch2 by MU

oldsize=`cat ~/.oldxdg`
newsize=`ls /usr/share/applications | wc -c`
doit="0"

if [ "$oldsize" != "$newsize" ];then
	doit="1"
fi
oldsize2=`cat ~/.oldxdg2`
newsize2=`du -b -s /usr/share/applications`
if [ "$oldsize2" != "$newsize2" ];then
	doit="1"
fi
if [ "$doit" = "0" ];then
	exit 0
fi
echo "$newsize" > ~/.oldxdg
echo "$newsize2" > ~/.oldxdg2
#sync
#-- end of patch2 by MU

#-- added by MU: display a message
xmessage -bg orange -center -borderless -buttons "" "rebuilding menus..." &
pid=$!



TEMPLATES="`ls -1 /etc/xdg/templates | tr '\n' ' '`"

for ONETPL in $TEMPLATES
do
 [ "$ONETPL" = "README.txt" ] && continue
 ONEDEST="`echo -n "$ONETPL" | sed -e 's/_/\//g'`"
 ONESRC="/etc/xdg/templates/$ONETPL"
 echo "Generating $ONEDEST..."
 
 [ -f $ONEDEST ] && mv -f $ONEDEST ${ONEDEST}-previous

 cat $ONESRC |
 while read ONELINE
 do
  EXECMENU="`echo -n "$ONELINE" | grep -o 'PUPPYMENU.*' | cut -f 2-5 -d ' '`"
  if [ "$EXECMENU" = "" ];then
   echo "$ONELINE" >> $ONEDEST
  else
   ${EXECMENU} >> ${ONEDEST}
  fi
 done

done

#-- patch by MU
sed -i -e "s#</JWM>#$theme\n</JWM>#" /root/.jwmrc

translate-menus
kill $pid
###END###

Last edited by MU on Sat 01 Mar 2008, 19:03, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

my patch was erratic, updated the code in the first message.
Also added a message-window, as rebuilding menus can last a while with many entries, e.g. if you have KDE installed.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
s-kami
Posts: 138
Joined: Thu 30 Apr 2009, 11:56
Location: Hungary
Contact:

fixmenus in 4.3.1

#3 Post by s-kami »

Hi, I am Kálmán Staudinger from hungary, and i would like to know,
why fixmenus script change my submenus (application names) from hungarian to english in 4.3.1 ?.

Every time i install a package, i need to restore the original menu.

Do you have an idea?

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Re: fixmenus in 4.3.1

#4 Post by musher0 »

s-kami wrote:Hi, I am Kálmán Staudinger from hungary, and i would like to know,
why fixmenus script change my submenus (application names) from hungarian to english in 4.3.1 ?.

Every time i install a package, i need to restore the original menu.

Do you have an idea?
Hello, "s-kami"

Does this happen in jwm window manager? Have you tried / would this happen in icewm or pekwm, for example?

As a temporary solution, you may be interested by dmenu, an alternative menu that works by typing the first letters of the program.

It's here, second message from the top of the page.
http://www.murga-linux.com/puppy/viewto ... t&start=15
with the binding key also.

I have looked at the templates in /etc/xdg and they have no indication of language. So I don't know where the problem would be.

I have discovered that the following, that you put as the file "profile.local" in /etc partially localizes the Puppy. It causes the programs that are already localized (e.g. Abiword) to show their menu in your language.

Code: Select all

# profile.local in /etc
LANG=fr_CA
export LANG
LC_ALL=fr_CA 
export LC_ALL
LANGUAGE=fr_CA
export LANGUAGE
Of course, in the above, you would change the code "fr_CA" to the code for Hungarian, "hu_HU" (without the quotation marks).

This is as much help I can give you as to the problem itself that you mention. I am fairly good with configurations, but I am a not a Linux programmer.

I am sensitive to your problem, because there was, for a time, the reverse problem for Canadian-French in Puppy 3.01 and 4.0. The main menu of jwm or icewm would always stay in English, or the accents for my language would not display properly.

One last thought: is there a "hu" directory in /usr/share/locale or do you have only a "en" or "en_US" directory in that location? That happened to me once: I accidentally erased the directory for my language, and the language of the system went back to English! I recopied the directory "fr" from the /usr/share/locale in the Puppy ISO and all was ok again.

Best of luck!
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#5 Post by musher0 »

Hello,

I've presented for review some changes to fixmenus, here:
http://www.murga-linux.com/puppy/viewto ... 70f826a3a9

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
shinobar
Posts: 2672
Joined: Thu 28 May 2009, 09:26
Location: Japan
Contact:

Re: fixmenus in 4.3.1

#6 Post by shinobar »

s-kami wrote:why fixmenus script change my submenus (application names) from hungarian to english in 4.3.1 ?.
the problem is not in fixmenus, but in petget.
three scripts in /usr/local/petget calls fixmenus.
  • installpreview.sh
  • petget
  • removepreview.sh
comment out the statements setting LANG to C from these 3 scripts.

Code: Select all

export LANG=C
to:

Code: Select all

#export LANG=C
4.3.1 Japanese Edition does so.

Post Reply