Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux .desktop shortcut not working and showing syntax error #493

Open
twistquest opened this issue Nov 20, 2024 · 15 comments
Open

Linux .desktop shortcut not working and showing syntax error #493

twistquest opened this issue Nov 20, 2024 · 15 comments
Labels
untriaged No decision has been made by the developers.

Comments

@twistquest
Copy link

Did you install the Prerequisites?

Installed everything following the linux guide on the website, so presumably yes

Describe the Issue

Running ChimeraOS on ROG Ally (should be very similar to SteamOS)
After running the Setup-linux.exe through protontricks (installed onto P3P) the program installs normally and i get a success message. However when i run the .desktop file created by the installer (after right clicking and clicking run as program and double checking run as executable is checked) i get this error:

/home/gamer/Desktop/Reloaded-II - P3P.desktop: line 1: [Desktop: command not found
/home/gamer/Desktop/Reloaded-II - P3P.desktop: line 2: syntax error near unexpected token ' ('
/home/gamer/Desktop/Reloaded-II - P3P.desktop: line 2: `Name=Reloaded-II (P3P)

Changing the name to omit the parentheses does nothing but add more errors and also still prints the first error.

@twistquest twistquest added the untriaged No decision has been made by the developers. label Nov 20, 2024
@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

Can you send the .desktop file?
This is a bit unusual, I'm rather curious myself.

Does the command in the Exec field work when manually pasted into terminal?

@twistquest
Copy link
Author

The exec command works and launches R2 (with some visual artifacts but thats expected on linux ig)

The desktop file is as follows:

[Desktop Entry]
Name=Reloaded-II (P3P)
Exec=bash -ic 'protontricks-launch --appid 1809700 "/home/gamer/Desktop/Reloaded-II - P3P/Reloaded-II.exe"'
Type=Application
StartupNotify=true
Comment=Reloaded II installation for P3P
Path=/home/gamer/Desktop/Reloaded-II - P3P
Icon=/home/gamer/Desktop/Reloaded-II - P3P/Mods/reloaded.sharedlib.hooks/Preview.png
StartupWMClass=reloaded-ii.exe

@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

That technically should be valid. Strange.
Does gtk-launch Reloaded-II (P3P) work?

Alternatively, maybe it doesn't like the files due to line endings on your specific implementation of the .desktop launcher, see what happens if you open the file and re-save it with line endings as LF instead of CRLF. I suspect .NET inside Wine defaulted to CRLF.

@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

It also dawned on me I should only be using ", and that I can nest " in desktop files.
I should never use '. Although I read the .desktop spec before, I missed that.

Inner quotes in Exec need to be escaped with double backslash, for example:

"protontricks-launch --appid 1113000 \\"/home/sewer/Desktop/Reloaded-II - Persona 4 Golden/Reloaded-II.exe\\""

@twistquest
Copy link
Author

That technically should be valid. Strange. Does gtk-launch Reloaded-II (P3P) work?

Alternatively, maybe it doesn't like the files due to line endings on your specific implementation of the .desktop launcher, see what happens if you open the file and re-save it with line endings as LF instead of CRLF. I suspect .NET inside Wine defaulted to CRLF.

gtk-launch gives the same error as before,

bash: syntax error near unexpected token `('

As for the resaving with line endings, how should i go about that? I've never really dealt with linux formatting and the machine doesent have a lot of options for applications. Is there a specific method you'd reccomend?

@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

As for the resaving with line endings, how should i go about that?

It depends on your text editor.
In Visual Studio Code it's on the bottom right Image

It's usually some toggle between LF and CRLF. You want LF.

Edit: Chances are you might have sed available in your distro

sed -i 's/\r$//' "Reloaded-II (P3P).desktop"

Might work, just make sure to point filename at right file.

@twistquest
Copy link
Author

As for the resaving with line endings, how should i go about that?

It depends on your text editor.
In Visual Studio Code it's on the bottom right Image

It's usually some toggle between LF and CRLF. You want LF.

Edit: Chances are you might have sed available in your distro

sed -i 's/\r$//' "Reloaded-II (P3P).desktop"

Might work, just make sure to point filename at right file.

I used the command you posted and it doesn't look like anything changed. Still get the same errors. Another oddity i noted is that the name in the .desktop file (Reloaded-II (P3P)) is different from the actual filename (Reloaded-II - P3P.desktop). Idk if this is relevant at all tho

@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

Maybe the file wasn't set to executable by the Reloaded installer, due to permission issues or otherwise.
If you right click it in your file manager, can you set it to executable from the 'Properties' window?

i.e. 'Make this application executable', or similar.
Or if you know your terminal it's chmod +x.

I'm not really sure myself at this point.

@twistquest
Copy link
Author

Maybe the file wasn't set to executable by the Reloaded installer, due to permission issues or otherwise.
If you right click it in your file manager, can you set it to executable from the 'Properties' window?

i.e. 'Make this application executable', or similar.
Or if you know your terminal it's chmod +x.

I'm not really sure myself at this point.

I'm sure it's set to executable (has been ootb, also checked it before starting the issue). I'd send a screenshot but its difficult getting a screenshot over from a gaming handheld to any device with GitHub on it, sorry.

@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

#!/usr/bin/env xdg-open

You could also try running with xdg-open by adding this as the first line of the shortcut, I'm really out of ideas myself.

@twistquest
Copy link
Author

#!/usr/bin/env xdg-open

You could also try running with xdg-open by adding this as the first line of the shortcut, I'm really out of ideas myself.

It's fine, i got it working through the exec command in the .desktop file and then using the injector tool in the modloader to launch together with P3P, so i'm good. This is probably just some weird edge case 🤷‍♀️

@twistquest
Copy link
Author

Tysm for the help though, i didn't even think of running the exec command for some reason lol

@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

No worries.

It is still important to know why it happens, at the very least, in a future build I can make it pass desktop-file-validate, I didn't know that was a tool till today. [Example fix here](<#493 (comment))

@twistquest
Copy link
Author

No worries.

It is still important to know why it happens, at the very least, in a future build I can make it pass desktop-file-validate, I didn't know that was a tool till today.

Ofc, if there's any command i can run to help you find the reason just hmu and i'll do it once i wake up tomorrow. Rn im going to bed since i got it sorted enough. Tysm again for the help

@Sewer56
Copy link
Member

Sewer56 commented Nov 20, 2024

Have a good nap 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged No decision has been made by the developers.
Projects
None yet
Development

No branches or pull requests

2 participants