aboutsummaryrefslogtreecommitdiffstats
path: root/hosts/README.md
blob: 72eb5e1f2abbb6eae47ff2eea4167fcdb3255c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# hosts

The LAN map from the Obsidian vault as a searchable list, over a dimmed
screen. ALT+SHIFT+Return opens it, Escape or a click outside closes it. It
replaces the rofi SSH menu, `blackpearl-sshmenu.sh`.

Each card shows a host's `ip:port`, its hostname, the Proxmox node and CT id
it runs on, and the actions its data allows:

- `ssh <alias>`, one per `~/.ssh/config` alias pointing at it, in a kitty tab
  (`ssh-tab`, lifted from the rofi script);
- `open`, when the note has a `url`;
- `copy <ip:port>`, through `wl-copy`.

Cards are grouped: one section per Proxmox node, its own card first and
then every note whose `node` names it; then `Devices`, anything else on a
private address (phone, printers, IoT); then `Remote`, the rest of the ssh
aliases. A dot top-right says whether the host answers now: green yes, red
no, grey while `hosts.py --probe` runs (about a second, all hosts at once,
started with the list on each opening). A host with a `port`, or a `url`,
is probed by a TCP connect to it, so a service whose CT is up but whose
daemon is not reads red; anything else by one ping.

Type to filter (every word must match name, ip, port, hostname, node, CT id
alias or group), arrows to move, Enter runs the first action, chips run their own.

`hosts.py` builds the list on every opening, so there is no cache. It reads
the frontmatter of each note in the vault's `Local Network/services/`
(`HOSTS_DIR` overrides the path) and the ssh config. An alias joins the note
whose `ip` or `hostname` is its `HostName`, or whose short hostname is the
alias; an alias that matches no note gets a card of its own, so everything
the rofi menu listed is still here. Aliases with the same `HostName` share a
card. Like the rofi script, it reads plain `Keyword value` lines only:
`Include` and `Match` are not followed, wildcard `Host` patterns are skipped.

## Running

    qs -p ./hosts
    qs -p ./hosts ipc call hosts toggle

## Blur

Optional, in the Hyprland config:

    hl.layer_rule({
        name         = "blur-hosts",
        match        = { namespace = "^(keystone-hosts)$" },
        blur         = true,
        xray         = false,
        ignore_alpha = 0.1,
    })

## Check

    /usr/bin/python3 hosts/hosts.py --check