LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I find the target of a desktop launcher? How do I edit an existing launcher? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-find-the-target-of-a-desktop-launcher-how-do-i-edit-an-existing-launcher-4175621557/)

tnandy 01-13-2018 11:02 AM

How do I find the target of a desktop launcher? How do I edit an existing launcher?
 
In Windows, all you have to do is right click on a menu or desktop shortcut and click properties. One of the resulting tabs tells you what directory and what program or batch file the shortcut supposed to run.

I have not found any way to see the target of linux launchers in either the applications menu or my desktop. Where do I look for the path and target of a launcher?

If it matters, I am using the mate desktop on devuan linux.

The next thing I want to do is make an existing launcher point to a shell script rather than a program. How do I edit a launcher?

[end question]
[begin rant]

The reason I'm asking this is I installed Neverwinter Nights using a pair of scripts named play-neverwinter-nights.sh and play-anything.sh that I found here:
https://wiki.dotslashplay.it/en/game...rwinter-nights

Running these scripts resulted in a launcher, Applications -> Games -> Neverwinter Nights. The thing is, there is a massive amount of user created downloadable content that goes with the pre-canned game, and I needed to know where the game was installed in order to add this content. As far as I can tell, the launcher gives no clue where the program (or whatever) it points to is installed. I had to decipher the install scripts to find where the game was installed. Fortunately, I was able to locate the directory where Neverwinter is installed.

The reason I want to edit the Neverwinter Nights launcher is I want to change the CD keys based upon the userid. I have multiple licenses for use in multiplayer mode. Each license corresponds to a set of CD keys. If I can change the CD keys based upon the userid that is logged on, that means whoever the user is, he or she gets presented with the proper avatar they created in the game independent of the computer where they are sitting. It would be fairly straightforward to write a shell script to switch out the CD keys file depending on the userid.

[rant over]

Thanks!

DavidMcCann 01-13-2018 11:20 AM

That's odd, because right-clicking works for me. The launcher file will be in the ~/Desktop folder. You'll probably find you can't edit one working from the file-manager, but you can from the terminal:
$ pluma Desktop/whatever.desktop
The menu uses .desktop files, which are probably in ~/.config/autostart or somewhere like that.

Shadow_7 01-13-2018 01:15 PM

right mouse -> properties

If it's in the desktop icons / taskbar / and such. In the menu it can depend on the distro. For debian based ones, menu / libremenu manages the menu items. Normally with menu entries in /usr/share/menu/. But depending on the environment it could be other places like a .menu file in /etc/xdg/menus/ (XFCE4?). YMMV

fatmac 01-13-2018 02:00 PM

Most games will be in the /usr/games directory. :)

tnandy 01-13-2018 03:25 PM

Quote:

Originally Posted by DavidMcCann (Post 5805985)
That's odd, because right-clicking works for me. The launcher file will be in the ~/Desktop folder. You'll probably find you can't edit one working from the file-manager, but you can from the terminal:
$ pluma Desktop/whatever.desktop
The menu uses .desktop files, which are probably in ~/.config/autostart or somewhere like that.

OK, when I right-click on either the launcher on the Desktop or the file in /home/TNAndy/Desktop, I do get a window named "Neverwinter Nights Properties". It contains the following on the "Basic" tab:
[The icon picture]
Name: Neverwinter Nights
Description: [blank]
Command: neverwinter-nights
Comment: [blank]

Type: desktop configuration file (application/x-desktop)
Size: 185 bytes (185 bytes)

Location: /home/TNAndy/Desktop
Volume: unknown

Accessed: Sat 13 Jan 2018 10:00:24 AM EST
Modified: Sat 13 Jan 2018 10:00:23 AM EST

There's an Emblems tab with a bunch of generic icons.
There's a Permissions tab that says I own it (read and write) and everyone else can only read it.
The Notes tab is blank.

What I glean from this is the launcher name is "Neverwinter Nights". The location of the launcher is /home/TNAndy/Desktop. The target command is "neverwinter-nights".

The specific problem is I don't know where, in the Linux directory tree, the command "neverwinter-nights" is located. I found the directory /usr/local/share/games/neverwinter-nights where all the game files are located, but not the shell script "neverwinter-nights" that appears to be the target of the launcher. Well, I assume "neverwinter-nights" is a shell script since the Linux executable is called nwmain .

When I tried to edit the launcher, there were no contents to the file--it was blank.
$ pluma /home/TNAndy/Desktop/"Neverwinter Nights"
There was nothing there.

By the way, for this discussion, I substituted "TNAndy" for my actual user name which obviously contains no capital letters.

ondoho 01-14-2018 04:17 AM

Quote:

Originally Posted by tnandy (Post 5806074)
The specific problem is I don't know where, in the Linux directory tree, the command "neverwinter-nights" is located.

Code:

which neverwinter-nights

DavidMcCann 01-14-2018 11:17 AM

Quote:

Originally Posted by tnandy (Post 5806074)
When I tried to edit the launcher, there were no contents to the file--it was blank.
$ pluma /home/TNAndy/Desktop/"Neverwinter Nights"
There was nothing there.

Do this to find the name of the desktop file, which is not going to be "Neverwinter Nights" and which will have the extension .desktop
$ ls /Desktop

tnandy 01-22-2018 08:57 PM

Quote:

Originally Posted by ondoho (Post 5806240)
Code:

which neverwinter-nights

Code:

$ which neverwinter-nights
/usr/local/games/neverwinter-nights

I assume those results give me the path to the object of the launcher.

THANK YOU, ondoho!

tnandy 01-22-2018 09:14 PM

Quote:

Originally Posted by DavidMcCann (Post 5806340)
Do this to find the name of the desktop file, which is not going to be "Neverwinter Nights" and which will have the extension .desktop
$ ls /Desktop

Code:

$ ls /Desktop
didn't work, but then I tried the following and found it.
Code:

$ ls ./Desktop
neverwinter-nights.desktop
$ pluma ./Desktop/neverwinter-nights.desktop

The contents of neverwinter-nights.desktop are:
Code:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Name=Neverwinter Nights
Name[fr]=Neverwinter Nights
Icon=neverwinter-nights
Exec=neverwinter-nights
Categories=Game

This is precisely what I was looking for! Now I have to figure out what all that stuff means, but at least I can mark this thread solved.

THANK YOU, DavidMcCann!

Shadow_7 01-23-2018 09:25 PM

$(which) includes the $PATH and the executable that it defaults to. The one that it finds "first". The one that will execute if you ONLY enter the executables name on the command line. There could be multiple versions of said executable, and changing the $PATH variable sequence can make it "default" to a different one. Not that there are, but if one user starts X and another launches that executable, there "could be" differences. Unlikely though. Except for dev types that might put $HOME/compiled/thing/ in $PATH before /usr/src/ and /usr/local/src/ while "testing" changes. Although these days a VM or filesystem with snapshots might be the path of least resistance. Except in work environments where a developer is just another "user" with "some" access to things like a compiler.


All times are GMT -5. The time now is 07:33 PM.