mullvad / mullvadvpn-app

The Mullvad VPN client app for desktop and mobile
https://mullvad.net/
GNU General Public License v3.0
4.96k stars 336 forks source link

Split tunneling in .desktop files not working #3420

Open SaladinAyyub opened 2 years ago

SaladinAyyub commented 2 years ago

As Split tunneling toggle for apps is not supported on Linux, I tried creating/editing .desktop files as suggested. However it is not working for some unknown reason.

Example - .desktop files uses Exec=/usr/bin/steam-runtime %U When we do mullvad-exclude /usr/bin/steam-runtime %U in terminal it works without any issue.

But when I edit the desktop file Exec=mullvad-exclude /usr/bin/steam-runtime %U it does not work.

I also tested this with librewolf and few other .desktop files.

Also mullvad GUI shows and launches all .desktop files without any issue what is the implementation in the GUI ?

faern commented 2 years ago

Maybe try using the absolute path to mullvad-exclude? Exec=/usr/bin/mullvad-exclude /usr/bin/steam-runtime %U.

raksooo commented 2 years ago

Which desktop file did you edit? Which distribution are you using? How did you try to launch the app?

I just tested this out with Firefox in Ubuntu by launching from the favorites bar. Turns out it uses the desktop file located at /var/lib/snapd/desktop/applications/firefox_firefox.desktop and needed a reboot for the changes to work.

Another solution is to edit ~/.local/share/applications/<application>.desktop or /usr/share/applications/<application>.desktop and open it with gtk-launch <application> and then add that one to your favorites.

Both /var/lib/snapd/desktop/applications/<application>.desktop and /usr/share/applications/<application>.desktop will probably be overridden when updating the application.

SaladinAyyub commented 2 years ago

@raksooo I tried this steam package on Arch Linux. And also I have created a custom .desktop file which Executes a .sh file. Both are fine if using mullvad gui. and using CLI. Maybe its something with gio launch or the way gnome handles it. I also tried looking at freedesktop guide https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html with no luck.

Here is the main part from the default .desktop file of Steam.

Exec=/usr/bin/steam-runtime %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;FileTransfer;Game;
MimeType=x-scheme-handler/steam;x-scheme-handler/steamlink;
Actions=Store;Community;Library;Servers;Screenshots;News;Settings;BigPicture;Friends;
PrefersNonDefaultGPU=true
X-KDE-RunOnDiscreteGpu=true
raksooo commented 2 years ago

@shuriken1812 It seems to work for me. I installed Arch Linux, Gnome and Steam and saved the desktop entry you provided as steam.desktop. I launched it with gio launch steam.desktop and it didn't allow me to create an account because I was using a VPN. I then prepended mullvad-exclude to the Exec-line and after launching it again it allowed me to create an account.

How do I check within steam if it's going trough the VPN or not?

SaladinAyyub commented 2 years ago

@raksooo To check, I pretty much do -

  1. check the remember login and login into the steam account. (make sure this step is no VPN)
  2. Exit steam by clicking steam on the top left exit.
  3. And when you reopen if it doesn't remember ur account it means your IP has changed (VPN).
  4. If it does remember your account and signs you straight in it means IP has not changed (No VPN.)

Can you check the default steam.desktop file ? it should be in the Desktop/ folder. Also in your comment is it a typo or you did mulvad-exclude with a single "l"

SaladinAyyub commented 2 years ago

Update : It worked after the latest update for Steam client, could be an upstream steam problem closing.

SaladinAyyub commented 2 years ago

The issue is that gio launch steam.desktop works but for some reason Steam's menu shortcut is not using mullvad exclude, And I verified that Desktop/steam.desktop is the only 1 .desktop file for Steam.

SaladinAyyub commented 2 years ago

Fixed it,

The correct .desktop file is in /usr/share/applications/steam.desktop Can we put this in documentation where we have given a steam example ? or override these in .local/share/applications. @raksooo

In my opinion telling people to override in .local/share/applications is better so they don't have to change things in root. Users should check for a shortcut in .local/share/applications if it doesn't exist they should check /usr/share/applications and override it.

This issue can be closed once this is considered.

raksooo commented 2 years ago

@shuriken1812 Great that you found a solution! Unfortunately I don't think we can include that specific instructions since the location of the installed desktop-entries might differ depending on distribution, package manager and launcher.

If there's no desktop-entry in ~/.local/share/applications they could copy the one in /usr/share/applications to ~/.local/share/applications and edit that one. The ones in ~/.local/share/applications should override the ones in /usr/share/applications, but there's probably different behavior in different launchers.

secretmango commented 1 year ago

Fixed it,

The correct .desktop file is in /usr/share/applications/steam.desktop Can we put this in documentation where we have given a steam example ? or override these in .local/share/applications. @raksooo

In my opinion telling people to override in .local/share/applications is better so they don't have to change things in root. Users should check for a shortcut in .local/share/applications if it doesn't exist they should check /usr/share/applications and override it.

This issue can be closed once this is considered.

actually I have the issue that many launchers in that dir are not shown in the Mullvad App Split tunneling GUI. pretty weird. For example custom entries for Appimages