summaryrefslogtreecommitdiff
path: root/python-protonvpn-linux-gui-calexandru2018.spec
blob: 357753f96ca735028c824f30d0d3823efe66b4ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
%global _empty_manifest_terminate_build 0
Name:		python-protonvpn-linux-gui-calexandru2018
Version:	2.0.7
Release:	1
Summary:	Unofficial Linux GUI client for ProtonVPN
License:	GPLv3
URL:		https://github.com/calexandru2018/protonvpn-linux-gui
Source0:	https://mirrors.aliyun.com/pypi/web/packages/94/21/839c71c291c80220efd1520a1b8ca5ecec786b70f07f817653bd71000d52/protonvpn-linux-gui-calexandru2018-2.0.7.tar.gz
BuildArch:	noarch

Requires:	python3-protonvpn-cli
Requires:	python3-requests
Requires:	python3-configparser

%description

<h1 align="center">ProtonVPN Linux GUI</h1>
<p align="center">
  <img src="https://i.imgur.com/rjMuf7p.png" alt="Logo"></img>
</p>

<p align="center">
  <a href="https://github.com/calexandru2018/protonvpn-linux-gui/releases/latest">
      <img alt="Build Status" src="https://img.shields.io/github/release/calexandru2018/protonvpn-linux-gui.svg?style=flat" />
  </a>
  <a href="https://pepy.tech/project/protonvpn-linux-gui-calexandru2018">
    <img alt="Downloads" src="https://pepy.tech/badge/protonvpn-linux-gui-calexandru2018">
  </a>   
    <a href="https://pepy.tech/project/protonvpn-linux-gui-calexandru2018/week">
      <img alt="Downloads per Week" src="https://pepy.tech/badge/protonvpn-linux-gui-calexandru2018/week">
    </a>
</p>
<p align="center">
  <a href="https://liberapay.com/calexandru2018/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
</p>
<p align="center">
  <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/protonvpn-linux-gui-calexandru2018?color=Yellow&label=python&logo=Python&logoColor=Yellow">
</p>
<p align="center">
  <a href="https://www.codefactor.io/repository/github/calexandru2018/protonvpn-linux-gui">
    <img src="https://www.codefactor.io/repository/github/calexandru2018/protonvpn-linux-gui/badge" alt="CodeFactor" />
  </a>
  <a href="https://github.com/calexandru2018/protonvpn-linux-gui/blob/master/LICENSE">
    <img src="https://img.shields.io/pypi/l/protonvpn-linux-gui-calexandru2018?style=flat" alt="License"></img>
  </a>
</p>
<p align="center">
    <a href="https://actions-badge.atrox.dev/calexandru2018/protonvpn-linux-gui/goto?ref=master">
        <img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/workflow/status/calexandru2018/protonvpn-linux-gui/master flake8/master?label=master%20flake8">
    </a>
    <a href="https://actions-badge.atrox.dev/calexandru2018/protonvpn-linux-gui/goto?ref=testing">
      <img alt="GitHub Workflow Status (Testing)" src="https://img.shields.io/github/workflow/status/calexandru2018/protonvpn-linux-gui/testing flake8/testing?label=testing%20flake8">
    </a> 
</p>


<h3 align="center">An <b>unofficial</b> Linux GUI for ProtonVPN, written in Python. Layout designed in Glade.</h3>

Protonvpn-linux-gui works on top of <a href="https://github.com/ProtonVPN/protonvpn-cli-ng"><b>protonvpn-cli-ng</b></a>, making it a dependency. All local configurations are managed by the GUI (such as updating protocol, split tunneling, manage killswitch) while the connections are managed by the CLI. This way, you will be able to use the latest version of the CLI, while also being able to use the GUI.

## Table of Contents
- [Installing and Updating](#installing-and-updating)
  - [Dependencies](#dependencies)
    - [Python dependencies](#python-dependencies)
    - [ProtonVPN GUI dependencies](#protonvpn-gui-dependencies)
      - [Known Issues](#gui-known-issues)   
        - [Wayland](#wayland)  
    - [ProtonVPN Tray dependencies](#protonvpn-tray-dependencies)
      - [Known Issues](#tray-known-issues)
        - [dbus-launch](#dbus-launch)
  - [Installing protonvpn-linux-gui](#installing-protonvpn-linux-gui)
    - [Distribution based](#distribution-based)
    - [PIP based](#pip-based)
      - [How to Update](#to-update-to-a-new-version) 
  - [Manual installation](#manual-installation)
  - [Virtual environment](#virtual-environment)
- [How to use](#how-to-use)
   - [ProtonVPN GUI](#protonvpn-gui)
   - [ProtonVPN Tray](#protonvpn-tray)
- [Enhancements](#enhancements)
  - [Create .desktop file](#create-desktop-file)
    - [ProtonVPN GUI](#protonvpn-gui-1)
    - [ProtonVPN Tray](#protonvpn-tray-1)
  - [Visudo/Sudoless](#visudosudoless)
- [Not yet implemented](#not-yet-implemented)
- [GUI Layout](#gui-layout)

# Installing and Updating

### Dependencies

#### Python dependencies
- python >= 3.5
- requests >= 2.23.0
- configparse >= 4.0.2
- pip for python3 (pip3)
- <a href="https://github.com/ProtonVPN/protonvpn-cli-ng"><b>protonvpn-cli-ng</b></a> >= 2.2.2
- setuptools for python3 (python3-setuptools)


#### ProtonVPN GUI dependencies

| **Distro**                              | **Command**                                                                                                     |
|:----------------------------------------|:----------------------------------------------------------------------------------------------------------------|
|Fedora/CentOS/RHEL                       | `sudo dnf install -y python3-gobject gtk3`                                                                      |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0`                                                |
|OpenSUSE/SLES                            | `sudo zypper install python3-gobject python3-gobject-Gdk typelib-1_0-Gtk-3_0 libgtk-3-0`                        |
|Arch Linux/Manjaro                       | `sudo pacman -S python-gobject gtk3`                                                                            |

### GUI Known issues:

#### Wayland
While this works well on X11, there are certain restrictions on Wayland since it does not allow GUIs to be launched as root. The way the GUI works at the moment is that it accesses much of the content that the CLI protects with sudo, thus starting with sudo lowers the UX friction, though this is subject to change. More info [here](https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root#Using_xhost) and [here](https://beamtic.com/sudo-and-guis).

Workaround is provied:
1. Install `xhost` or `x11-xserver-utils`
2. Type in terminal `xhost si:localuser:root`
3. Type in terminal `sudo protonvpn-gui`



#### ProtonVPN Tray dependencies

| **Distro**                              | **Command**                                                                                                     |
|:----------------------------------------|:----------------------------------------------------------------------------------------------------------------|
|Fedora/CentOS/RHEL                       | `sudo dnf install -y libappindicator-gtk3`                                                                      |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y gir1.2-appindicator3`                                                                       |
|OpenSUSE/SLES                            | `sudo zypper install libappindicator-gtk3`                                                                      |
|Arch Linux/Manjaro                       | `sudo pacman -S libappindicator-gtk3`                                                                           |

**NOTE:**
Gnome users will to install and additional extension for this to work: <a href="https://extensions.gnome.org/extension/615/appindicator-support/"> KStatusNotifierItem/AppIndicator Support</a>

### Tray Known issues:
#### dbus-launch
There is a known issue when user attempts to start the systray/appindicator. This might throw an error that is simillar to this one: `(<app-name>:<pid>) LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory)` if a user does not have a specific package installed. If you are unable to use the systray/appindicator and have a simillar error then a solution is provided below.

**Solution:**
Install `dbus-x11` package for your distribution, more information can be found on this <a href="https://askubuntu.com/questions/1005623/libdbusmenu-glib-warning-unable-to-get-session-bus-failed-to-execute-child">stackoverflow</a> post.

## Installing ProtonVPN Linux GUI

### Distribution based
- Fedora/CentOS/RHEL: To-do
- Ubuntu derivatives: To-do
- OpenSUSE/SLES: To-do
- Arch Linux/Manjaro: <a href="https://aur.archlinux.org/packages/protonvpn-linux-gui/" target="_blank">Available at AUR</a>


### PIP based

*Note: Make sure to run pip with sudo*

`sudo pip3 install protonvpn-linux-gui-calexandru2018`

#### To update to a new version

`sudo pip3 install protonvpn-linux-gui-calexandru2018 --upgrade`

### Manual Installation

1. Clone this repository

    `git clone https://github.com/calexandru2018/protonvpn-linux-gui`

2. Step into the directory

   `cd protonvpn-linux-gui`

3. Install

    `sudo python3 setup.py install`

### Virtual environment

If you would like to run the the GUI within a virtual environment (for either development purpose or other), then you can easily do that with the help of <a href="https://pipenv.readthedocs.io/en/latest/">pipenv</a>. Make sure to install pipenv beforehand following the next steps.

1. `git clone https://github.com/calexandru2018/protonvpn-linux-gui` 
2. `cd protonvpn-linux-gui`
3. `pipenv install` installs the virtual environment and all necessary dependencies from `Pipfile`.
4. `pipenv shell` enters the virtual environment.
5. `sudo pip install -e .` installs the GUI in your virtual environment. 
6. `sudo protonvpn-gui` starts the GUI from within the virtual environment.

# How to use

### ProtonVPN GUI

 `sudo protonvpn-gui`

### ProtonVPN Tray

 `protonvpn-tray`

# Enhancements

### Create .desktop file

#### ProtonVPN GUI
To create at <i>desktop</i> launcher with a .desktop file, follow the instrucitons below.

1. Find the path to the package with `pip3 show protonvpn-linux-gui-calexandru2018`

   You should get something like `Location: /usr/local/lib/<YOUR_PYTHON_VERSION>/dist-packages` , this is where your Python packages reside. **Note:** Based on your distro, your `Location` path may not look exactly like this one, so make sure to use your own and `Location` path.

2. Based on previous information, the path to your icon should be `<PATH_DISPLAYED_IN_STEP_1>/protonvpn_linux_gui/resources/img/logo/protonvpn_logo.png`

3. Create a `protonvpn-gui.desktop` file in `.local/share/applications/`, and paste in the following code. Remember to change the **`Icon`** path to your own path.

    ```
    [Desktop Entry]
    Name=ProtonVPN GUI
    GenericName=Unofficial ProtonVPN GUI for Linux
    Exec=sudo protonvpn-gui
    Icon=<YOUR_ICON_PATH>
    Type=Application
    Terminal=False
    Categories=Utility;GUI;Network;VPN
    ```

#### ProtonVPN Tray
To create at <i>tray icon</i> launcher with a .desktop file, follow the instrucitons below.

1. Find the path to the package with `pip3 show protonvpn-linux-gui-calexandru2018`

   You should get something like `Location: /usr/local/lib/<YOUR_PYTHON_VERSION>/dist-packages` , this is where your Python packages reside. **Note:** Based on your distro, your `Location` path may not look exactly like this one, so make sure to use your own and `Location` path.

2. Based on previous information, the path to your icon should be `<PATH_DISPLAYED_IN_STEP_1>/protonvpn_linux_gui/resources/img/logo/protonvpn_logo.png`

3. Create a `protonvpn-tray.desktop` file in `.local/share/applications/`, and paste in the following code. Remember to change the **`Icon`** path to your own path.

    ```
    [Desktop Entry]
    Name=ProtonVPN GUI Tray
    GenericName=Unofficial ProtonVPN GUI Tray for Linux
    Exec=protonvpn-tray
    Icon=<YOUR_ICON_PATH>
    Type=Application
    Terminal=False
    Categories=Utility;GUI;Network;VPN
    ```

## Visudo/Sudoless
If you would like to launch the GUI without having to type in your sudo password everytime, then you could add the bin to `visudo`. This is extremly useful when you have a .desktop file, and all you want to do is click the launcher to have the GUI pop-up without being prompted for sudo password.

1. First you will need the path to the GUI. This can be found by typing `which protonvpn-gui`. You should get something like this: `/usr/bin/protonvpn-gui`. Save it since you will need it later. **Note:** As previously mentioned, the path may look different for you, based on your distro.
2. Identify your username by typing `whoami`. Save it (or memorize it). 
3. In another terminal, type in `sudo visudo`, and a window should pop-up, scroll to the very bottom of it.
4. Once you are at the botton, type: `<YOUR_USERNAME_FROM_STEP2> ALL = (root) NOPASSWD: <YOUR_PATH_FROM_STEP1>`
5. Exit and save! Have fun :)

# Not yet implemented:

- ~~Split Tunneling~~
- ~~Kill Switch~~
- ~~Filtering servers~~
- ~~Start on Boot~~ (only for systemd/systemctl based OS's)
- ~~Systray/AppIndicator~~

# GUI Layout
<p align="center">
  <img src="https://i.imgur.com/OlcYrwf.png" alt="Login"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/VOpTlMR.png" alt="Dashboard"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/BlVmFa9.png" alt="Profiles"></img>
</p>

<p align="center">
  <img src="https://i.imgur.com/S353btA.png" alt="General Settings"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/BWE9LDf.png" alt="Tray Settings"></img>
</p> 
<p align="center">
  <img src="https://i.imgur.com/md4ni6t.png" alt="Connection Settings"></img>
</p>  
<p align="center">
  <img src="https://i.imgur.com/KYMxSoe.png" alt="Advanced Settings"></img>
</p> 

<p align="center">
  <img src="https://i.imgur.com/vXMSQ8z.png" alt="Diagnosis Tool"></img>
</p> 





%package -n python3-protonvpn-linux-gui-calexandru2018
Summary:	Unofficial Linux GUI client for ProtonVPN
Provides:	python-protonvpn-linux-gui-calexandru2018
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-protonvpn-linux-gui-calexandru2018

<h1 align="center">ProtonVPN Linux GUI</h1>
<p align="center">
  <img src="https://i.imgur.com/rjMuf7p.png" alt="Logo"></img>
</p>

<p align="center">
  <a href="https://github.com/calexandru2018/protonvpn-linux-gui/releases/latest">
      <img alt="Build Status" src="https://img.shields.io/github/release/calexandru2018/protonvpn-linux-gui.svg?style=flat" />
  </a>
  <a href="https://pepy.tech/project/protonvpn-linux-gui-calexandru2018">
    <img alt="Downloads" src="https://pepy.tech/badge/protonvpn-linux-gui-calexandru2018">
  </a>   
    <a href="https://pepy.tech/project/protonvpn-linux-gui-calexandru2018/week">
      <img alt="Downloads per Week" src="https://pepy.tech/badge/protonvpn-linux-gui-calexandru2018/week">
    </a>
</p>
<p align="center">
  <a href="https://liberapay.com/calexandru2018/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
</p>
<p align="center">
  <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/protonvpn-linux-gui-calexandru2018?color=Yellow&label=python&logo=Python&logoColor=Yellow">
</p>
<p align="center">
  <a href="https://www.codefactor.io/repository/github/calexandru2018/protonvpn-linux-gui">
    <img src="https://www.codefactor.io/repository/github/calexandru2018/protonvpn-linux-gui/badge" alt="CodeFactor" />
  </a>
  <a href="https://github.com/calexandru2018/protonvpn-linux-gui/blob/master/LICENSE">
    <img src="https://img.shields.io/pypi/l/protonvpn-linux-gui-calexandru2018?style=flat" alt="License"></img>
  </a>
</p>
<p align="center">
    <a href="https://actions-badge.atrox.dev/calexandru2018/protonvpn-linux-gui/goto?ref=master">
        <img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/workflow/status/calexandru2018/protonvpn-linux-gui/master flake8/master?label=master%20flake8">
    </a>
    <a href="https://actions-badge.atrox.dev/calexandru2018/protonvpn-linux-gui/goto?ref=testing">
      <img alt="GitHub Workflow Status (Testing)" src="https://img.shields.io/github/workflow/status/calexandru2018/protonvpn-linux-gui/testing flake8/testing?label=testing%20flake8">
    </a> 
</p>


<h3 align="center">An <b>unofficial</b> Linux GUI for ProtonVPN, written in Python. Layout designed in Glade.</h3>

Protonvpn-linux-gui works on top of <a href="https://github.com/ProtonVPN/protonvpn-cli-ng"><b>protonvpn-cli-ng</b></a>, making it a dependency. All local configurations are managed by the GUI (such as updating protocol, split tunneling, manage killswitch) while the connections are managed by the CLI. This way, you will be able to use the latest version of the CLI, while also being able to use the GUI.

## Table of Contents
- [Installing and Updating](#installing-and-updating)
  - [Dependencies](#dependencies)
    - [Python dependencies](#python-dependencies)
    - [ProtonVPN GUI dependencies](#protonvpn-gui-dependencies)
      - [Known Issues](#gui-known-issues)   
        - [Wayland](#wayland)  
    - [ProtonVPN Tray dependencies](#protonvpn-tray-dependencies)
      - [Known Issues](#tray-known-issues)
        - [dbus-launch](#dbus-launch)
  - [Installing protonvpn-linux-gui](#installing-protonvpn-linux-gui)
    - [Distribution based](#distribution-based)
    - [PIP based](#pip-based)
      - [How to Update](#to-update-to-a-new-version) 
  - [Manual installation](#manual-installation)
  - [Virtual environment](#virtual-environment)
- [How to use](#how-to-use)
   - [ProtonVPN GUI](#protonvpn-gui)
   - [ProtonVPN Tray](#protonvpn-tray)
- [Enhancements](#enhancements)
  - [Create .desktop file](#create-desktop-file)
    - [ProtonVPN GUI](#protonvpn-gui-1)
    - [ProtonVPN Tray](#protonvpn-tray-1)
  - [Visudo/Sudoless](#visudosudoless)
- [Not yet implemented](#not-yet-implemented)
- [GUI Layout](#gui-layout)

# Installing and Updating

### Dependencies

#### Python dependencies
- python >= 3.5
- requests >= 2.23.0
- configparse >= 4.0.2
- pip for python3 (pip3)
- <a href="https://github.com/ProtonVPN/protonvpn-cli-ng"><b>protonvpn-cli-ng</b></a> >= 2.2.2
- setuptools for python3 (python3-setuptools)


#### ProtonVPN GUI dependencies

| **Distro**                              | **Command**                                                                                                     |
|:----------------------------------------|:----------------------------------------------------------------------------------------------------------------|
|Fedora/CentOS/RHEL                       | `sudo dnf install -y python3-gobject gtk3`                                                                      |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0`                                                |
|OpenSUSE/SLES                            | `sudo zypper install python3-gobject python3-gobject-Gdk typelib-1_0-Gtk-3_0 libgtk-3-0`                        |
|Arch Linux/Manjaro                       | `sudo pacman -S python-gobject gtk3`                                                                            |

### GUI Known issues:

#### Wayland
While this works well on X11, there are certain restrictions on Wayland since it does not allow GUIs to be launched as root. The way the GUI works at the moment is that it accesses much of the content that the CLI protects with sudo, thus starting with sudo lowers the UX friction, though this is subject to change. More info [here](https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root#Using_xhost) and [here](https://beamtic.com/sudo-and-guis).

Workaround is provied:
1. Install `xhost` or `x11-xserver-utils`
2. Type in terminal `xhost si:localuser:root`
3. Type in terminal `sudo protonvpn-gui`



#### ProtonVPN Tray dependencies

| **Distro**                              | **Command**                                                                                                     |
|:----------------------------------------|:----------------------------------------------------------------------------------------------------------------|
|Fedora/CentOS/RHEL                       | `sudo dnf install -y libappindicator-gtk3`                                                                      |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y gir1.2-appindicator3`                                                                       |
|OpenSUSE/SLES                            | `sudo zypper install libappindicator-gtk3`                                                                      |
|Arch Linux/Manjaro                       | `sudo pacman -S libappindicator-gtk3`                                                                           |

**NOTE:**
Gnome users will to install and additional extension for this to work: <a href="https://extensions.gnome.org/extension/615/appindicator-support/"> KStatusNotifierItem/AppIndicator Support</a>

### Tray Known issues:
#### dbus-launch
There is a known issue when user attempts to start the systray/appindicator. This might throw an error that is simillar to this one: `(<app-name>:<pid>) LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory)` if a user does not have a specific package installed. If you are unable to use the systray/appindicator and have a simillar error then a solution is provided below.

**Solution:**
Install `dbus-x11` package for your distribution, more information can be found on this <a href="https://askubuntu.com/questions/1005623/libdbusmenu-glib-warning-unable-to-get-session-bus-failed-to-execute-child">stackoverflow</a> post.

## Installing ProtonVPN Linux GUI

### Distribution based
- Fedora/CentOS/RHEL: To-do
- Ubuntu derivatives: To-do
- OpenSUSE/SLES: To-do
- Arch Linux/Manjaro: <a href="https://aur.archlinux.org/packages/protonvpn-linux-gui/" target="_blank">Available at AUR</a>


### PIP based

*Note: Make sure to run pip with sudo*

`sudo pip3 install protonvpn-linux-gui-calexandru2018`

#### To update to a new version

`sudo pip3 install protonvpn-linux-gui-calexandru2018 --upgrade`

### Manual Installation

1. Clone this repository

    `git clone https://github.com/calexandru2018/protonvpn-linux-gui`

2. Step into the directory

   `cd protonvpn-linux-gui`

3. Install

    `sudo python3 setup.py install`

### Virtual environment

If you would like to run the the GUI within a virtual environment (for either development purpose or other), then you can easily do that with the help of <a href="https://pipenv.readthedocs.io/en/latest/">pipenv</a>. Make sure to install pipenv beforehand following the next steps.

1. `git clone https://github.com/calexandru2018/protonvpn-linux-gui` 
2. `cd protonvpn-linux-gui`
3. `pipenv install` installs the virtual environment and all necessary dependencies from `Pipfile`.
4. `pipenv shell` enters the virtual environment.
5. `sudo pip install -e .` installs the GUI in your virtual environment. 
6. `sudo protonvpn-gui` starts the GUI from within the virtual environment.

# How to use

### ProtonVPN GUI

 `sudo protonvpn-gui`

### ProtonVPN Tray

 `protonvpn-tray`

# Enhancements

### Create .desktop file

#### ProtonVPN GUI
To create at <i>desktop</i> launcher with a .desktop file, follow the instrucitons below.

1. Find the path to the package with `pip3 show protonvpn-linux-gui-calexandru2018`

   You should get something like `Location: /usr/local/lib/<YOUR_PYTHON_VERSION>/dist-packages` , this is where your Python packages reside. **Note:** Based on your distro, your `Location` path may not look exactly like this one, so make sure to use your own and `Location` path.

2. Based on previous information, the path to your icon should be `<PATH_DISPLAYED_IN_STEP_1>/protonvpn_linux_gui/resources/img/logo/protonvpn_logo.png`

3. Create a `protonvpn-gui.desktop` file in `.local/share/applications/`, and paste in the following code. Remember to change the **`Icon`** path to your own path.

    ```
    [Desktop Entry]
    Name=ProtonVPN GUI
    GenericName=Unofficial ProtonVPN GUI for Linux
    Exec=sudo protonvpn-gui
    Icon=<YOUR_ICON_PATH>
    Type=Application
    Terminal=False
    Categories=Utility;GUI;Network;VPN
    ```

#### ProtonVPN Tray
To create at <i>tray icon</i> launcher with a .desktop file, follow the instrucitons below.

1. Find the path to the package with `pip3 show protonvpn-linux-gui-calexandru2018`

   You should get something like `Location: /usr/local/lib/<YOUR_PYTHON_VERSION>/dist-packages` , this is where your Python packages reside. **Note:** Based on your distro, your `Location` path may not look exactly like this one, so make sure to use your own and `Location` path.

2. Based on previous information, the path to your icon should be `<PATH_DISPLAYED_IN_STEP_1>/protonvpn_linux_gui/resources/img/logo/protonvpn_logo.png`

3. Create a `protonvpn-tray.desktop` file in `.local/share/applications/`, and paste in the following code. Remember to change the **`Icon`** path to your own path.

    ```
    [Desktop Entry]
    Name=ProtonVPN GUI Tray
    GenericName=Unofficial ProtonVPN GUI Tray for Linux
    Exec=protonvpn-tray
    Icon=<YOUR_ICON_PATH>
    Type=Application
    Terminal=False
    Categories=Utility;GUI;Network;VPN
    ```

## Visudo/Sudoless
If you would like to launch the GUI without having to type in your sudo password everytime, then you could add the bin to `visudo`. This is extremly useful when you have a .desktop file, and all you want to do is click the launcher to have the GUI pop-up without being prompted for sudo password.

1. First you will need the path to the GUI. This can be found by typing `which protonvpn-gui`. You should get something like this: `/usr/bin/protonvpn-gui`. Save it since you will need it later. **Note:** As previously mentioned, the path may look different for you, based on your distro.
2. Identify your username by typing `whoami`. Save it (or memorize it). 
3. In another terminal, type in `sudo visudo`, and a window should pop-up, scroll to the very bottom of it.
4. Once you are at the botton, type: `<YOUR_USERNAME_FROM_STEP2> ALL = (root) NOPASSWD: <YOUR_PATH_FROM_STEP1>`
5. Exit and save! Have fun :)

# Not yet implemented:

- ~~Split Tunneling~~
- ~~Kill Switch~~
- ~~Filtering servers~~
- ~~Start on Boot~~ (only for systemd/systemctl based OS's)
- ~~Systray/AppIndicator~~

# GUI Layout
<p align="center">
  <img src="https://i.imgur.com/OlcYrwf.png" alt="Login"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/VOpTlMR.png" alt="Dashboard"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/BlVmFa9.png" alt="Profiles"></img>
</p>

<p align="center">
  <img src="https://i.imgur.com/S353btA.png" alt="General Settings"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/BWE9LDf.png" alt="Tray Settings"></img>
</p> 
<p align="center">
  <img src="https://i.imgur.com/md4ni6t.png" alt="Connection Settings"></img>
</p>  
<p align="center">
  <img src="https://i.imgur.com/KYMxSoe.png" alt="Advanced Settings"></img>
</p> 

<p align="center">
  <img src="https://i.imgur.com/vXMSQ8z.png" alt="Diagnosis Tool"></img>
</p> 





%package help
Summary:	Development documents and examples for protonvpn-linux-gui-calexandru2018
Provides:	python3-protonvpn-linux-gui-calexandru2018-doc
%description help

<h1 align="center">ProtonVPN Linux GUI</h1>
<p align="center">
  <img src="https://i.imgur.com/rjMuf7p.png" alt="Logo"></img>
</p>

<p align="center">
  <a href="https://github.com/calexandru2018/protonvpn-linux-gui/releases/latest">
      <img alt="Build Status" src="https://img.shields.io/github/release/calexandru2018/protonvpn-linux-gui.svg?style=flat" />
  </a>
  <a href="https://pepy.tech/project/protonvpn-linux-gui-calexandru2018">
    <img alt="Downloads" src="https://pepy.tech/badge/protonvpn-linux-gui-calexandru2018">
  </a>   
    <a href="https://pepy.tech/project/protonvpn-linux-gui-calexandru2018/week">
      <img alt="Downloads per Week" src="https://pepy.tech/badge/protonvpn-linux-gui-calexandru2018/week">
    </a>
</p>
<p align="center">
  <a href="https://liberapay.com/calexandru2018/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
</p>
<p align="center">
  <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/protonvpn-linux-gui-calexandru2018?color=Yellow&label=python&logo=Python&logoColor=Yellow">
</p>
<p align="center">
  <a href="https://www.codefactor.io/repository/github/calexandru2018/protonvpn-linux-gui">
    <img src="https://www.codefactor.io/repository/github/calexandru2018/protonvpn-linux-gui/badge" alt="CodeFactor" />
  </a>
  <a href="https://github.com/calexandru2018/protonvpn-linux-gui/blob/master/LICENSE">
    <img src="https://img.shields.io/pypi/l/protonvpn-linux-gui-calexandru2018?style=flat" alt="License"></img>
  </a>
</p>
<p align="center">
    <a href="https://actions-badge.atrox.dev/calexandru2018/protonvpn-linux-gui/goto?ref=master">
        <img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/workflow/status/calexandru2018/protonvpn-linux-gui/master flake8/master?label=master%20flake8">
    </a>
    <a href="https://actions-badge.atrox.dev/calexandru2018/protonvpn-linux-gui/goto?ref=testing">
      <img alt="GitHub Workflow Status (Testing)" src="https://img.shields.io/github/workflow/status/calexandru2018/protonvpn-linux-gui/testing flake8/testing?label=testing%20flake8">
    </a> 
</p>


<h3 align="center">An <b>unofficial</b> Linux GUI for ProtonVPN, written in Python. Layout designed in Glade.</h3>

Protonvpn-linux-gui works on top of <a href="https://github.com/ProtonVPN/protonvpn-cli-ng"><b>protonvpn-cli-ng</b></a>, making it a dependency. All local configurations are managed by the GUI (such as updating protocol, split tunneling, manage killswitch) while the connections are managed by the CLI. This way, you will be able to use the latest version of the CLI, while also being able to use the GUI.

## Table of Contents
- [Installing and Updating](#installing-and-updating)
  - [Dependencies](#dependencies)
    - [Python dependencies](#python-dependencies)
    - [ProtonVPN GUI dependencies](#protonvpn-gui-dependencies)
      - [Known Issues](#gui-known-issues)   
        - [Wayland](#wayland)  
    - [ProtonVPN Tray dependencies](#protonvpn-tray-dependencies)
      - [Known Issues](#tray-known-issues)
        - [dbus-launch](#dbus-launch)
  - [Installing protonvpn-linux-gui](#installing-protonvpn-linux-gui)
    - [Distribution based](#distribution-based)
    - [PIP based](#pip-based)
      - [How to Update](#to-update-to-a-new-version) 
  - [Manual installation](#manual-installation)
  - [Virtual environment](#virtual-environment)
- [How to use](#how-to-use)
   - [ProtonVPN GUI](#protonvpn-gui)
   - [ProtonVPN Tray](#protonvpn-tray)
- [Enhancements](#enhancements)
  - [Create .desktop file](#create-desktop-file)
    - [ProtonVPN GUI](#protonvpn-gui-1)
    - [ProtonVPN Tray](#protonvpn-tray-1)
  - [Visudo/Sudoless](#visudosudoless)
- [Not yet implemented](#not-yet-implemented)
- [GUI Layout](#gui-layout)

# Installing and Updating

### Dependencies

#### Python dependencies
- python >= 3.5
- requests >= 2.23.0
- configparse >= 4.0.2
- pip for python3 (pip3)
- <a href="https://github.com/ProtonVPN/protonvpn-cli-ng"><b>protonvpn-cli-ng</b></a> >= 2.2.2
- setuptools for python3 (python3-setuptools)


#### ProtonVPN GUI dependencies

| **Distro**                              | **Command**                                                                                                     |
|:----------------------------------------|:----------------------------------------------------------------------------------------------------------------|
|Fedora/CentOS/RHEL                       | `sudo dnf install -y python3-gobject gtk3`                                                                      |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0`                                                |
|OpenSUSE/SLES                            | `sudo zypper install python3-gobject python3-gobject-Gdk typelib-1_0-Gtk-3_0 libgtk-3-0`                        |
|Arch Linux/Manjaro                       | `sudo pacman -S python-gobject gtk3`                                                                            |

### GUI Known issues:

#### Wayland
While this works well on X11, there are certain restrictions on Wayland since it does not allow GUIs to be launched as root. The way the GUI works at the moment is that it accesses much of the content that the CLI protects with sudo, thus starting with sudo lowers the UX friction, though this is subject to change. More info [here](https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root#Using_xhost) and [here](https://beamtic.com/sudo-and-guis).

Workaround is provied:
1. Install `xhost` or `x11-xserver-utils`
2. Type in terminal `xhost si:localuser:root`
3. Type in terminal `sudo protonvpn-gui`



#### ProtonVPN Tray dependencies

| **Distro**                              | **Command**                                                                                                     |
|:----------------------------------------|:----------------------------------------------------------------------------------------------------------------|
|Fedora/CentOS/RHEL                       | `sudo dnf install -y libappindicator-gtk3`                                                                      |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y gir1.2-appindicator3`                                                                       |
|OpenSUSE/SLES                            | `sudo zypper install libappindicator-gtk3`                                                                      |
|Arch Linux/Manjaro                       | `sudo pacman -S libappindicator-gtk3`                                                                           |

**NOTE:**
Gnome users will to install and additional extension for this to work: <a href="https://extensions.gnome.org/extension/615/appindicator-support/"> KStatusNotifierItem/AppIndicator Support</a>

### Tray Known issues:
#### dbus-launch
There is a known issue when user attempts to start the systray/appindicator. This might throw an error that is simillar to this one: `(<app-name>:<pid>) LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory)` if a user does not have a specific package installed. If you are unable to use the systray/appindicator and have a simillar error then a solution is provided below.

**Solution:**
Install `dbus-x11` package for your distribution, more information can be found on this <a href="https://askubuntu.com/questions/1005623/libdbusmenu-glib-warning-unable-to-get-session-bus-failed-to-execute-child">stackoverflow</a> post.

## Installing ProtonVPN Linux GUI

### Distribution based
- Fedora/CentOS/RHEL: To-do
- Ubuntu derivatives: To-do
- OpenSUSE/SLES: To-do
- Arch Linux/Manjaro: <a href="https://aur.archlinux.org/packages/protonvpn-linux-gui/" target="_blank">Available at AUR</a>


### PIP based

*Note: Make sure to run pip with sudo*

`sudo pip3 install protonvpn-linux-gui-calexandru2018`

#### To update to a new version

`sudo pip3 install protonvpn-linux-gui-calexandru2018 --upgrade`

### Manual Installation

1. Clone this repository

    `git clone https://github.com/calexandru2018/protonvpn-linux-gui`

2. Step into the directory

   `cd protonvpn-linux-gui`

3. Install

    `sudo python3 setup.py install`

### Virtual environment

If you would like to run the the GUI within a virtual environment (for either development purpose or other), then you can easily do that with the help of <a href="https://pipenv.readthedocs.io/en/latest/">pipenv</a>. Make sure to install pipenv beforehand following the next steps.

1. `git clone https://github.com/calexandru2018/protonvpn-linux-gui` 
2. `cd protonvpn-linux-gui`
3. `pipenv install` installs the virtual environment and all necessary dependencies from `Pipfile`.
4. `pipenv shell` enters the virtual environment.
5. `sudo pip install -e .` installs the GUI in your virtual environment. 
6. `sudo protonvpn-gui` starts the GUI from within the virtual environment.

# How to use

### ProtonVPN GUI

 `sudo protonvpn-gui`

### ProtonVPN Tray

 `protonvpn-tray`

# Enhancements

### Create .desktop file

#### ProtonVPN GUI
To create at <i>desktop</i> launcher with a .desktop file, follow the instrucitons below.

1. Find the path to the package with `pip3 show protonvpn-linux-gui-calexandru2018`

   You should get something like `Location: /usr/local/lib/<YOUR_PYTHON_VERSION>/dist-packages` , this is where your Python packages reside. **Note:** Based on your distro, your `Location` path may not look exactly like this one, so make sure to use your own and `Location` path.

2. Based on previous information, the path to your icon should be `<PATH_DISPLAYED_IN_STEP_1>/protonvpn_linux_gui/resources/img/logo/protonvpn_logo.png`

3. Create a `protonvpn-gui.desktop` file in `.local/share/applications/`, and paste in the following code. Remember to change the **`Icon`** path to your own path.

    ```
    [Desktop Entry]
    Name=ProtonVPN GUI
    GenericName=Unofficial ProtonVPN GUI for Linux
    Exec=sudo protonvpn-gui
    Icon=<YOUR_ICON_PATH>
    Type=Application
    Terminal=False
    Categories=Utility;GUI;Network;VPN
    ```

#### ProtonVPN Tray
To create at <i>tray icon</i> launcher with a .desktop file, follow the instrucitons below.

1. Find the path to the package with `pip3 show protonvpn-linux-gui-calexandru2018`

   You should get something like `Location: /usr/local/lib/<YOUR_PYTHON_VERSION>/dist-packages` , this is where your Python packages reside. **Note:** Based on your distro, your `Location` path may not look exactly like this one, so make sure to use your own and `Location` path.

2. Based on previous information, the path to your icon should be `<PATH_DISPLAYED_IN_STEP_1>/protonvpn_linux_gui/resources/img/logo/protonvpn_logo.png`

3. Create a `protonvpn-tray.desktop` file in `.local/share/applications/`, and paste in the following code. Remember to change the **`Icon`** path to your own path.

    ```
    [Desktop Entry]
    Name=ProtonVPN GUI Tray
    GenericName=Unofficial ProtonVPN GUI Tray for Linux
    Exec=protonvpn-tray
    Icon=<YOUR_ICON_PATH>
    Type=Application
    Terminal=False
    Categories=Utility;GUI;Network;VPN
    ```

## Visudo/Sudoless
If you would like to launch the GUI without having to type in your sudo password everytime, then you could add the bin to `visudo`. This is extremly useful when you have a .desktop file, and all you want to do is click the launcher to have the GUI pop-up without being prompted for sudo password.

1. First you will need the path to the GUI. This can be found by typing `which protonvpn-gui`. You should get something like this: `/usr/bin/protonvpn-gui`. Save it since you will need it later. **Note:** As previously mentioned, the path may look different for you, based on your distro.
2. Identify your username by typing `whoami`. Save it (or memorize it). 
3. In another terminal, type in `sudo visudo`, and a window should pop-up, scroll to the very bottom of it.
4. Once you are at the botton, type: `<YOUR_USERNAME_FROM_STEP2> ALL = (root) NOPASSWD: <YOUR_PATH_FROM_STEP1>`
5. Exit and save! Have fun :)

# Not yet implemented:

- ~~Split Tunneling~~
- ~~Kill Switch~~
- ~~Filtering servers~~
- ~~Start on Boot~~ (only for systemd/systemctl based OS's)
- ~~Systray/AppIndicator~~

# GUI Layout
<p align="center">
  <img src="https://i.imgur.com/OlcYrwf.png" alt="Login"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/VOpTlMR.png" alt="Dashboard"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/BlVmFa9.png" alt="Profiles"></img>
</p>

<p align="center">
  <img src="https://i.imgur.com/S353btA.png" alt="General Settings"></img>
</p>
<p align="center">
  <img src="https://i.imgur.com/BWE9LDf.png" alt="Tray Settings"></img>
</p> 
<p align="center">
  <img src="https://i.imgur.com/md4ni6t.png" alt="Connection Settings"></img>
</p>  
<p align="center">
  <img src="https://i.imgur.com/KYMxSoe.png" alt="Advanced Settings"></img>
</p> 

<p align="center">
  <img src="https://i.imgur.com/vXMSQ8z.png" alt="Diagnosis Tool"></img>
</p> 





%prep
%autosetup -n protonvpn-linux-gui-calexandru2018-2.0.7

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-protonvpn-linux-gui-calexandru2018 -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.7-1
- Package Spec generated