twinfi
Linux Wi-Fi hotspot that keeps your Wi-Fi connected
- Role
- Solo project
- When
- 2026
Overview
A Linux CLI and GTK 4 app that keeps you connected to Wi-Fi while broadcasting a hotspot, without hand-editing nmcli or hostapd config. Renamed from apsta in 0.13.
The constraint
Many Wi-Fi chipsets can't run client and access-point modes together through NetworkManager alone.
What I built
- 01
Reads the chipset's valid interface combinations from iw, scoped to each radio so a USB dongle doesn't leak its capabilities into the built-in card.
- 02
Runs the hotspot on a virtual interface with nmcli or hostapd and dnsmasq. If the Wi-Fi channel can't host (radar/DFS channels, or 5 GHz channels the card blocks), it runs as a Wi-Fi Direct group on a channel of its own.
- 03
All-or-nothing setup: every step registers its own undo, so a failure part-way leaves nothing behind, and stop removes exactly what start added.
- 04
A watcher restarts the hotspot after suspend or a driver reset, follows Wi-Fi channel changes and steps aside when it would keep Wi-Fi from reconnecting. Works with firewalld, iptables and nftables, and picks a subnet that doesn't clash.
- 05
Client management in hostapd mode (list, kick, block, rate-limit, allow-list), a join QR code, and a random password on first start, never a shared default.
Request path
- twinfi CLI / GTK app
- iw phy info
- nmcli or hostapd
- dnsmasq
- firewall rules
From the code
def allows(self, wanted: Dict[str, int]) -> bool: """Can these interface types (type -> count) exist simultaneously?""" instances = [t for t, n in wanted.items() for _ in range(n)] if len(instances) > self.total: return False remaining = [g.limit for g in self.groups] def place(i: int) -> bool: if i == len(instances): return True for gi, group in enumerate(self.groups): if instances[i] in group.types and remaining[gi] > 0: remaining[gi] -= 1 if place(i + 1): return True remaining[gi] += 1 return False return place(0)Outcome
Tells you what your hardware supports, then picks the mode that keeps you online. Installable from PyPI, an Ubuntu PPA, a .deb and an Arch repo; existing apsta installs migrate on the first run.
- Python
- Linux
- NetworkManager
- hostapd
- dnsmasq
- GTK 4
Next project
unpakt
Install any Linux app for your user, on any distro, with one-step rollback