I need the --unsupported-gpu flag on sway, but every update overwrites the session file. I could chattr it, but is there a better way?
Not using sway, but if you are not sure which package has the desktop file you can use command
pacman -Qo "</path/to/the/file>"
to find the owner package and then decide what to do (e.g. create a pacman hook that adds the flag).
Sway owns the file:
[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=sway --unsupported-gpu ## <<< This line here
Type=Application
DesktopNames=sway;wlroots
Maybe write a script to add the flag to the file? For example something like
sed -i "<desktop-file-name>" -e 's|^Exec=sway|Exec=sway --unsupported-gpu|'
Or you could simply copy the desktop file to ~/.local/share/applications and make the change there.
A better way would be to create a custom desktop file and modify it however you like, then in the greeter when you choose your session just pick your custom one.
You can copy the existing sway.desktop file as a starting point if you like, just be sure to change the Name value (so it shows up as a different session in your greeter), and then obviously the Exec line to add the --unsupported-gpu flag.
For example:
/usr/share/wayland-sessions/sway-nvidia.desktop
[Desktop Entry]
Name=Sway-Nvidia
Comment=Sway with Nvidia
Exec=sway --unsupported-gpu
Type=Application
If you install with the script in the Community repo, this gets set up for you during the installation by the way. https://github.com/EndeavourOS-Community-Editions/sway/blob/main/setup_sway_isomode.bash#L8-L28
It is not a standard desktop file, it is the “session” file (in /usr/share/wayland-sessions/), script wouldn’t work as it would need sudo, hook might work, will give it a go later.
@BluishHumility - so simple! Never thought of it like that, I went down the wrong rabbit hole. (apologies, I wrote this and it got busy, forgot to send!).
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.