Skip to content

Instantly share code, notes, and snippets.

@jonathands
Created May 30, 2025 13:17
Show Gist options
  • Select an option

  • Save jonathands/39b81230fd295a0a9a10b37cfba0303e to your computer and use it in GitHub Desktop.

Select an option

Save jonathands/39b81230fd295a0a9a10b37cfba0303e to your computer and use it in GitHub Desktop.
Script to install an Easy to access button to toggle CloudFlare Warp VPN
#!/bin/bash
# Create toggle script in /usr/bin
echo "Creating /usr/bin/warp-toggle..."
sudo tee /usr/bin/warp-toggle > /dev/null << 'EOF'
#!/bin/bash
STATUS=$(warp-cli -j status | grep -o '"status":[ ]*"[^"]*"' | cut -d'"' -f4)
if [ "$STATUS" = "Connected" ]; then
warp-cli -j disconnect
notify-send "WARP" "Disconnected from WARP"
else
warp-cli -j connect
notify-send "WARP" "Connected to WARP"
fi
EOF
sudo chmod +x /usr/bin/warp-toggle
echo "warp-toggle script installed."
# Create desktop launcher
mkdir -p ~/.local/share/applications
echo "Creating desktop launcher..."
tee ~/.local/share/applications/warp-toggle.desktop > /dev/null << EOF
[Desktop Entry]
Name=WARP Toggle
Exec=/usr/bin/warp-toggle
Icon=network-vpn
Terminal=false
Type=Application
Categories=Network;
EOF
chmod +x ~/.local/share/applications/warp-toggle.desktop
echo "Desktop launcher created."
# Send confirmation notification
notify-send "WARP Toggle" "Installation complete. You can now toggle WARP via menu or shortcut."
echo "✅ WARP toggle installed successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment