PIA VPN Automation with KM

I wanted to activate my PIA VPN without touching my trackpad.

Thankfully, they have added Command-Line control to their client app:

Here is the shell script I used as a toggle, I hope it saves someone some time:

#!/bin/bash

case $(piactl get connectionstate) in
	Disconnected)
		piactl connect
		;;
	Connected)
		piactl disconnect
		;;
	Interupted)
		piactl connect
		;;
	Disconnecting)
		echo "Disconnecting"
		;;
	DisconnectingToReconnect)
		echo "Trying to reconnect now"
		;;
	*)
		piactl connect
		;;
esac

2 Likes