Score:0

Cannot make a . desktop file works

es flag
Syl

I want to create a desktop shortcut to a sh script, wha I did make a terminal blink and launch nothing :

[Desktop Entry]
Type=Application
Terminal=true
Name=Stable diffusion
Exec=sh ~/AI/AUTOMATIC1111/stable-diffusion-webui/webui.sh

What is wrong ?

EDIT I managed to screenshot the terminal as it was closing : enter image description here

It seems the shortcut try to execute the script on the desktop, is there a way to tell it the context is the sh folder ?

Bonus question : Where is the doc for .desktop shortcuts ? How is it called ?

Terrance avatar
id flag
Add a line of `Version=1.0` right below the line of `[Desktop Entry]`. You might also need to change the `~/AI/AUTOMATIC1111/stable-diffusion-webui/webui.sh` to `/home/username/AI/AUTOMATIC1111/stable-diffusion-webui/webui.sh`. Also, if the `.sh` file can be run in the background, you usually don't need the `Terminal=true`. You can try making that `Terminal=false`
hr flag
`[[: not found` is likely because you are trying to run a **bash** script with **sh** - best practice is to make sure the script itself is executable and then let its shebang line determine the appropriate interpreter
Score:1
it flag
  1. Don't use bash syntax on the EXEC= line, replace "~/" with "$HOME/", or with the actual expanded value.
  2. Don't use sh, it's a link to /bin/dash, a less featureful shell. Change the first line of $HOME/AI/AUTOMATIC1111/stable-diffusion-webui/webui.sh to "#!/bin/bash" (or write a wrapper script), make it executable with chmod +x $HOME/AI/AUTOMATIC1111/stable-diffusion-webui/webui.sh, and use "EXEC=$HOME/AI/AUTOMATIC1111/stable-diffusion-webui/webui.sh
vanadium avatar
cn flag
I agree with 1, but 2 is essentially irrelevant. 1) There is no reason why a user should not be allowed to invoke /bin/sh (or /bin/dash). Of course, the script must be compliant to that more minimal shell, which is used by default on Ubuntu, Bash is used only in an interactive terminals. 2) starting a script using `sh` instead of making it executable is a perfectly valid approach.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.