Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 01 Aug 2014, 10:34
All times are UTC - 4
 Forum index » Taking the Puppy out for a walk » Suggestions
modification for fixmenus
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 07 Feb 2008, 22:10    Post subject:  modification for fixmenus  

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:
#!/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###


_________________
my recommended links

Last edited by MU on Sat 01 Mar 2008, 15:03; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Fri 08 Feb 2008, 00:13    Post subject:  

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

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
s-kami


Joined: 30 Apr 2009
Posts: 50
Location: Budapest

PostPosted: Thu 19 Nov 2009, 11:14    Post subject: fixmenus in 4.3.1
Subject description: fixmenus in 4.3.1
 

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?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
musher0


Joined: 04 Jan 2009
Posts: 4229
Location: Gatineau (Qc), Canada

PostPosted: Mon 14 Dec 2009, 22:18    Post subject: Re: fixmenus in 4.3.1
Subject description: fixmenus in 4.3.1
 

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/viewtopic.php?t=39411&sort=lastpost&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:

# 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!

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 4229
Location: Gatineau (Qc), Canada

PostPosted: Wed 16 Dec 2009, 20:34    Post subject:  

Hello,

I've presented for review some changes to fixmenus, here:
http://www.murga-linux.com/puppy/viewtopic.php?t=49473&start=480&sid=ab04dd66ac8ef2c355a31170f826a3a9

BFN.

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
shinobar


Joined: 28 May 2009
Posts: 2606
Location: Japan

PostPosted: Sun 20 Dec 2009, 05:34    Post subject: Re: fixmenus in 4.3.1
Subject description: fixmenus in 4.3.1
 

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:
export LANG=C

to:
Code:
#export LANG=C

4.3.1 Japanese Edition does so.
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Taking the Puppy out for a walk » Suggestions
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0708s ][ Queries: 12 (0.0080s) ][ GZIP on ]