Skip to content
isenePublic

About

Wi-Fi and VPN in the terminal, straight to NetworkManager, and nothing running while you are not looking

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

roam

Wi-Fi and VPN in the terminal, and nothing running while you are not looking.

Rust Unlicense Platform Stay Amazing

The networks in the air, the ones you have used, and what you are on now. Part of the Fe₂O₃ Rust terminal suite.

nm-applet sat in memory all day to do this, holding 98 MB. roam runs when you open it and is gone when you close it.

Using it

roam
Key Does
j k or arrows Move
Enter Join the network, or bring a VPN up or down
d Leave the network you are on
f Forget a saved network, password and all
m Mark a saved network metered, or take the mark off
r Look for networks again
w Wi-Fi radio on or off
? This list, in a box
q Quit

A locked network nobody has saved asks for its password, hidden as you type. A saved one joins without asking.

Off the hotspot when you get home

roam --watch stays in the background. While you are on a metered network, such as your phone's hotspot, it listens for networks coming into range. When a saved one with a password shows up, it switches to it.

A password stands in for "no login page": the open networks you have saved are the airports, cafés and hotels. Of several, it takes the one NetworkManager would pick: highest priority, then the one used last.

If a VPN was up, it comes back up on the new network. A VPN that NetworkManager runs needs nothing more. A tunnel of your own, such as openfortivpn, needs its commands in ~/.roamrc:

vpn_up = work-vpn
vpn_down = work-vpn stop

If the new network shows a login page after all, roam goes back and skips that network from then on. The skipped ones are listed in ~/.roam/portals.

Mark the hotspot metered once with m, while it is in range. A notification tells you when roam switches.

On an unmetered network the watcher does nothing at all: no wake-ups, measured over 30 seconds. On a metered one it asks for a Wi-Fi scan every three minutes. It also wakes when a scan finds a new access point. NetworkManager scans by itself only when the signal gets weak. A hotspot in your pocket stays strong, so a network you walk into would go unseen. Start it with your session, for instance from .tilerc or .xinitrc. A second one stops at once.

How much the hotspot has used

While you are on a metered Wi-Fi network, roam --watch counts the data that goes through the Wi-Fi card. roam shows the sum at the top right: Phone: 312 MB today, 4.1 GB this month. The number is for this laptop alone, and the month is the calendar month.

The count is written to ~/.roam/usage every three minutes, at the same moment as the scan. So it costs no wake-up of its own. The file has one line a day and network: the date, the bytes, the name.

How it talks

Straight to NetworkManager over the system bus, the way nm-applet does. No nmcli is started.

A password travels inside one call to NetworkManager, so it never shows in a process list or lands in a file.

NetworkManager keeps the password from then on, so the network rejoins by itself with nothing else running.

A first try that fails leaves nothing behind, so the next try asks for the password again.

What it does not do yet

Networks that want a user name and a certificate (work networks, eduroam). Those still need nmcli.

Install

cargo install --path .

License

Public domain. Do what you like with it.

About

Wi-Fi and VPN in the terminal, straight to NetworkManager, and nothing running while you are not looking

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages