A small GNOME Shell extension and companion script to toggle a NetworkManager Wi-Fi hotspot and set up basic NAT/iptables rules.
- Quick Settings toggle for GNOME Shell 46/47/48.
- CLI script for manual use or automation.
- Optional desktop entry launcher.
- Sets up NAT/forwarding for hotspot traffic.
hotspot-toggle: main Bash script.[email protected]/: extension sources and bundled script.hotspot-toggle.desktop: desktop entry.install.sh: installer and sudoers setup.
- NetworkManager with
nmcli iptables,sysctl,notify-sendgnome-extensions(for enabling the extension)- sudo access (to install the sudoers entry)
Run the installer and enter your sudo password when prompted:
./install.shThis installs:
~/.local/bin/hotspot-toggle~/.local/share/applications/hotspot-toggle.desktop~/.local/share/gnome-shell/extensions/[email protected]//etc/sudoers.d/hotspot-toggle
Ensure ~/.local/bin is on your PATH, or invoke the script with the full path.
If you rely on the desktop entry, refresh the cache:
update-desktop-database ~/.local/share/applicationsToggle from the command line:
hotspot-togglePin a specific Wi-Fi interface:
HOTSPOT_WIFI_IF=wlp2s0 hotspot-toggleThe script expects the connection name Hotspot (the default created by
nmcli dev wifi hotspot). If your connection uses a different name, update
HOTSPOT_NAME in hotspot-toggle.
Enable it:
gnome-extensions enable [email protected]Reload GNOME Shell if needed (Xorg: Alt+F2 then r; Wayland: log out/in).
rm -f ~/.local/bin/hotspot-toggle
rm -f ~/.local/share/applications/hotspot-toggle.desktop
rm -rf ~/.local/share/gnome-shell/extensions/[email protected]
sudo rm -f /etc/sudoers.d/hotspot-toggleThe installer adds a NOPASSWD sudoers entry for specific iptables and
sysctl commands. Review /etc/sudoers.d/hotspot-toggle before using in
sensitive environments.
GPL-2.0. See LICENSE.

