linux-app icon indicating copy to clipboard operation
linux-app copied to clipboard

How to start ProtonVPN minimized on tray on startup?

Open ariyadey opened this issue 3 years ago • 8 comments

We are happy to answer your questions about the code or discuss technical ideas.

Please complete the following checklist (by adding [x]):

  • [ x] I have searched open and closed issues for duplicates
  • [ x] This isn't a feature request
  • [ x] This is not a report about my app not working as expected

I'm searching for a graphical or command-line solution to start ProtonVPN on startup but minimized on the tray. It doesn't need to connect to VPN, but I just want it to start and show the tray icon on startup. How is it possible?

ariyadey avatar Dec 31 '21 12:12 ariyadey

Here are some alternatives: https://github.com/ProtonVPN/linux-app/issues/4. Linux app autostart to tray is obviously planned. But a solution is to use linux-cli to start ProtonVPN automatically. I can't get the systemd alternative to work. But it also includes the graphical Linux app.

My best solution, using Ubuntu 20.04, are to start it in ~/.config/autostart and my script including:

#!/bin/bash

sleep 20

# Kill switch
protonvpn-cli ks --off
protonvpn-cli ks --on

# Netshield
protonvpn-cli ns --off
protonvpn-cli ns --malware

# Start VPN
protonvpn-cli c -f

Regards

pehlm avatar Dec 31 '21 17:12 pehlm

Here are some alternatives: #4. Linux app autostart to tray is obviously planned. But a solution is to use linux-cli to start ProtonVPN automatically. I can't get the systemd alternative to work. But it also includes the graphical Linux app.

My best solution, using Ubuntu 20.04, are to start it in ~/.config/autostart and my script including:

#!/bin/bash

sleep 20

# Kill switch
protonvpn-cli ks --off
protonvpn-cli ks --on

# Netshield
protonvpn-cli ns --off
protonvpn-cli ns --malware

# Start VPN
protonvpn-cli c -f

Regards

Would the appropriate way to implement this script be to save it as a .desktop file in one's autostart folder?

asorel1942 avatar Feb 17 '22 05:02 asorel1942

Yes, as I said above "start it in ~/.config/autostart".

pehlm avatar Feb 18 '22 20:02 pehlm

Would the appropriate way to implement this script be to save it as a .desktop file in one's autostart folder?

I don't think that will work. Saving it as an executable script may work in some DE, but that may change in future. Regardless, it is better to do it "properly".

Save it in a file somewhere (in ~/.local/bin/?) and make it executable (chmod 755 <file>), and use that file's path in Exec in a .desktop file in ~/.config/autostart. Refer to other .desktop file in that directory for details and also read the spec [1].

[1] https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html


Yes, as I said above "start it in ~/.config/autostart".

Just curious: Which DE do you use? Does it run executable scripts in ~/.config/autostart? Mine (XFCE) doesn't.

MuhammedZakir avatar Feb 19 '22 06:02 MuhammedZakir

Save it in a file somewhere (in ~/.local/bin/?) and make it executable (chmod 755 ), and use that file's path in Exec in a .desktop file in ~/.config/autostart. Refer to other .desktop file in that directory for details and also read the spec [1].

That is exactly what I mean. I thought it was obvious that it should be done that way. My script is saved in ~/bin directory.

pehlm avatar Feb 19 '22 22:02 pehlm

no answer is related to the question

maravento avatar Oct 07 '22 21:10 maravento

for others, who might not find it "obvious" (:roll_eyes:), here's all the steps you need to start the CLI connection to in the background on login. (no idea how to do it with the GUI minimized to tray though)

  1. create a script that will set up the connection and put it e.g. in ~/.local/bin/protonvpn-cli.sh`, and paste the following content:
#!/bin/bash

sleep 20

# Kill switch
protonvpn-cli ks --off
protonvpn-cli ks --on

# Netshield
protonvpn-cli ns --off
# or --malware if you don't want to block ads
protonvpn-cli ns --ads-malware

# Start VPN
protonvpn-cli c -f
  1. chmod 755 protonvpn.sh — make it executable
  2. create a desktop startup entry in ~/.config/autostart/protonvpn-cli.desktop:
[Desktop Entry]
Type=Application
Exec=~/.local/bin/protonvpn-cli.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_GB]=proton VPN CLI
Name=proton VPN CLI
Comment[en_GB]=
Comment=

szamanr avatar Oct 09 '22 05:10 szamanr

for others, who might not find it "obvious" (roll_eyes), here's all the steps you need to start the CLI connection to in the background on login. (no idea how to do it with the GUI minimized to tray though)

  1. create a script that will set up the connection and put it e.g. in ~/.local/bin/protonvpn-cli.sh`, and paste the following content:
#!/bin/bash

sleep 20

# Kill switch
protonvpn-cli ks --off
protonvpn-cli ks --on

# Netshield
protonvpn-cli ns --off
# or --malware if you don't want to block ads
protonvpn-cli ns --ads-malware

# Start VPN
protonvpn-cli c -f
  1. chmod 755 protonvpn.sh — make it executable
  2. create a desktop startup entry in ~/.config/autostart/protonvpn-cli.desktop:
[Desktop Entry]
Type=Application
Exec=~/.local/bin/protonvpn-cli.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_GB]=proton VPN CLI
Name=proton VPN CLI
Comment[en_GB]=
Comment=

The question is not about "how to use CLI" or "how to create a Desktop file" on Linux. The question is about "start ProtonVPN minimized on tray on startup (GUI)" If @ariyadey accepts a different answer, then @ariyadey should change the question.

maravento avatar Oct 09 '22 11:10 maravento