Find'N'Run

Filemanagers, partitioning tools, etc.
Message
Author
User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

sort order of translated Names in desktop files

#61 Post by L18L »

SFR wrote:... I have never encountered a .desktop file where 'Name[lang]=' is before 'Name=' (that's where my "assumption" came from ;)), have you?
Yes I have them en masse: created by momanager.
I have changed it in latest momanager now, but there might still exist many of them.
SFR wrote:Takes slightly more time, too, but still way below 0.100s (i3@2.13GHz).

Btw, side effect: it now picks up correct 'Name=' field from transmission-qt.desktop (an issue mentioned on previous page).
That is, of course much better (and we have hundreds of millisecods available) !

So I leave my script, integrated into findnrun for the records only.

Code: Select all

.
.
.
LOC1="/usr/share/applications/"
LOC2="/usr/local/share/applications/"
LOC3="${XDG_DATA_HOME}/applications/"
#LOC4="${HOME}/.local/share/applications/"

CONFIG="${HOME}/.findnrunrc"

check_and_fix() {
 DIR=${1%/*}
 if [ -d ${DIR} ]; then
  mv -f ${DIR} ${DIR}_ || exit 0
  mkdir -p ${DIR}
  cd ${DIR}_
  for f in `ls *.desktop`; do
   sed q $f > ${DIR}/${f} # first line: [Desktop Entry]
   sort $f | grep -v '^\[' >> ${DIR}/${f}
  done
  cd - >/dev/null
  rm -rf ${DIR}_
 fi 
}

case $1 in -c) 
 Xdialog --msgbox "Check and fix sort order of translations ..." 0 0 &
 cPID=$!
 for LOC in $LOC1 $LOC2 $LOC3 ; do check_and_fix $LOC; done
 kill $cPID
 exit 
esac
launched by right click via AppInfo.xml

Code: Select all

  <AppMenu>
    <Item option="-c" icon="gtk-find">
      <Label>Check and fix order of translation</Label>
      <Label xml:lang="de">Reihenfolge der Übersetzungen prüfen und reparieren</Label>
    </Item>
Greetings
Last edited by L18L on Thu 09 Apr 2015, 13:48, edited 1 time in total.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#62 Post by SFR »

Oh yes, I have found lots of them, too, in Polish langpack for Slacko.
Ok, so updated to v1.5.

Thanks &
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

v1.5

#63 Post by L18L »

Sorry, Name[lang] has to overwrite (or override) Name. :wink:
Attachments
findnrun-1.5_bug.png
(16.06 KiB) Downloaded 455 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#64 Post by SFR »

Hmm, it's fine down here. Don't you have, by accident, a second abiword.desktop file without 'Name[de]=' field (only 'Name=')?

Greetings!
Attachments
Screenshot.jpg
(77.63 KiB) Downloaded 432 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Find'N'Run v1.5

#65 Post by L18L »

SFR wrote:Don't you have, by accident, a second abiword.desktop file without 'Name[de]=' field (only 'Name=')?
Not by accident, but I have forgot why I did it:
/root/.local/share/applications wrote:Name=AbiWord
Name[de]=AbiWord
Name[es]=Procesador de textos Abiword
Name[fi]=AbiWord
Name[fr]=Traitement de texte AbiWord
Or did I do it to test LOC3? (greetings from Alzheimer)

BTW, all lines Name[lang] which have the same value as Name should be deleted. Always!
There must be a script for this....

Back to the actual problem
I do have 2 different Name[de] for abiword.desktop
1 in /usr/share/applications
1 in $HOME/.local/share/applications

or one in LOC1 and another in LOC3.

A solution could be
Give LOC3 precedence over LOC2 over LOC1
Just to not confuse nobody. :?:
No, it makes sense in a multi user system! :idea:

Maybe my false alert can be good for something else.
Greetings

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Find'N'Run v1.5

#66 Post by L18L »

L18L wrote:BTW, all lines Name[lang] which have the same value as Name should be deleted. Always!
There must be a script for this....
Found it.
Let us call it desktop_files_lang_fix.sh
and launch it from something like:

Code: Select all

for LOC in $LOC1 $LOC2 $LOC3 ; do desktop_files_lang_fix.sh $LOC; done 

Code: Select all

#!/bin/sh
#
# .desktp files (and .directory files) sometimes have a really very 
#         strange use of language code.
# de_DE prevents (de_AT, de_BE, de_LU and de_CH) 
#       Austrian Belgian Luxemburg and Switzerland from being used.
# similiar for other languages...it_CH...fr_BE
#

#
# fix *.desktop for each ITEM in Name GenericName Comment 
#  rename Name[de_DE] to    Name[de] if not existant
#  delete Name[es_VE] if Name[es] has identical value
#  delete Name[de] if value equals Name (if not [..@latin], Chinese,...)
#      

die() { [ "$DISPLAY" ] && xmessage "$1" || echo $1 ; exit 1; }  
WD=/tmp/$0 ; mkdir -p $WD # temp dir

#IN=/usr/share/razor/razor-panel/clock.desktop # was 1st test file
IN=$1
EXT="${IN##*.}"
[ "${EXT}" = "desktop" -o "${EXT}" = "directory" ] || die "${IN} neither .desktop nor .directory file"
[ -f "${IN}" ] || die "file $1 not found."
[ -r "${IN}" ] || die "file $1 not readable."
[ -w "${IN}" ] || die "file $1 not writeable."
echo $IN  #log
for identifier in Name GenericName Comment ; do
  # store English Name GenericName Comment ex: 'Date & time' in file 'Name'
  aVALUE="`grep -m 1 "^${identifier}=" $IN | cut -d'=' -f2-`"
  [ "$aVALUE" ] && echo "$aVALUE" > ${WD}/"`grep -m 1 "^${identifier}=" $IN | cut -d'=' -f1`"
done
cd ${WD};for f in *;do echo -n ${f}=;cat $f;done;cd - >/dev/null #log

DOIT()
{
  identifier=$1 # ex: Name
  lang_loc=${NAME%%]*};lang_loc=${lang_loc##*[} #ex:de_DE
  case $lang_loc in
    *@*) continue ;;
    zh*) continue ;;
  esac
  #sed needs this:
  LINE="${LINE//[/\[}"
  LINE="${LINE//]/\]}"
  #del LINE if value identic with unlocalized VALUE
  [ "$VALUE" = "`cat ${WD}/${identifier}`" ] && sed -i "/${LINE}/d" $IN  
  #  
  lang=${lang_loc%%_*} #ex:de
  loc=${lang_loc##*_}  #ex:DE
  [ "$loc" = "$lang" ] && loc=
  if [ "$loc" ] ; then
    COMP="`grep "^${identifier}\[${lang}\]" $IN | cut -d'=' -f1-`"
    if [ "$COMP" ]; then
      sed -i "/${LINE}/d" $IN
      echo deleted ${identifier}[${lang}_${loc}] because value identic with ${identifier}[$lang]
    else
      changedLINE=${LINE//_$loc/}
      # append all changes for better manul checking
      sed -i "/${LINE}/d" $IN
      grep "${changedLINE}" $IN || echo "${changedLINE//\\/}" >> $IN 
      echo ${identifier}[${lang}_${loc}] renamed to ${identifier}[${lang}] as ${identifier}[${lang}] not existant
    fi   
  fi
}

for repeat in 0 1; do
  #for identifier in Comment Name Comment Name ; do # repeat needed for delete
  for identifier in `cd ${WD};ls;cd - >/dev/null`; do # repeat needed for delete
    while read LINE; do
      NAME=${LINE%%=*}
      VALUE=${LINE##*=}
      case $NAME in
        ${identifier}\[*) 
          DOIT ${identifier}
          ;;
      esac
    done < $IN
  done
  [ $repeat -eq 0 ] && echo check again # log
done
echo checked # log
rm -r $WD
exit 0

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Find'N'Run v1.5

#67 Post by L18L »

L18L wrote:I do have 2 different Name[de] for abiword.desktop
1 in /usr/share/applications
1 in $HOME/.local/share/applications

or one in LOC1 and another in LOC3.

A solution could be
Give LOC3 precedence over LOC2 over LOC1
Just to not confuse nobody. :?:
No, it makes sense in a multi user system! :idea:
Thus I have edited my /root/.local/share/applications/abiword.desktop for this test only.

Code: Select all

Name[de]=AbiWord in local
and changed version 1.6 of the code (just 1 line) to:

Code: Select all

      <input>grep -H -R -E "^Name(\['${LR}'\]|\['${L}'\])?=" '${LOC3}' '${LOC2}' '${LOC1}' --include="*.desktop" 2>/dev/null | sort -t: -k2.1,2.9  -u | sort -t= -k1,1 -d -r | sort -t: -u -k1,1 | cut -f2- -d "=" | sort -f -u | grep -F -i -- "$varENTRY"</input>
Note1, The changed sequence of LOC3 LOC2 LOC1 gave precedence to LOC3
Note2, sort -t: -k2.1,2.9 -u picked just one Name[de]= or Name[de_D (a dirty hack :lol: )

See result in screenshot.


---
EDIT
Why are there Touchpad and Flashplayer now :?:
Attachments
findnrun_local_applications_abiword.desktop.png
(27.42 KiB) Downloaded 357 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#68 Post by SFR »

Hey L18L

Well, I think changing the order of LOCations would be enough, i.e. if there are two .desktop files with the same 'Name' fields, only the one from $HOME/.local... will be picked up.
But if those files would have different 'Name' fileds, why should we pick only one of them?
Why are there Touchpad and Flashplayer now :?:
Because sort -t: -k2.1,2.9 -u somehow excludes almost all lines with [lang], so the defaults in English popped up instead.

Ok, LOCs re-ordered in v1.6.

Thanks &
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Find'N'Run v1.6

#69 Post by L18L »

SFR wrote:Hey L18L

Well, I think changing the order of LOCations would be enough, i.e. if there are two .desktop files with the same 'Name' fields, only the one from $HOME/.local... will be picked up.
But if those files would have different 'Name' fileds, why should we pick only one of them?
Makes only sense if they are different.
Each USER can use another content of Name[lang] stored in their $HOME/.local/.....
Why are there Touchpad and Flashplayer now :?:
Because sort -t: -k2.1,2.9 -u somehow excludes almost all lines with [lang], so the defaults in English popped up instead.
Ah yes, yes are right; and the translations did not start with "A".
Ok, LOCs re-ordered in v1.6.
Hope that helps. :D

Thanks &
Greetings!

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#70 Post by SFR »

Update - version 1.7:

I tried a bit different approach for searching/filtering.
Now the actual path to appropriate .desktop file goes to column 0 (which is invisible; names are in column 1), so it's no longer possible to pick up wrong exec.
Duplicates are also allowed, so if you have two different apps installed (e.g. ROX-Term and LXTerm) that share the same 'Name' field (e.g. Name=Terminal), both will be displayed.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

unexport variables

#71 Post by step »

Enhancement request: unexport all (4) exported variables before launching the target program.
Test in Fatdog64: Find urxvt terminal and run. Type "set" in the command line and see the variables that find'n'run leaves exported.
Thanks, great script!
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#72 Post by SFR »

Thanks Step, fixed in v1.8.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#73 Post by SFR »

Version 1.9 - fixed a typo: "opened" -> "open" (thanks to step).

First post updated!

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#74 Post by SFR »

Version 1.10.5 - huge rewrite by step

See first post for details.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

call for translators

#75 Post by step »

I would like to enthusiastically draw translators' attention to the .pot file on github http://github.com/step-/find-n-run

usr/share/doc/nls/findnrun/findnrun.pot

awaiting for your translator's pen. Thanks in advance for sending in your .po file, preferably as a github pull request, or otherwise as an attachment to this thread. I will file your contributed .po's in the project repository on github.

edit: 2015-07-15 update file path
Last edited by step on Wed 15 Jul 2015, 08:50, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: call for translators

#76 Post by L18L »

Code: Select all

# findnrun message catalog.
# Copyright (C) 2015, the authors
# This file is distributed under the same license as the find-n-run package.
# http://www.murga-linux.com/puppy/viewtopic.php?t=98330
# http://github.com/step-/find-n-run
#
msgid ""
msgstr ""
"Project-Id-Version: find-n-run 1.10.6\n"
"Report-Msgid-Bugs-To: https://github.com/step-/find-n-run/issues/\n"
"POT-Creation-Date: 2015-07-09 08:37+0000\n"
"PO-Revision-Date: 2015-07-11 11:57+0200\n"
"Last-Translator: <L18L@puppylinux.forum>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. i18n find_n_run.po file generated with:
#. i18n xgettext -ci18n -L Shell -o findnrun.pot --no-wrap --package-name=find-n-run --package-version=1.10.6 --msgid-bugs-address=https://github.com/step-/find-n-run/issues/ findnrun
#. i18n Main window title
#: findnrun:19
msgid "Find'N'Run"
msgstr ""

#. i18n About dialog widgets: window text; number of apps text (singular/plural)
#: findnrun:311
msgid ""
"%s %s\n"
"authors: SFR, L18L, step\n"
"Open source - GNU GPL license applies\n"
"\n"
"%s\n"
"%s\n"
"\n"
"configuration: %s\n"
msgstr ""
"%s %s\n"
"Autoren: SFR, L18L, step\n"
"Open source - GNU GPL license applies\n"
"\n"
"%s\n"
"%s\n"
"\n"
"Konfiguration: %s\n"

#: findnrun:322
msgid "%s application found"
msgid_plural "%s applications found"
msgstr[0] "%s Anwendung gefunden"
msgstr[1] "%s Anwendungen gefunden"

#. i18n Main window widgets: entry tooltip; entry default; icon tooltip; list tooltip; pull-down tooltip; pull-down default; pull-down icon tooltip; entry tooltip; {checkbox tooltip; checkbox label}repeat(3); {button icon tooltip}repeat(2)
#. i18n "0" (invisible, disregard).
#: findnrun:338
msgid "0"
msgstr ""

#: findnrun:343
msgid "Press ENTER to select"
msgstr "Enter-Taste selektiert"

#: findnrun:344
msgid "Type some letters to refine the list"
msgstr "Eingabe von ein paar Buchstaben verkleinert die Liste sofort"

#: findnrun:351
msgid "Clear entry"
msgstr "Eintrag löschen"

#: findnrun:358
msgid "Press ENTER or double-click to run the selected item"
msgstr "Enter-Taste oder Doppel-Klick startet selektierte Anwendung" 

#: findnrun:385
msgid ""
"Press the up-arrow key to grab the current command and move through the "
"command history. You can modify the command. You can enter any shell "
"command. History persists while the window is kept open. History is cleared "
"on exit."
msgstr ""
"Taste Pfeil-hoch übernimmt das Kommando zum Start der Anwendung und bewegt "
"durch die Kommando-Historie. Man kann das Kommando modifizieren. "
"Historie bleibt nur so lang erhalten wie das Fenster geöffnet ist."

#: findnrun:387
msgid "Press up-arrow key to grab command"
msgstr "Taste Pfeil-hoch übernimmt Kommando zum Start der Anwendung"

#: findnrun:399
msgid "Remove entry from command history"
msgstr "Eintrag aus Kommando-Historie entfernen"

#: findnrun:408
msgid "Comment about current item"
msgstr "Kommentar zu obiger Anwendung"

#: findnrun:414
msgid ""
"Keep this window open after starting an item instead of closing this window "
"each time a command starts. Keep the window open to use the command history "
"feature, or to avoid startup delays."
msgstr ""
"Dieses Fenster nach dem Start einer Anwendung offen lassen. "
"Dann bleibt die Historie der ausgeführten Kommandos erhalten und es "
"gibt keine Verzögerung beim Start."

#: findnrun:415
msgid "_Keep window"
msgstr "Fenster _lassen"

#: findnrun:420
msgid ""
"Display all available icons instead of displaying just the icons that do not "
"need to be cached. Caching all icons may take some time. Disabling this "
"option clears the existing cache."
msgstr ""
"Alle verfügbaren Symbole anzeigen anstatt nur derjenigen, die nicht "
"zwischengespeichert werden müssen. Speicherung benötigt etwas Zeit. "
"Deaktivierung dieser Option leert den existierenden Zwischenspeicher."

#: findnrun:421
msgid "_Show all icons"
msgstr "Alle _Symbole anzeigen"

#: findnrun:443
msgid ""
"Move the keyboard focus to the search input field after starting an item "
"instead of keeping the keyboard focus on the started list item. This option "
"also affects the command input field."
msgstr ""
"Den Fokus der Tastatur-Eingabe nach dem Start der Anwendung auf das "
"Eingabesuchfeld setzen. Diese Option betrifft auch das Kommandeingabefeld."

#: findnrun:444
msgid "_Focus search"
msgstr "_Fokus auf Suche"

#: findnrun:450
msgid "About"
msgstr "Über"

#: findnrun:454
msgid "Exit"
msgstr "Beenden"
FYI, If you are using momanager you should make sure that pot file exists: /usr/share/doc/nls/findnrun/findnrun.pot.

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

Re: call for translators

#77 Post by step »

L18L wrote: FYI, If you are using momanager you should make sure that pot file exists: /usr/share/doc/nls/findnrun/findnrun.pot.
OK, and such is its current location on github. Thank you very much for your contributed translation! I will upload it to github when 1.10.6 final releases (soon).
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#78 Post by SFR »

Version 1.10.6 has been released.

See here for details and downloads.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

uio
Posts: 76
Joined: Mon 31 Aug 2015, 18:01

Find'n'Run won't detect Firefox

#79 Post by uio »

Hi - great program laucher,
Unfortunately, it won't launch Firefox... or QuickPet for example. Is there a way to add these ?

I am running TahrPup 5.02 and installed the prompted services-pack when I opened PPM which included Find'n'Run. Interestingly, it includes version 1.0. I update to 1.9 via the posts on this thread, but encounter the same non-finding.

EDIT : I found the 1.10.6 version. Finds firefox :) and now it can't find PPM (1.9 had this issue too....).

Thanks,

uio

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

Re: Find'n'Run won't detect Firefox

#80 Post by SFR »

uio wrote:Hi - great program laucher,
Unfortunately, it won't launch Firefox... or QuickPet for example. Is there a way to add these ?

I am running TahrPup 5.02 and installed the prompted services-pack when I opened PPM which included Find'n'Run. Interestingly, it includes version 1.0. I update to 1.9 via the posts on this thread, but encounter the same non-finding.

EDIT : I found the 1.10.6 version. Finds firefox :) and now it can't find PPM (1.9 had this issue too....).

Thanks,

uio
Sorry, but I can't reproduce this.
v1.0 - finds and launches QuickPet
v1.9 - finds and launches PPM
v1.10.6 - ditto
(see screenshot)

Btw, was it Tahr 5.02 or perhaps 6.0.2?
I don't see 5.02 among these: http://ftp.nluug.nl/ibiblio/distributio ... -tahr/iso/

Greetings!
Attachments
fnr_tahr.png
(96.28 KiB) Downloaded 246 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Post Reply