ItamiForge
ProjectsDevice Finder

TUI Guide

Interactive Terminal User Interface for Device Finder.

TUI Mode

Current status: The TUI launches and displays a device list. Full interactive features (sorting, vim keys, mouse, details panel) are in progress.

Launch the interactive Terminal User Interface by running Device Finder without arguments:

df

Keyboard controls:

KeyAction
/ Navigate devices
TabCycle platform filters (All → iOS → Android → Web → All)
rRefresh device list
q / EscQuit

Device List View

The TUI displays devices in a table format:

Device Finder
┌─────────────────────────────────────────────────────────┐
│ PLATFORM NAME                TYPE         STATUS   ID   │
├─────────────────────────────────────────────────────────┤
│ iOS      iPhone 16 Pro       Simulator    Shutdown ABC.. │
│ Android  Pixel 9             Emulator     Connected ... │
│ iOS      iPad Air 6          Simulator    Connected ... │
└─────────────────────────────────────────────────────────┘
↑↓: Navigate | Tab: Filter | r: Refresh | q: Quit

Features

  • Real-time refresh: Press r to reload the device list
  • Platform filtering: Press Tab to filter by iOS, Android, Web, or show all
  • Color indicators: Device status is color-coded for quick scanning
    • 🟢 Green: Connected/Running
    • ⚫ Dark Gray: Shutdown/Offline
    • 🟡 Yellow: Booting/Loading
    • ⚪ Gray: Unknown/Unavailable

Tips

  1. Use Tab repeatedly to quickly switch between platform views

  2. Press r to refresh if you just connected a new device

  3. Combine TUI with CLI commands for scripting:

    # Get device list from TUI view, then use in CLI
    df find "iPhone" --json

Performance

The TUI loads devices on startup. On systems with many devices, initial load may take a few seconds.

  • Initial load: 1–2s (macOS with iOS simulators), 2–5s (Android with active emulators)
  • Refresh (r): Same as initial load
  • Navigation: Instant

Keyboard Navigation

Basic Movement

KeyAction
/ Navigate up/down one row
j / kVim-style navigation
Page UpMove up 10 rows
Page DownMove down 10 rows
HomeJump to first device
EndJump to last device
gJump to top
GJump to bottom

Filtering & Sorting

KeyAction
TabCycle platform filter (All → iOS → Android → Web → All)
sChange sort column (cycles: name → platform → status → type → OS)
S (shift+s)Toggle sort direction (ascending ↔ descending)

Application Control

KeyAction
rRefresh device list
qQuit TUI

Mouse Support

The TUI supports mouse interaction:

  • Scroll wheel: Navigate up/down through the list
  • Trackpad scroll: Smooth scrolling navigation

Note: Click selection is not currently implemented. Use keyboard for precise selection.

Color Coding

Platform Colors

PlatformColorEmoji
iOSBlue📱
AndroidGreen🤖
WebCyan🌐
UnknownGray

Status Colors

StatusColorMeaning
Connected🟢 GreenDevice is running
Shutdown⚫ Dark GrayDevice is off
Not Installed🟡 YellowRuntime not available
Booting🟡 YellowDevice starting
Unknown⚪ GrayStatus unavailable

Selection Highlight

  • Selected row: Light blue background with black text
  • Cursor indicator: ▶ arrow at row start
  • Scrollbar thumb: Light blue on dark track

Sorting Behavior

When sorting, devices are reorganized while maintaining your selection context:

  1. Press s to cycle through sort columns
  2. Press S to reverse direction
  3. Selection is preserved when possible
  4. Scroll position adjusts to keep selected device visible

Sort Columns

ColumnSort Logic
NameAlphabetical
PlatformiOS → Android → Web → Unknown
StatusConnected → Booting → Shutdown → Unknown
TypeSimulator → Emulator → Physical → Container
OS VersionSemantic version (18.2 < 18.4)

Tips & Tricks

Quick Filtering

Use Tab to quickly isolate a platform:

  • Starting from [All], one Tab shows only iOS
  • Two Tabs shows only Android
  • Three Tabs shows only Web
  • Four Tabs returns to [All]

Finding Specific Devices

  1. Sort by name (s until "name" appears)
  2. Use g to go to top
  3. Use G to go to end
  4. Or navigate with arrow keys

Large Device Lists

When you have many simulators:

  • Use Page Up/Page Down for faster navigation
  • The scrollbar shows your position in the list
  • Status bar shows "X/Y devices" counter

Refresh After Changes

If you:

  • Create a new simulator in Xcode
  • Start an Android emulator
  • Connect a physical device

Press r to refresh the list without restarting the TUI.

Troubleshooting

TUI Won't Launch

Check terminal requirements:

  • Terminal must support alternate screen buffer
  • Unicode support required for table borders
  • Minimum 80x24 terminal size recommended

Colors Look Wrong

Ensure your terminal supports 256 colors:

# Check color support
echo $TERM
# Should show xterm-256color or similar

# If not, set in your shell config:
export TERM=xterm-256color

Mouse Scrolling Not Working

Mouse support requires:

  • Terminal with mouse reporting (most modern terminals)
  • No terminal multiplexer capturing events (tmux/screen may interfere)
  • In tmux: set -g mouse on

High CPU Usage

The TUI polls for input every 50ms. This should be negligible, but if you notice high CPU:

  • Ensure you're running a release build (cargo build --release)
  • Check for terminal rendering issues with your terminal emulator

Configuration

The TUI currently uses sensible defaults. Future versions may support:

  • Custom color schemes
  • Configurable key bindings
  • Default sort preferences
  • Column visibility toggles

Comparison: TUI vs CLI

FeatureCLITUI
SpeedInstant~100ms startup
InteractionOne-shotContinuous
VisualizationText tableRich columns
SortingFlagsInteractive
FilteringFlagsReal-time
DetailsPer-commandPersistent panel
Best forScripts, CIExploration, debugging

See Also