0

As you know, many application have a generic name.

For example, the generic name of Audacious is: Music Player.

How do you get Lubuntu to use this name instead of the regular name.

I realize that a lot of the applications have the same name and generic name, but that is okay.

Note: I am talking about the lxpanel menu.

1 Answers1

1

Are you talking about in a program menu (lxmenu), or shortcuts on a desktop or panel bar? For those you should be able to add new shortcuts with the generic name (or any name) you'd like. Or a "personal" section with just the apps you commonly used, named however you'd prefer (that's what I'd do).

But, since you clarified that "I would like to change all the names to the generic names at once, not do them individually ... Each application has a generic name built-in to its .desktop file" here's an answer to "how to do that."

This uses some command line tools like grep & sed to search for the "Name=..." part and replace it with the "GernericName=..." part.

NOTE:

  • You should use a local copy of the .desktop files by placing them in your ~/.local/share/applications/ first, with

    cp -R --no-clobber -v /usr/share/applications/ ~/.local/share > ~/cp-applications.log

    (this may add more files than you want or need, but it writes a "log" to ~/cp-applications.log of what's been copied to where in case you want to undo it later) but leaving the original's alone, and not overwriting any local files already there. I'm also using sed's -i option to make a backup copy of the files too named *.BAK. And .

  • If you ever want to go back to the original versions of the .desktop files, you can overwrite the .desktop file with it's .desktop.BAK copy, or with the original from /usr/share/applications/.
  • If there are other .desktop files you'd like to play with, you could search everywhere for them if you like with find / -type f -name "*.desktop" (piped to less, or a file perhaps) but that will return more than you want.
  • And if you want the language-specific generic name just edit to hit that one (for example "GenericName[en_GB]=").

This only changes the first occurrence of "Name=" (so it leaves things like Firefox's "Open a New Window" as-is):

#!/bin/bash
targetdir=~/.local/share/applications/

for i in $(grep -l "^GenericName=" "$targetdir"/*.desktop)
do
    echo Hit on $i
    tmphit=$(sed -n 's/^GenericName=//p' "$i")
    echo Generic name is:"$tmphit"
    sed -iBAK "0,/^Name=/s/^Name=.*/Name=$tmphit/g" "$i" || echo "SED FAILED!!!!"
done

There's probably a way to do this with a one-liner in perl or even sed, awk, but "meh".

Feel free to remove the echo's too. And see these answers for more info:


Or if you want to run them from a terminal, just add some links to the real program, under whatever generic name you'd like. Find the program's location with which (often /usr/bin) and link with ln.

Xen2050
  • 8,705
  • I mean from the program menu. Also, I would like to change all the names to the generic names at once, not do them individually. – Christopher King Dec 23 '14 at 20:39
  • I don't think you can change them all at once, since each one has a different name to start with, and targets a different application... – Xen2050 Dec 23 '14 at 20:46
  • Each application has a generic name built-in to its .desktop file. Like here. – Christopher King Dec 23 '14 at 20:52
  • @DKBose that's the right track, but grep -L returns "files without match", lower case -l returns files with matches and does get things going – Xen2050 Dec 24 '14 at 09:47
  • True, looks like maybe 15% in /usr/share/applications/ have generic names... and those that do have 50 or so different names for different languages too... but I got a little script that should rename some stuff ok - no going back though :) – Xen2050 Dec 24 '14 at 11:20
  • A high percentage of questions on here don't get any answers, I'm sure the askers would be grateful for even the start of the "perfect answer." And if there are better answers from someone else, they'll get voted to the top, that's the StackExhange model right? – Xen2050 Dec 24 '14 at 12:49
  • @JacobVlijm Perhaps using the user-specific directory can help: sed ... $DESKTOP_FILE > ~/.local/share/applications/$DESKTOP_FILE. – muru Dec 24 '14 at 12:54
  • @JacobVlijm Oh, sorry, I didn't see that comment! – muru Dec 24 '14 at 12:58
  • 1
    d'oh! Think I got it...... sometimes it's not worth the effort of just posting an idea – Xen2050 Dec 24 '14 at 13:07
  • I removed a 1GB of text :) – Jacob Vlijm Dec 24 '14 at 13:10
  • I won't bother you any more, but you'd probably not want to copy all desktop files locally! just the ones to (potentially) edit. There are many .desktop files in there to built up your desktop for example. Copying them locally is a bad idea. Did that once, had to repair it with a live usb. – Jacob Vlijm Dec 24 '14 at 13:13
  • @JacobVlijm Double-d'oh. Thought of that with the cp command, I'll look for a "no-clobber" type option maybe... or I'll just paste your comment in there instead :) [maybe I'll delete some comments too...] Thanks for the help – Xen2050 Dec 24 '14 at 13:18