Keyboard Shortcuts & Navigation
Relevant source files
The following files were used as context for generating this wiki page:
LogUtil is an interactive Terminal User Interface (TUI) application designed for real-time log analysis. The system employs a state-driven navigation model that transitions between a pre-analysis configuration phase and a multi-tab analysis phase. Users interact with the system primarily through keyboard events captured by the crossterm backend, though the configuration phase also supports mouse interactions for file selection and settings toggling.
Sources: README.md:15-20, src/main.rs:175-180
Input Handling Architecture
The application uses a centralized event loop in main.rs that polls for system events. During the active analysis phase, input is delegated to the App struct, which distinguishes between global application shortcuts and tab-specific commands.
Input Flow Diagram
The following diagram illustrates how a key press is routed through the system components.
Sources: src/main.rs:188-210, src/app.rs:88-105
Global Navigation Shortcuts
Global shortcuts are handled by the App container and are available regardless of which analysis tab is currently active. These controls manage application lifecycle and tab cycling.
| Key | Action | Context |
|---|---|---|
q | Quit Application | Global |
Ctrl+C | Quit Application | Global |
Tab | Switch to Next Tab | Analysis Phase |
Shift + Tab | Switch to Previous Tab | Analysis Phase |
t | Switch to Next Tab | Analysis Phase |
Shift + T | Switch to Previous Tab | Analysis Phase |
BackTab | Switch to Previous Tab | Analysis Phase |
Sources: README.md:230-245, src/app.rs:145-175
File Selector & Settings Navigation
Before log analysis begins, LogUtil enters an interactive configuration mode managed by FileSettings. This mode splits the interface into a file browser and a settings panel.
Keyboard Controls
- Panel Switching:
Left,Right, orTabkeys are used to toggle theactive_panelstate between the File Selector (0) and Settings (1). - Navigation:
Up/Down(ork/j) move the selection within the active table. - Directory Traversal: In the File Selector,
Enteron a directory or thehkey (on parent) navigates the filesystem. - Execution:
F10or selecting "Start Analysis" withEntertriggers theFileSettingsAction::StartAnalysisevent.
Sources: src/file_settings.rs:600-650, src/file_settings.rs:720-750
Mouse Interactions
LogUtil supports mouse events specifically within the configuration phase. The handle_mouse function calculates the coordinates relative to the UI chunks to determine if the user is interacting with files or settings.
Tab-Specific Navigation
Once analysis is running, the arrow keys and Enter take on specific roles depending on the active tab's layout (defined in src/tabs/).
Overview Tab
The Overview tab manages two primary tables: Top IPs and Top URLs.
- Panel Switch:
Left/Rightarrows move focus between IP and URL lists. - Selection:
Up/Downarrows navigate the active list. - Clipboard:
EnterorCtrl+Ccopies the selected IP or URL to the system clipboard via thearboardcrate.
Sources: src/tabs/overview.rs:245-285
Detailed Tab
The Detailed tab features a master-detail relationship between an IP list and its specific request logs.
- Focus:
Leftfocuses the IP Table;Rightfocuses the Request List. - Drill-down: When the Request List is focused,
Up/Downscrolls through the log entries for the IP currently selected in the master table.
Sources: src/tabs/detailed.rs:250-280
Security Tab
The Security tab includes a specialized search and detail view.
- Filtering: Typing directly into the tab appends characters to a search string used to filter suspicious IPs.
- Detail View: Pressing
denters a full-screen "Log Detail View" for the selected threat. - Navigation:
Escorqexits the detail view back to the security overview.
Sources: src/tabs/security.rs:500-550
Clipboard Integration Logic
LogUtil uses the arboard library to bridge the TUI with the system clipboard. The App struct intercepts the KeyCode::Enter event and checks the current tab name to execute the appropriate copy logic.
// Example of clipboard routing in src/app.rs
match tab_name {
"Overview" => {
if let Some(overview_tab) = _tab.as_any_mut().downcast_mut::<OverviewTab>() {
if let Some(message) = overview_tab.copy_selected_to_clipboard() {
self.modal_state = Some(ModalState { message, ... });
}
}
}
// ...
}
Sources: src/app.rs:105-140, src/tabs/detailed.rs:55-75
Conclusion
Navigation in LogUtil is designed to be efficient for terminal power users, relying on standard Vim-like keys (j, k, h) and standard TUI conventions (Tab, Arrows). The transition from mouse-supported configuration to a keyboard-centric analysis phase allows for quick setup followed by high-speed data exploration.