# printf converts the bash array into a pipe-delimited list and XXXX is a never-match last element. # If one of the interface IPs matches one of the VPN IPs then the VPN is connected. Local interfaceIPs=($(ifconfig -a -u inet | grep -F "inet" | grep -oE "$" # IPv6 support would require filtering on 'inet6' and an IPv6 regex. # -v | -verbose Prints out a message to STDERR if not connected. # - If VPN is NOT connected, the script exits with code 1. # - If VPN is connected, the script exits with code 0. # a comparison of the client's configured IP addresses and the active network # Determines if the Global Protect VPN is connected. Stop manual instance of skhd and restart serviceĭetect whether the VPN is currently connected: #!/usr/bin/env bash Play with the keybindings and see the functions outputs in the terminal from 3. Stop skhd service and start it manually to confirm everything is working fine.Rcmd + ralt - 0x2F : zsh -c "loadGlobalProtect " # start global protect Rcmd + ralt - 0x2B : zsh -c "unloadGlobalProtect " # killall global protect Rcmd + ralt - space : zsh -c "toggleGlobalProtectConnection" # (dis)connect to VPN For example these are mine (you may need to remove default MacOS bindings) Tell application "System Events" to tell process "GlobalProtect"Ĭlick menu bar item 1 of menu bar 2 - Activates the GlobalProtect "window" in the menubarĬlick button 2 of window 1 - Clicks either Connect or DisconnectĬlick menu bar item 1 of menu bar 2 - This will close the GlobalProtect "window" after clicking Connect/Disconnect. Launchctl load -w /Library/LaunchAgents/.ist Launchctl unload -w /Library/LaunchAgents/.ist Add the following to ~/.zshenv (create it if doesn't exist already).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |