mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Start adding systray
This commit is contained in:
parent
47bf46cb3d
commit
f4739e749a
6 changed files with 53 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -133,4 +133,5 @@ dmypy.json
|
||||||
deb_dist
|
deb_dist
|
||||||
.DS_Store
|
.DS_Store
|
||||||
install/windows/Dangerzone.wxs
|
install/windows/Dangerzone.wxs
|
||||||
test_docs/sample-safe.pdf
|
test_docs/sample-safe.pdf
|
||||||
|
share/bin
|
6
BUILD.md
6
BUILD.md
|
@ -58,6 +58,12 @@ If you don't have it already, install poetry (`pip3 install --user poetry`). The
|
||||||
poetry install
|
poetry install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Make sure Docker Desktop is installed (Dangerzone copies hyperkit and vpnkit binaries from it) and run this to collect the binaries:
|
||||||
|
|
||||||
|
```
|
||||||
|
./install/macos/collect-bins.sh
|
||||||
|
```
|
||||||
|
|
||||||
Run from source tree:
|
Run from source tree:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -8,6 +8,7 @@ from PySide2 import QtCore, QtWidgets
|
||||||
|
|
||||||
from .common import GuiCommon
|
from .common import GuiCommon
|
||||||
from .main_window import MainWindow
|
from .main_window import MainWindow
|
||||||
|
from .systray import SysTray
|
||||||
from .docker_installer import (
|
from .docker_installer import (
|
||||||
is_docker_installed,
|
is_docker_installed,
|
||||||
is_docker_ready,
|
is_docker_ready,
|
||||||
|
@ -149,4 +150,7 @@ def gui_main(custom_container, filename):
|
||||||
# If the application is activated and all windows are closed, open a new one
|
# If the application is activated and all windows are closed, open a new one
|
||||||
app_wrapper.application_activated.connect(application_activated)
|
app_wrapper.application_activated.connect(application_activated)
|
||||||
|
|
||||||
|
# Create a system tray, which also handles the VM subprocess
|
||||||
|
systray = SysTray(global_common, gui_common, app)
|
||||||
|
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
29
dangerzone/gui/systray.py
Normal file
29
dangerzone/gui/systray.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
from PySide2 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class SysTray(QtWidgets.QSystemTrayIcon):
|
||||||
|
def __init__(self, global_common, gui_common, app):
|
||||||
|
super(SysTray, self).__init__()
|
||||||
|
self.global_common = global_common
|
||||||
|
self.gui_common = gui_common
|
||||||
|
self.app = app
|
||||||
|
|
||||||
|
self.setIcon(self.gui_common.get_window_icon())
|
||||||
|
|
||||||
|
menu = QtWidgets.QMenu()
|
||||||
|
self.status_action = menu.addAction("Dangerzone is starting ...")
|
||||||
|
self.status_action.setEnabled(False)
|
||||||
|
menu.addSeparator()
|
||||||
|
self.restart_action = menu.addAction("Restart")
|
||||||
|
self.restart_action.triggered.connect(self.restart_clicked)
|
||||||
|
self.quit_action = menu.addAction("Quit")
|
||||||
|
self.quit_action.triggered.connect(self.quit_clicked)
|
||||||
|
|
||||||
|
self.setContextMenu(menu)
|
||||||
|
self.show()
|
||||||
|
|
||||||
|
def restart_clicked(self):
|
||||||
|
self.status_action.setText("Restarting Dangerzone ...")
|
||||||
|
|
||||||
|
def quit_clicked(self):
|
||||||
|
self.app.quit()
|
4
install/macos/collect-bins.sh
Executable file
4
install/macos/collect-bins.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
mkdir -p share/bin
|
||||||
|
cp /Applications/Docker.app/Contents/Resources/bin/com.docker.hyperkit share/bin/hyperkit
|
||||||
|
cp /Applications/Docker.app/Contents/Resources/bin/com.docker.vpnkit share/bin/vpnkit
|
|
@ -1,9 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<!-- Required for binaries built with PyInstaller -->
|
<!-- Required for binaries built with PyInstaller -->
|
||||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
|
||||||
|
<key>com.apple.vm.networking</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
</plist>
|
</plist>
|
Loading…
Reference in a new issue