Replace root .desktop file with local .desktop file

Hello, my discord app is installed globally and it’s .desktop file is in the root directory, is there any way I could make a .desktop file in my local user’s directory? I want to test if this is the reason for which i cannot get prime-run discord working from the .desktop while it works when I run it in the terminal. I want to benefit from the discord hardware acceleration because I just had my discord eat up 30% of my processor.

Edit: Actually, the .desktop file is in my local user’s folder but it points to /opt/discord/discord.desktop, so kinda same thing but yeah.

Copy the original desktop file to ~/.local/share/applications and edit that.

1 Like

I want to make sure I understand this, so, whatever is in my local user’s applications/ will overwrite what’s in the root folder for my current user, right? I thought about this but I did not want to make a mistake, so I wanted to make sure first.

Thats how I do it for my modified firefox and thunderbird desktop files.
The users home .desktop should take precedence over the system file.
(as with things like ~/.profile vs /etc/profile)

Maybe if you share the content we could go about it another way and simply make an alias.

Or share any error output or whatever happens when prime-run is failing.

It just does not let me run sudo prime-run discord and the file was in the root directory, it now seems to work after I copied the .desktop file from /opt/discord/ to my .local/share/applications/ folder. Thank you for the help!

[5800:1102/012834.584739:FATAL:atom_main_delegate.cc(211)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
/usr/bin/prime-run: line 2:  5800 Trace/breakpoint trap   (core dumped) __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"

This is what it shows when I run it with sudo.

uhm … why do you want to use sudo ?
You should not be running sudo with/on a GUI application.

I only ran sudo to see if it’d fail in any way, and it did and threw the error above. I only wanted to make the application launcher icon run discord on the dedicated GPU, because I have a hybrid graphics laptop.
I only ran sudo prime-run discord in the terminal I never edited my file to do it like that, but I assumed that if the discord.desktop file was in the /opt/discord/discord.desktop it would somehow run or use the root user somehow cuz at the start I just nano-ed in the discord.desktop file and edited the Exec command to use prime-run and it was not working, but when I was using prime-run discord in the terminal it was working correctly, so I think it was somehow running as root or something. I really do not know.

Either way. You shouldnt be using sudo with discord at all.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.