VPN toggle
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
"exec": "firefox",
|
"exec": "firefox",
|
||||||
"args": ["--new-window"],
|
"args": ["--new-window"],
|
||||||
"environ": {
|
"environ": {
|
||||||
"MOZ_ENABLE_WAYLAND": "1"
|
"MOZ_ENABLE_WAYLAND": "0"
|
||||||
},
|
},
|
||||||
"program_name": "firefox"
|
"program_name": "firefox"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,21 @@ function getkernelpkg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function random-xkcd() {
|
function random-xkcd() {
|
||||||
curl $(curl -L https://c.xkcd.com/random/comic/ 2>/dev/null | (echo "https:"$(xmllint --html --xpath 'string(//html/body/div[@id="middleContainer"]/div[@id="comic"]/img/@src)' - 2>/dev/null))) | feh -
|
blocklist=(
|
||||||
|
"404"
|
||||||
|
"631" # "Anatomy Text", don't want that coming up in public thanks
|
||||||
|
)
|
||||||
|
link="https://xkcd.com/404/"
|
||||||
|
while (( $blocklist[(Ie)$(basename $link)] )); do
|
||||||
|
link=$(curl https://c.xkcd.com/random/comic/ -v |& grep location | cut -d' ' -f3 | sed 's/\r//')
|
||||||
|
done
|
||||||
|
html=$(curl -L ${link/http:/https:} 2>/dev/null)
|
||||||
|
name=$(echo $html | xmllint --html --xpath 'string(//html/body/div[@id="middleContainer"]/div[@id="ctitle"])' - 2>/dev/null)
|
||||||
|
title=$(echo $html | xmllint --html --xpath 'string(//html/body/div[@id="middleContainer"]/div[@id="comic"]/img/@title)' - 2>/dev/null)
|
||||||
|
echo $link
|
||||||
|
echo -e "\033[1;34m$name\033[0m"
|
||||||
|
echo -e "\033[1;33m$title\033[0m"
|
||||||
|
curl $(echo $html | (echo "https:"$(xmllint --html --xpath 'string(//html/body/div[@id="middleContainer"]/div[@id="comic"]/img/@src)' - 2>/dev/null))) 2>/dev/null | feh -
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $(hostnamectl chassis) == "container" ]]; then
|
if [[ $(hostnamectl chassis) == "container" ]]; then
|
||||||
|
|||||||
14
.local/bin/vpn-toggle
Executable file
14
.local/bin/vpn-toggle
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# Toggles the GlobalProtect VPN connection on and off
|
||||||
|
|
||||||
|
# Get the current state of the VPN connection
|
||||||
|
if pgrep gpclient &>/dev/null; then
|
||||||
|
# VPN is connected, so disconnect
|
||||||
|
echo "Disconnecting from VPN..."
|
||||||
|
pkexec gpclient disconnect
|
||||||
|
else
|
||||||
|
# VPN is disconnected, so connect
|
||||||
|
echo "Connecting to VPN..."
|
||||||
|
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gpclient connect gp.usu.edu
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user