(SOLVED) Making desktop icons for shell scripts (Xfce)

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
hoang649153
Level 1
Level 1
Posts: 2
Joined: Tue Apr 20, 2021 4:27 am

(SOLVED) Making desktop icons for shell scripts (Xfce)

Post by hoang649153 »

Hello,

I just downloaded this game which uses a shell script to start, and I wanted to make a desktop icon for it. Making a desktop launcher works fine, except that when I run it from the desktop the script doesn't get executed, I think because it contains stuff like

Code: Select all

./jre_linux/bin/java
I managed to get around it by editing the script itself and just cd to the directory I put the game in, but I was wondering if there's a way to do it without having to change the script file. Putting the cd command into the launcher itself doesn't seem to work.

Another way I managed to do it was create a simple script on the desktop that goes like

Code: Select all

cd /game; ./game.sh
but this way I can't change the desktop icon. I'm using Mint 20.1 Xfce.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: Making desktop icons for shell scripts (Xfce)

Post by rene »

If you on Xfce create a launcher you can set its working directory, i.e., it's "current directory", directly in the "Create Launcher" dialogue. If you set that to the directory from which ./jre_linux/bin/java is supposed to work then it should.
hoang649153
Level 1
Level 1
Posts: 2
Joined: Tue Apr 20, 2021 4:27 am

Re: (SOLVED) Making desktop icons for shell scripts (Xfce)

Post by hoang649153 »

Oh, it was right there, thank you!
Locked

Return to “Scripts & Bash”