|
| 1 | +# Devices Tab |
| 2 | + |
| 3 | +The Devices tab (press `3` or navigate with `Tab`) shows all active swap devices and lets you activate, deactivate, or reset them. |
| 4 | + |
| 5 | +## Requirements |
| 6 | + |
| 7 | +Control operations (`o`, `f`, `r`) require root. Run as: |
| 8 | + |
| 9 | +``` |
| 10 | +sudo swaptop |
| 11 | +``` |
| 12 | + |
| 13 | +If you run without root, you can still view device status — only control is restricted. |
| 14 | + |
| 15 | +## Columns |
| 16 | + |
| 17 | +| Column | Description | |
| 18 | +|--------|-------------| |
| 19 | +| Path | Device path (e.g. `/dev/sda2`, `/swapfile`) | |
| 20 | +| Type | `Partition`, `File`, `Zram`, or `DynamicPager` | |
| 21 | +| Total | Total swap capacity | |
| 22 | +| Used | Currently used swap | |
| 23 | +| % | Usage percentage | |
| 24 | +| Pri | Kernel priority (higher = preferred) | |
| 25 | +| Status | `ACTIVE`, `INACTIVE`, `⏳ ...`, `✓ OK`, or `✗ ERROR` | |
| 26 | + |
| 27 | +## Keybindings |
| 28 | + |
| 29 | +| Key | Action | |
| 30 | +|-------------|--------| |
| 31 | +| `j` / `↓` | Move selection down | |
| 32 | +| `k` / `↑` | Move selection up | |
| 33 | +| `o` | Activate selected device (`swapon`) | |
| 34 | +| `f` | Deactivate selected device (`swapoff`) | |
| 35 | +| `r` | Reset selected device (`swapoff` + 100ms + `swapon`) | |
| 36 | +| `s` | Confirm action (when modal is open) | |
| 37 | +| `Esc` | Cancel confirmation modal | |
| 38 | +| `Tab` / `1-4` | Switch tabs | |
| 39 | +| `q` | Quit | |
| 40 | + |
| 41 | +## Status Indicators |
| 42 | + |
| 43 | +- **`ACTIVE`** — device is currently active as swap |
| 44 | +- **`INACTIVE`** — device is known but not currently active |
| 45 | +- **`⏳ ...`** — operation in progress (swapon/swapoff running) |
| 46 | +- **`✓ OK`** — last operation succeeded |
| 47 | +- **`✗ ERROR`** — last operation failed (check statusbar for details) |
| 48 | + |
| 49 | +## Reset Operation |
| 50 | + |
| 51 | +Reset (`r`) performs `swapoff` followed by `swapon` with a 100ms pause. This forces the kernel to move all swap pages back to RAM and then re-enable the device, which clears fragmentation. Use it when swap usage is high but actual data could be consolidated. |
| 52 | + |
| 53 | +**Note:** Reset requires enough free RAM to hold all data currently in that swap device. If RAM is too full, `swapoff` will fail with an error. |
| 54 | + |
| 55 | +## Platform Notes |
| 56 | + |
| 57 | +On **macOS**, swap is managed automatically by `dynamic_pager`. The Devices tab shows the active swapfiles but control operations are unavailable. |
0 commit comments