Skip to content

Instantly share code, notes, and snippets.

@felipealfonsog
Created June 6, 2026 22:31
Show Gist options
  • Select an option

  • Save felipealfonsog/faca3358a0c87fc77ec794aee00f2d13 to your computer and use it in GitHub Desktop.

Select an option

Save felipealfonsog/faca3358a0c87fc77ec794aee00f2d13 to your computer and use it in GitHub Desktop.
ConnMan CLI Manager for Arch Linux
#!/bin/bash
# Colors for a more user-friendly interface
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No color
printf "${BLUE}=== ConnMan Manager for Arch Linux ===${NC}\n"
while true; do
echo "----------------------------------------"
echo -e "${YELLOW}1)${NC} View network status"
echo -e "${YELLOW}2)${NC} List available services"
echo -e "${YELLOW}3)${NC} Scan and connect to Wi-Fi"
echo -e "${YELLOW}4)${NC} Enable/Disable Wi-Fi"
echo -e "${YELLOW}5)${NC} Connect to an existing service"
echo -e "${YELLOW}6)${NC} Disconnect from a service"
echo -e "${YELLOW}7)${NC} Show technologies"
echo -e "${YELLOW}8)${NC} Exit"
echo "----------------------------------------"
read -p "Select an option [1-8]: " option
case $option in
1)
echo -e "\n${GREEN}--- ConnMan State ---${NC}"
connmanctl state
echo -e "\n${GREEN}--- Services ---${NC}"
connmanctl services
;;
2)
echo -e "\n${GREEN}--- Available Services ---${NC}"
connmanctl services
;;
3)
echo -e "\n${BLUE}Scanning Wi-Fi networks...${NC}"
connmanctl scan wifi
echo -e "\n${GREEN}--- Available Wi-Fi Networks ---${NC}"
connmanctl services
echo "----------------------------------------"
read -p "Enter the service ID to connect: " service_id
echo -e "\n${BLUE}Connecting to $service_id...${NC}"
connmanctl connect "$service_id"
;;
4)
echo -e "\n${YELLOW}1)${NC} Enable Wi-Fi"
echo -e "${YELLOW}2)${NC} Disable Wi-Fi"
read -p "Select [1-2]: " wifi_option
if [ "$wifi_option" == "1" ]; then
connmanctl enable wifi
echo -e "${GREEN}Wi-Fi enabled.${NC}"
elif [ "$wifi_option" == "2" ]; then
connmanctl disable wifi
echo -e "${RED}Wi-Fi disabled.${NC}"
else
echo -e "${RED}Invalid option.${NC}"
fi
;;
5)
echo -e "\n${GREEN}--- Available Services ---${NC}"
connmanctl services
echo "----------------------------------------"
read -p "Service ID to CONNECT: " service_id
connmanctl connect "$service_id"
;;
6)
echo -e "\n${RED}--- Services ---${NC}"
connmanctl services
echo "----------------------------------------"
read -p "Service ID to DISCONNECT: " service_id
connmanctl disconnect "$service_id"
;;
7)
echo -e "\n${GREEN}--- Technologies ---${NC}"
connmanctl technologies
;;
8)
echo -e "\n${BLUE}Goodbye!${NC}"
exit 0
;;
*)
echo -e "\n${RED}Invalid option.${NC}"
;;
esac
echo ""
read -p "Press [Enter] to continue..."
clear
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment