summaryrefslogtreecommitdiff
path: root/docs/vpn
diff options
context:
space:
mode:
Diffstat (limited to 'docs/vpn')
-rw-r--r--docs/vpn/index.rst59
1 files changed, 59 insertions, 0 deletions
diff --git a/docs/vpn/index.rst b/docs/vpn/index.rst
index 95eb08c2..ef9a1510 100644
--- a/docs/vpn/index.rst
+++ b/docs/vpn/index.rst
@@ -77,3 +77,62 @@ a systemd script to launch vpn. If you have the latest master installed from a d
[Install]
WantedBy=default.target
+
+Another option is to autostart it adding a ``~/.config/autostart/bitmask.desktop``::
+
+ [Desktop Entry]
+ Version=1.0
+ Encoding=UTF-8
+ Type=Application
+ Name=Bitmask
+ Comment=Secure Communication
+ Exec=bitmaskctl vpn start
+ Terminal=false
+ Icon=bitmask
+
+Qubes i3 status
+---------------
+The following script can be used to add the bitmask status to the i3 status bar in qubes::
+
+ status_bitmask() {
+ local status=$(qvm-run "sys-bitmask" -p 'bitmaskctl vpn status --json' 2>/dev/null)
+ local error=$(parse_json 'error')
+
+ if [[ $error -ne "None" ]]; then
+ json bitmask "VPN: $error" '#ff0000'
+ else
+ local domain=$(parse_json 'result' 'domain')
+ local sttus=$(parse_json 'result' 'status')
+ local up=$(parse_json 'result' 'up')
+ local down=$(parse_json 'result' 'down')
+ local error=$(parse_json 'result' 'error')
+
+ case $sttus in
+ "on")
+ local text="$domain: ↑$up ↓$down"
+ local color=""
+ ;;
+ "starting")
+ local text="$domain: starting"
+ local color="#00ff00"
+ ;;
+ "off"|"stopping")
+ local text="VPN: off"
+ local color='#ffff00'
+ ;;
+ "failed")
+ local text="VPN: $error"
+ local color="#ff0000"
+ ;;
+ esac
+ json bitmask "$text" $color
+ fi
+ }
+
+ parse_json() {
+ local item=""
+ for param in $@; do
+ item=${item}"['${param}']"
+ done
+ echo -n $(python -c "import json; j=json.loads(\"\"\"$status\"\"\"); print j${item}")
+ }