{{tag>gnome hosts desktop extension}} ====== Comment/uncomment hosts file from gnome shell panel ====== Install [[https://github.com/p-e-w/argos|argos]] In //.config/argos/hosts.10s.sh// add this: #!/usr/bin/env bash R="hosts" echo "$R" echo "---" echo "host01 | iconName=help-faq-symbolic terminal=true bash='switch_host.sh 01'" echo "host02 | iconName=help-faq-symbolic terminal=true bash='switch_host.sh 02'" echo "host03 | iconName=help-faq-symbolic terminal=true bash='switch_host.sh 03'" echo "RESET | iconName=help-faq-symbolic terminal=true bash='switch_host.sh reset'" echo "---" CURRENT=$(awk '/## DELIMITER/,/##\/DELIMITER/' /etc/hosts | grep -v '^$' | grep -B1 -v '^#') echo "$CURRENT" Add script //.local/bin/// (substitute x.x.x.x with IPs in your hosts file): #!/usr/bin/env bash # Uncomment host in /etc/hosts file to hit it directly with browser. # used by argos gnome extensions # https://github.com/rammie/argos if [ "$1" == "01" ];then sudo sed -i "/x.x.x.x/s/^#//g" /etc/hosts elif [ "$1" == "02" ];then sudo sed -i "/x.x.x.x/s/^#//g" /etc/hosts elif [ "$1" == "03" ];then sudo sed -i "/x.x.x.x/s/^#//g" /etc/hosts elif [ "$1" == "reset" ];then sudo sed -i "/# DELIMITER/,/#\/DELIMITER/s/^\([^#].*\)/#\1/g" /etc/hosts fi Example ///etc/hosts//: ## DELIMITER ## live-host-01 #x.x.x.x www.domain.com ### live-host-02 #x.x.x.x www.domain.com ### live-host-03 #x.x.x.x www.domain.com ##/DELIMITER ====== Tested on ====== * GNOME Shell 3.36.9 ====== See also ====== * [[https://extensions.gnome.org//extension/3981/guillotine/|Guillotine]] ====== References ======