Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae80e9a5db | |||
| 1b07026b68 | |||
| f9534bacf3 | |||
| 006aeb0c90 |
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-player"
|
||||
version = "0.1.5"
|
||||
version = "0.1.9"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
276
README.md
276
README.md
@@ -1,2 +1,278 @@
|
||||
# cm-player
|
||||
|
||||
A high-performance terminal UI music and video player written in Rust, designed for low-bandwidth VPN environments with cache-only operation.
|
||||
|
||||
## Features
|
||||
|
||||
- **Cache-only architecture**: Scans media directories once and operates from cache, ideal for low-bandwidth VPN connections
|
||||
- **Vim-style navigation**: Familiar keybindings (j/k/h/l) for efficient navigation
|
||||
- **Incremental fuzzy search**: Real-time search with Tab completion, similar to vim's command-line search
|
||||
- **Directory tree browsing**: Collapsible folder structure with lazy scrolling
|
||||
- **Playlist management**: Mark multiple files (vim-style 'v' key) to create custom playlists
|
||||
- **MPV integration**: Video and audio playback via MPV subprocess with IPC control
|
||||
- **Dual-panel layout**: File browser on left, playlist on right
|
||||
- **Auto-advance**: Automatically plays next track when current track ends
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
|
||||
**State Management** (`src/state/mod.rs`)
|
||||
- Maintains flattened file tree from cache for efficient rendering
|
||||
- Handles directory expansion/collapse state
|
||||
- Manages playlist and playback position
|
||||
- Implements fuzzy search with folder priority boost
|
||||
|
||||
**MPV IPC Integration** (`src/player/mod.rs`)
|
||||
- Spawns MPV as subprocess with Unix socket IPC
|
||||
- Automatic process respawn when MPV exits (user closes window)
|
||||
- Non-blocking socket communication with JSON protocol
|
||||
- Tracks playback state, position, duration via property observation
|
||||
|
||||
**Cache System** (`src/cache/mod.rs`)
|
||||
- XDG-compliant cache storage: `~/.cache/cm-player/`
|
||||
- Serializes directory tree structure with serde_json
|
||||
- Supports manual refresh with 'r' key
|
||||
- Scans multiple configured paths
|
||||
|
||||
**UI Rendering** (`src/ui/mod.rs`)
|
||||
- Three-section layout: title bar (1 line) | content | status bar (1 line)
|
||||
- Ratatui framework with crossterm backend
|
||||
- Theme matching cm-dashboard color scheme
|
||||
- Real-time playback progress in title bar
|
||||
|
||||
### Technical Details
|
||||
|
||||
**Fuzzy Search Algorithm**
|
||||
```rust
|
||||
// Scoring system:
|
||||
// - Characters must appear in order (not necessarily consecutive)
|
||||
// - Consecutive matches: +10 bonus per character
|
||||
// - Word boundary matches: +15 bonus
|
||||
// - Gap penalty: -1 per character between matches
|
||||
// - Folder priority: +50 score boost
|
||||
// - Length bonus: 100 - text_length
|
||||
```
|
||||
|
||||
**MPV Communication**
|
||||
- IPC socket: `/tmp/cm-player-{pid}.sock`
|
||||
- Commands: `{ "command": ["loadfile", "path"] }`
|
||||
- Property observation: `time-pos`, `duration`, `pause`, `idle-active`
|
||||
- Process lifecycle: spawn -> connect -> command -> observe -> respawn on exit
|
||||
|
||||
**Lazy Scrolling**
|
||||
- Selection stays in place until reaching viewport edge
|
||||
- Scroll offset only updates when necessary
|
||||
- Page navigation with Ctrl-D/U (half-page jumps)
|
||||
|
||||
## Installation
|
||||
|
||||
### Pre-built Binary (NixOS)
|
||||
|
||||
```nix
|
||||
# hosts/common/cm-player.nix is automatically included
|
||||
# mpv is installed as dependency
|
||||
```
|
||||
|
||||
### From Release
|
||||
|
||||
```bash
|
||||
curl -L https://gitea.cmtec.se/cm/cm-player/releases/latest/download/cm-player-linux-x86_64 -o cm-player
|
||||
chmod +x cm-player
|
||||
sudo mv cm-player /usr/local/bin/
|
||||
```
|
||||
|
||||
### Build from Source
|
||||
|
||||
```bash
|
||||
git clone https://gitea.cmtec.se/cm/cm-player.git
|
||||
cd cm-player
|
||||
cargo build --release
|
||||
./target/release/cm-player
|
||||
```
|
||||
|
||||
**Static linking** (for portability):
|
||||
```bash
|
||||
export RUSTFLAGS="-C target-feature=+crt-static"
|
||||
cargo build --release --target x86_64-unknown-linux-gnu
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Config File
|
||||
|
||||
Location: `~/.config/cm-player/config.toml`
|
||||
|
||||
```toml
|
||||
[scan_paths]
|
||||
paths = [
|
||||
"/mnt/music",
|
||||
"/mnt/movie",
|
||||
"/mnt/tv"
|
||||
]
|
||||
```
|
||||
|
||||
### First Run
|
||||
|
||||
1. Create config file with media paths
|
||||
2. Launch cm-player
|
||||
3. Press 'r' to scan directories and build cache
|
||||
4. Cache stored at `~/.cache/cm-player/cache.json`
|
||||
|
||||
## Keybindings
|
||||
|
||||
### Navigation
|
||||
- `j` / `k` / `↓` / `↑` - Move selection down/up
|
||||
- `h` - Collapse directory
|
||||
- `l` - Expand directory
|
||||
- `Ctrl-D` - Page down (half page)
|
||||
- `Ctrl-U` - Page up (half page)
|
||||
|
||||
### Search
|
||||
- `/` - Enter search mode (fuzzy find)
|
||||
- `Tab` - Next search result
|
||||
- `Shift-Tab` - Previous search result
|
||||
- `Enter` - Execute search and enable n/N cycling
|
||||
- `n` - Next search match (after Enter) or next track
|
||||
- `N` - Previous search match
|
||||
- `Esc` - Clear search results
|
||||
|
||||
### Playlist
|
||||
- `v` - Mark/unmark file or directory
|
||||
- `a` - Add marked files to playlist
|
||||
- `c` - Clear playlist
|
||||
|
||||
### Playback
|
||||
- `Enter` - Play selected file/folder (uses marks if any)
|
||||
- `Space` - Pause/Resume
|
||||
- `s` - Stop playback
|
||||
- `p` - Previous track
|
||||
- `n` - Next track (when not in search results)
|
||||
- `←` / `→` - Seek backward/forward 10 seconds
|
||||
- `+` / `=` - Increase volume
|
||||
- `-` - Decrease volume
|
||||
|
||||
### System
|
||||
- `r` - Rescan media directories and rebuild cache
|
||||
- `q` - Quit
|
||||
|
||||
## Development
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
cm-player/
|
||||
├── src/
|
||||
│ ├── main.rs # Event loop and key handling
|
||||
│ ├── state/mod.rs # App state and search logic
|
||||
│ ├── player/mod.rs # MPV IPC integration
|
||||
│ ├── ui/
|
||||
│ │ ├── mod.rs # TUI rendering
|
||||
│ │ └── theme.rs # Color scheme
|
||||
│ ├── cache/mod.rs # Cache serialization
|
||||
│ ├── scanner/mod.rs # Directory scanning
|
||||
│ └── config/mod.rs # Config file handling
|
||||
├── .gitea/workflows/
|
||||
│ └── release.yml # CI/CD pipeline
|
||||
└── Cargo.toml
|
||||
```
|
||||
|
||||
### Dependencies
|
||||
|
||||
- **ratatui** - Terminal UI framework
|
||||
- **crossterm** - Terminal backend
|
||||
- **tokio** - Async runtime for event loop
|
||||
- **serde/serde_json** - Cache serialization
|
||||
- **walkdir** - Directory traversal
|
||||
- **anyhow/thiserror** - Error handling
|
||||
|
||||
### Logging
|
||||
|
||||
Logs written to `/tmp/cm-player.log` to avoid interfering with TUI:
|
||||
|
||||
```rust
|
||||
tracing::info!("Playing: {:?}", path);
|
||||
tail -f /tmp/cm-player.log
|
||||
```
|
||||
|
||||
## Release Process
|
||||
|
||||
### Automated CI/CD
|
||||
|
||||
Releases are fully automated via Gitea Actions:
|
||||
|
||||
```bash
|
||||
# Update version in Cargo.toml
|
||||
vim Cargo.toml
|
||||
|
||||
# Commit and tag
|
||||
git add Cargo.toml
|
||||
git commit -m "Bump version to v0.1.X"
|
||||
git push
|
||||
git tag v0.1.X
|
||||
git push origin v0.1.X
|
||||
```
|
||||
|
||||
**Workflow steps**:
|
||||
1. Build static binary with `RUSTFLAGS="-C target-feature=+crt-static"`
|
||||
2. Create GitHub-style release on Gitea
|
||||
3. Upload binary and tarball as release assets
|
||||
4. Calculate SHA256 hash from local tarball
|
||||
5. Clone nixosbox repository
|
||||
6. Update `hosts/common/cm-player.nix` with new version and hash
|
||||
7. Commit and push to nixosbox
|
||||
|
||||
### Manual NixOS Update
|
||||
|
||||
If workflow fails, update manually:
|
||||
|
||||
```bash
|
||||
cd ~/projects/nixosbox
|
||||
|
||||
# Download and hash the tarball
|
||||
curl -L https://gitea.cmtec.se/cm/cm-player/releases/download/v0.1.X/cm-player-linux-x86_64.tar.gz -o /tmp/cm-player.tar.gz
|
||||
sha256sum /tmp/cm-player.tar.gz | cut -d' ' -f1
|
||||
# Convert hex to base64: python3 -c "import base64, binascii; print(base64.b64encode(binascii.unhexlify('HEX_HASH')).decode())"
|
||||
|
||||
# Edit hosts/common/cm-player.nix
|
||||
vim hosts/common/cm-player.nix
|
||||
# Update version and sha256
|
||||
|
||||
git add hosts/common/cm-player.nix
|
||||
git commit -m "Update cm-player to v0.1.X"
|
||||
git push
|
||||
```
|
||||
|
||||
## MPV Configuration
|
||||
|
||||
Default MPV flags:
|
||||
- `--idle` - Keep MPV running between tracks
|
||||
- `--no-terminal` - Disable MPV's terminal output
|
||||
- `--profile=fast` - Use fast decoding profile
|
||||
- `--audio-display=no` - Disable cover art for audio files
|
||||
- `--input-ipc-server=/tmp/cm-player-{pid}.sock` - Enable IPC
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### MPV window closes immediately
|
||||
Check MPV installation: `mpv --version`
|
||||
|
||||
### Scan shows no files
|
||||
- Verify paths in `~/.config/cm-player/config.toml`
|
||||
- Press 'r' to rescan
|
||||
- Check logs: `tail -f /tmp/cm-player.log`
|
||||
|
||||
### Hash mismatch on NixOS rebuild
|
||||
- Wait for workflow to complete before rebuilding
|
||||
- Workflow calculates hash from local tarball, not downloaded
|
||||
- Check release assets are fully uploaded: https://gitea.cmtec.se/cm/cm-player/releases
|
||||
|
||||
### Video playback issues
|
||||
MPV process respawns automatically if closed. If issues persist:
|
||||
1. Stop playback with 's'
|
||||
2. Restart cm-player
|
||||
3. Check `/tmp/cm-player.log` for errors
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2025 CM Tech
|
||||
|
||||
132
src/main.rs
132
src/main.rs
@@ -7,7 +7,7 @@ mod ui;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use crossterm::{
|
||||
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers},
|
||||
event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers},
|
||||
execute,
|
||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
};
|
||||
@@ -56,7 +56,7 @@ async fn main() -> Result<()> {
|
||||
// Setup terminal
|
||||
enable_raw_mode()?;
|
||||
let mut stdout = io::stdout();
|
||||
execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
|
||||
execute!(stdout, EnterAlternateScreen)?;
|
||||
let backend = CrosstermBackend::new(stdout);
|
||||
let mut terminal = Terminal::new(backend)?;
|
||||
|
||||
@@ -67,8 +67,7 @@ async fn main() -> Result<()> {
|
||||
disable_raw_mode()?;
|
||||
execute!(
|
||||
terminal.backend_mut(),
|
||||
LeaveAlternateScreen,
|
||||
DisableMouseCapture
|
||||
LeaveAlternateScreen
|
||||
)?;
|
||||
terminal.show_cursor()?;
|
||||
|
||||
@@ -95,8 +94,8 @@ async fn run_app<B: ratatui::backend::Backend>(
|
||||
state.current_position = player.get_position().unwrap_or(0.0);
|
||||
state.current_duration = player.get_duration().unwrap_or(0.0);
|
||||
|
||||
// Check if track ended and play next
|
||||
if player.is_idle() && state.player_state == PlayerState::Playing {
|
||||
// Check if track ended and play next (but only if track was actually loaded)
|
||||
if player.is_idle() && state.player_state == PlayerState::Playing && state.current_duration > 0.0 {
|
||||
if state.playlist_index + 1 < state.playlist.len() {
|
||||
state.play_next();
|
||||
if let Some(ref path) = state.current_file {
|
||||
@@ -157,34 +156,89 @@ async fn handle_key_event<B: ratatui::backend::Backend>(terminal: &mut Terminal<
|
||||
state.should_quit = true;
|
||||
}
|
||||
(KeyCode::Char('/'), _) => {
|
||||
state.enter_search_mode();
|
||||
if state.search_mode && state.search_query.is_empty() {
|
||||
// Exit search mode only if search query is blank
|
||||
state.exit_search_mode();
|
||||
} else if !state.search_mode {
|
||||
state.enter_search_mode();
|
||||
}
|
||||
}
|
||||
(KeyCode::Esc, _) => {
|
||||
state.search_matches.clear();
|
||||
if !state.search_matches.is_empty() {
|
||||
state.search_matches.clear();
|
||||
}
|
||||
if state.visual_mode {
|
||||
state.visual_mode = false;
|
||||
state.marked_files.clear();
|
||||
}
|
||||
}
|
||||
(KeyCode::Char('n'), _) => {
|
||||
if !state.search_matches.is_empty() {
|
||||
state.next_search_match();
|
||||
} else {
|
||||
// If stopped, start from current index (0), otherwise go to next
|
||||
if state.player_state == PlayerState::Stopped && !state.playlist.is_empty() {
|
||||
state.current_file = Some(state.playlist[state.playlist_index].clone());
|
||||
state.player_state = PlayerState::Playing;
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
tracing::info!("Starting playlist: {:?}", path);
|
||||
}
|
||||
}
|
||||
(KeyCode::Char('N'), KeyModifiers::SHIFT) => {
|
||||
if !state.search_matches.is_empty() {
|
||||
state.prev_search_match();
|
||||
}
|
||||
}
|
||||
(KeyCode::Char('J'), KeyModifiers::SHIFT) => {
|
||||
// Next track
|
||||
if !state.playlist.is_empty() && state.playlist_index + 1 < state.playlist.len() {
|
||||
state.playlist_index += 1;
|
||||
state.current_file = Some(state.playlist[state.playlist_index].clone());
|
||||
|
||||
match state.player_state {
|
||||
PlayerState::Playing => {
|
||||
// Keep playing
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
tracing::info!("Next track: {:?}", path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
state.play_next();
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
tracing::info!("Next track: {:?}", path);
|
||||
PlayerState::Paused => {
|
||||
// Load but stay paused
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
player.pause()?;
|
||||
tracing::info!("Next track (paused): {:?}", path);
|
||||
}
|
||||
}
|
||||
PlayerState::Stopped => {
|
||||
// Just update current file, stay stopped
|
||||
tracing::info!("Next track selected (stopped): {:?}", state.current_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(KeyCode::Char('N'), KeyModifiers::SHIFT) => {
|
||||
state.prev_search_match();
|
||||
(KeyCode::Char('K'), KeyModifiers::SHIFT) => {
|
||||
// Previous track
|
||||
if !state.playlist.is_empty() && state.playlist_index > 0 {
|
||||
state.playlist_index -= 1;
|
||||
state.current_file = Some(state.playlist[state.playlist_index].clone());
|
||||
|
||||
match state.player_state {
|
||||
PlayerState::Playing => {
|
||||
// Keep playing
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
tracing::info!("Previous track: {:?}", path);
|
||||
}
|
||||
}
|
||||
PlayerState::Paused => {
|
||||
// Load but stay paused
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
player.pause()?;
|
||||
tracing::info!("Previous track (paused): {:?}", path);
|
||||
}
|
||||
}
|
||||
PlayerState::Stopped => {
|
||||
// Just update current file, stay stopped
|
||||
tracing::info!("Previous track selected (stopped): {:?}", state.current_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(KeyCode::Char('d'), KeyModifiers::CONTROL) => {
|
||||
state.page_down();
|
||||
@@ -209,26 +263,28 @@ async fn handle_key_event<B: ratatui::backend::Backend>(terminal: &mut Terminal<
|
||||
}
|
||||
(KeyCode::Char('a'), _) => {
|
||||
state.add_to_playlist();
|
||||
if state.visual_mode {
|
||||
state.visual_mode = false;
|
||||
state.marked_files.clear();
|
||||
}
|
||||
}
|
||||
(KeyCode::Char('c'), _) => {
|
||||
state.clear_playlist();
|
||||
}
|
||||
(KeyCode::Char('p'), _) => {
|
||||
state.play_previous();
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
tracing::info!("Previous track: {:?}", path);
|
||||
}
|
||||
}
|
||||
(KeyCode::Enter, _) => {
|
||||
state.play_selection();
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
tracing::info!("Playing: {:?} (playlist: {} tracks)", path, state.playlist.len());
|
||||
}
|
||||
if state.visual_mode {
|
||||
state.visual_mode = false;
|
||||
state.marked_files.clear();
|
||||
}
|
||||
}
|
||||
(KeyCode::Char('s'), _) => {
|
||||
// s: Stop playback
|
||||
player.stop()?;
|
||||
state.player_state = PlayerState::Stopped;
|
||||
state.current_position = 0.0;
|
||||
state.current_duration = 0.0;
|
||||
@@ -246,16 +302,26 @@ async fn handle_key_event<B: ratatui::backend::Backend>(terminal: &mut Terminal<
|
||||
state.player_state = PlayerState::Playing;
|
||||
tracing::info!("Resumed");
|
||||
}
|
||||
PlayerState::Stopped => {}
|
||||
PlayerState::Stopped => {
|
||||
// Restart playback from current playlist position
|
||||
if !state.playlist.is_empty() {
|
||||
state.current_file = Some(state.playlist[state.playlist_index].clone());
|
||||
state.player_state = PlayerState::Playing;
|
||||
if let Some(ref path) = state.current_file {
|
||||
player.play(path)?;
|
||||
tracing::info!("Restarting playback: {:?}", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(KeyCode::Left, _) => {
|
||||
(KeyCode::Char('H'), KeyModifiers::SHIFT) => {
|
||||
if state.player_state != PlayerState::Stopped {
|
||||
player.seek(-10.0)?;
|
||||
tracing::info!("Seek backward 10s");
|
||||
}
|
||||
}
|
||||
(KeyCode::Right, _) => {
|
||||
(KeyCode::Char('L'), KeyModifiers::SHIFT) => {
|
||||
if state.player_state != PlayerState::Stopped {
|
||||
player.seek(10.0)?;
|
||||
tracing::info!("Seek forward 10s");
|
||||
|
||||
@@ -187,6 +187,13 @@ impl Player {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn stop(&mut self) -> Result<()> {
|
||||
self.send_command("stop", &[])?;
|
||||
self.is_idle = true;
|
||||
self.position = 0.0;
|
||||
self.duration = 0.0;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_volume(&mut self, volume: i64) -> Result<()> {
|
||||
self.send_command("set_property", &[json!("volume"), json!(volume)])?;
|
||||
|
||||
235
src/state/mod.rs
235
src/state/mod.rs
@@ -29,10 +29,13 @@ pub struct AppState {
|
||||
pub is_refreshing: bool,
|
||||
pub search_mode: bool,
|
||||
pub search_query: String,
|
||||
pub search_matches: Vec<usize>,
|
||||
pub search_matches: Vec<PathBuf>,
|
||||
pub search_match_index: usize,
|
||||
pub tab_search_results: Vec<PathBuf>,
|
||||
pub tab_search_index: usize,
|
||||
pub visual_mode: bool,
|
||||
pub visual_anchor: usize,
|
||||
pub saved_expanded_dirs: HashSet<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -71,6 +74,9 @@ impl AppState {
|
||||
search_match_index: 0,
|
||||
tab_search_results: Vec::new(),
|
||||
tab_search_index: 0,
|
||||
visual_mode: false,
|
||||
visual_anchor: 0,
|
||||
saved_expanded_dirs: HashSet::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,12 +87,20 @@ impl AppState {
|
||||
if self.selected_index < self.scroll_offset {
|
||||
self.scroll_offset = self.selected_index;
|
||||
}
|
||||
// Update visual selection if in visual mode
|
||||
if self.visual_mode {
|
||||
self.update_visual_selection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn move_selection_down(&mut self) {
|
||||
if self.selected_index < self.flattened_items.len().saturating_sub(1) {
|
||||
self.selected_index += 1;
|
||||
// Update visual selection if in visual mode
|
||||
if self.visual_mode {
|
||||
self.update_visual_selection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,11 +134,43 @@ impl AppState {
|
||||
}
|
||||
|
||||
pub fn collapse_selected(&mut self) {
|
||||
if let Some(item) = self.get_selected_item() {
|
||||
let item = self.get_selected_item().cloned();
|
||||
if let Some(item) = item {
|
||||
if item.node.is_dir {
|
||||
let path = item.node.path.clone();
|
||||
self.expanded_dirs.remove(&path);
|
||||
self.rebuild_flattened_items();
|
||||
let was_expanded = self.expanded_dirs.contains(&path);
|
||||
|
||||
if was_expanded {
|
||||
// Close the expanded folder and keep selection on it
|
||||
self.expanded_dirs.remove(&path);
|
||||
self.rebuild_flattened_items();
|
||||
// Find the collapsed folder and select it
|
||||
if let Some(idx) = self.flattened_items.iter().position(|i| i.node.path == path) {
|
||||
self.selected_index = idx;
|
||||
}
|
||||
} else {
|
||||
// Folder is collapsed, close parent instead and jump to it
|
||||
if let Some(parent) = path.parent() {
|
||||
let parent_buf = parent.to_path_buf();
|
||||
self.expanded_dirs.remove(&parent_buf);
|
||||
self.rebuild_flattened_items();
|
||||
// Jump to parent folder
|
||||
if let Some(parent_idx) = self.flattened_items.iter().position(|i| i.node.path == parent_buf) {
|
||||
self.selected_index = parent_idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Close parent folder when on a file and jump to it
|
||||
if let Some(parent) = item.node.path.parent() {
|
||||
let parent_buf = parent.to_path_buf();
|
||||
self.expanded_dirs.remove(&parent_buf);
|
||||
self.rebuild_flattened_items();
|
||||
// Jump to parent folder
|
||||
if let Some(parent_idx) = self.flattened_items.iter().position(|i| i.node.path == parent_buf) {
|
||||
self.selected_index = parent_idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,13 +186,37 @@ impl AppState {
|
||||
}
|
||||
|
||||
pub fn toggle_mark(&mut self) {
|
||||
if let Some(item) = self.get_selected_item() {
|
||||
if !item.node.is_dir {
|
||||
let path = item.node.path.clone();
|
||||
if self.marked_files.contains(&path) {
|
||||
self.marked_files.remove(&path);
|
||||
} else {
|
||||
self.marked_files.insert(path);
|
||||
if self.visual_mode {
|
||||
// Exit visual mode and mark all files in range
|
||||
self.update_visual_selection();
|
||||
self.visual_mode = false;
|
||||
} else {
|
||||
// Enter visual mode
|
||||
self.visual_mode = true;
|
||||
self.visual_anchor = self.selected_index;
|
||||
// Clear previous marks when entering visual mode
|
||||
self.marked_files.clear();
|
||||
// Mark current file
|
||||
if let Some(item) = self.get_selected_item() {
|
||||
if !item.node.is_dir {
|
||||
self.marked_files.insert(item.node.path.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn update_visual_selection(&mut self) {
|
||||
// Clear marks
|
||||
self.marked_files.clear();
|
||||
|
||||
// Mark all files between anchor and current position
|
||||
let start = self.visual_anchor.min(self.selected_index);
|
||||
let end = self.visual_anchor.max(self.selected_index);
|
||||
|
||||
for i in start..=end {
|
||||
if let Some(item) = self.flattened_items.get(i) {
|
||||
if !item.node.is_dir {
|
||||
self.marked_files.insert(item.node.path.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,20 +299,12 @@ impl AppState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn play_previous(&mut self) {
|
||||
if self.playlist_index > 0 {
|
||||
self.playlist_index -= 1;
|
||||
self.current_file = Some(self.playlist[self.playlist_index].clone());
|
||||
self.player_state = PlayerState::Playing;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn refresh_flattened_items(&mut self) {
|
||||
// Keep current expanded state after rescan
|
||||
self.rebuild_flattened_items();
|
||||
}
|
||||
|
||||
fn rebuild_flattened_items(&mut self) {
|
||||
pub fn rebuild_flattened_items(&mut self) {
|
||||
self.flattened_items = flatten_tree(&self.cache.file_tree, 0, &self.expanded_dirs);
|
||||
if self.selected_index >= self.flattened_items.len() {
|
||||
self.selected_index = self.flattened_items.len().saturating_sub(1);
|
||||
@@ -256,12 +318,17 @@ impl AppState {
|
||||
self.search_match_index = 0;
|
||||
self.tab_search_results.clear();
|
||||
self.tab_search_index = 0;
|
||||
// Save current folder state
|
||||
self.saved_expanded_dirs = self.expanded_dirs.clone();
|
||||
}
|
||||
|
||||
pub fn exit_search_mode(&mut self) {
|
||||
self.search_mode = false;
|
||||
self.tab_search_results.clear();
|
||||
self.tab_search_index = 0;
|
||||
// Restore folder state from before search
|
||||
self.expanded_dirs = self.saved_expanded_dirs.clone();
|
||||
self.rebuild_flattened_items();
|
||||
}
|
||||
|
||||
pub fn append_search_char(&mut self, c: char) {
|
||||
@@ -291,29 +358,34 @@ impl AppState {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sort by score (highest first)
|
||||
matching_paths_with_scores.sort_by(|a, b| b.1.cmp(&a.1));
|
||||
// Add index to preserve original tree order when scores are equal
|
||||
let mut indexed_matches: Vec<(PathBuf, i32, usize)> = matching_paths_with_scores
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(idx, (path, score))| (path, score, idx))
|
||||
.collect();
|
||||
|
||||
// Sort by score (highest first), then by original index to prefer first occurrence
|
||||
indexed_matches.sort_by(|a, b| b.1.cmp(&a.1).then_with(|| a.2.cmp(&b.2)));
|
||||
|
||||
// Store all matches for tab completion
|
||||
self.tab_search_results = matching_paths_with_scores.iter().map(|(path, _)| path.clone()).collect();
|
||||
self.tab_search_results = indexed_matches.iter().map(|(path, _, _)| path.clone()).collect();
|
||||
self.tab_search_index = 0;
|
||||
|
||||
// Expand parent directories of ALL matches (not just best match)
|
||||
// This ensures folders deep in the tree become visible
|
||||
for (path, _) in &matching_paths_with_scores {
|
||||
let mut parent = path.parent();
|
||||
while let Some(p) = parent {
|
||||
self.expanded_dirs.insert(p.to_path_buf());
|
||||
parent = p.parent();
|
||||
}
|
||||
// Close all folders and expand only for the best match
|
||||
self.expanded_dirs.clear();
|
||||
let best_match = self.tab_search_results[0].clone();
|
||||
let mut parent = best_match.parent();
|
||||
while let Some(p) = parent {
|
||||
self.expanded_dirs.insert(p.to_path_buf());
|
||||
parent = p.parent();
|
||||
}
|
||||
|
||||
// Rebuild flattened items
|
||||
self.rebuild_flattened_items();
|
||||
|
||||
// Find the best match in the flattened list and jump to it
|
||||
let best_match = &self.tab_search_results[0];
|
||||
if let Some(idx) = self.flattened_items.iter().position(|item| &item.node.path == best_match) {
|
||||
if let Some(idx) = self.flattened_items.iter().position(|item| item.node.path == best_match) {
|
||||
self.selected_index = idx;
|
||||
}
|
||||
}
|
||||
@@ -324,7 +396,7 @@ impl AppState {
|
||||
return;
|
||||
}
|
||||
|
||||
// Collect all matching paths with scores
|
||||
// Collect all matching paths with scores and preserve order
|
||||
let mut matching_paths_with_scores = Vec::new();
|
||||
collect_matching_paths(&self.cache.file_tree, &self.search_query, &mut matching_paths_with_scores);
|
||||
|
||||
@@ -333,35 +405,43 @@ impl AppState {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sort by score (highest first)
|
||||
matching_paths_with_scores.sort_by(|a, b| b.1.cmp(&a.1));
|
||||
// Add index to preserve original tree order when scores are equal
|
||||
let mut indexed_matches: Vec<(PathBuf, i32, usize)> = matching_paths_with_scores
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(idx, (path, score))| (path, score, idx))
|
||||
.collect();
|
||||
|
||||
// Sort by score (highest first), then by original index to prefer first occurrence
|
||||
indexed_matches.sort_by(|a, b| b.1.cmp(&a.1).then_with(|| a.2.cmp(&b.2)));
|
||||
|
||||
let matching_paths_with_scores: Vec<(PathBuf, i32)> = indexed_matches
|
||||
.into_iter()
|
||||
.map(|(path, score, _)| (path, score))
|
||||
.collect();
|
||||
let matching_paths: Vec<PathBuf> = matching_paths_with_scores.iter().map(|(path, _)| path.clone()).collect();
|
||||
|
||||
// Expand all parent directories
|
||||
for path in &matching_paths {
|
||||
let mut parent = path.parent();
|
||||
// Store matching paths (not indices, as they change when folders collapse)
|
||||
self.search_matches = matching_paths;
|
||||
|
||||
if !self.search_matches.is_empty() {
|
||||
self.search_match_index = 0;
|
||||
// Close all folders and expand only for first match
|
||||
self.expanded_dirs.clear();
|
||||
let first_match = self.search_matches[0].clone();
|
||||
let mut parent = first_match.parent();
|
||||
while let Some(p) = parent {
|
||||
self.expanded_dirs.insert(p.to_path_buf());
|
||||
parent = p.parent();
|
||||
}
|
||||
}
|
||||
|
||||
// Rebuild flattened items
|
||||
self.rebuild_flattened_items();
|
||||
// Rebuild flattened items
|
||||
self.rebuild_flattened_items();
|
||||
|
||||
// Find indices of matches in the flattened list
|
||||
self.search_matches = matching_paths
|
||||
.iter()
|
||||
.filter_map(|path| {
|
||||
self.flattened_items
|
||||
.iter()
|
||||
.position(|item| &item.node.path == path)
|
||||
})
|
||||
.collect();
|
||||
|
||||
if !self.search_matches.is_empty() {
|
||||
self.search_match_index = 0;
|
||||
self.selected_index = self.search_matches[0];
|
||||
// Find first match in flattened list
|
||||
if let Some(idx) = self.flattened_items.iter().position(|item| item.node.path == first_match) {
|
||||
self.selected_index = idx;
|
||||
}
|
||||
}
|
||||
|
||||
self.search_mode = false;
|
||||
@@ -370,7 +450,23 @@ impl AppState {
|
||||
pub fn next_search_match(&mut self) {
|
||||
if !self.search_matches.is_empty() {
|
||||
self.search_match_index = (self.search_match_index + 1) % self.search_matches.len();
|
||||
self.selected_index = self.search_matches[self.search_match_index];
|
||||
let target_path = self.search_matches[self.search_match_index].clone();
|
||||
|
||||
// Close all folders and expand only for this match
|
||||
self.expanded_dirs.clear();
|
||||
let mut parent = target_path.parent();
|
||||
while let Some(p) = parent {
|
||||
self.expanded_dirs.insert(p.to_path_buf());
|
||||
parent = p.parent();
|
||||
}
|
||||
|
||||
// Rebuild flattened items
|
||||
self.rebuild_flattened_items();
|
||||
|
||||
// Find the path in current flattened items
|
||||
if let Some(idx) = self.flattened_items.iter().position(|item| item.node.path == target_path) {
|
||||
self.selected_index = idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +477,23 @@ impl AppState {
|
||||
} else {
|
||||
self.search_match_index -= 1;
|
||||
}
|
||||
self.selected_index = self.search_matches[self.search_match_index];
|
||||
let target_path = self.search_matches[self.search_match_index].clone();
|
||||
|
||||
// Close all folders and expand only for this match
|
||||
self.expanded_dirs.clear();
|
||||
let mut parent = target_path.parent();
|
||||
while let Some(p) = parent {
|
||||
self.expanded_dirs.insert(p.to_path_buf());
|
||||
parent = p.parent();
|
||||
}
|
||||
|
||||
// Rebuild flattened items
|
||||
self.rebuild_flattened_items();
|
||||
|
||||
// Find the path in current flattened items
|
||||
if let Some(idx) = self.flattened_items.iter().position(|item| item.node.path == target_path) {
|
||||
self.selected_index = idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +506,8 @@ impl AppState {
|
||||
self.tab_search_index = (self.tab_search_index + 1) % self.tab_search_results.len();
|
||||
let next_match = self.tab_search_results[self.tab_search_index].clone();
|
||||
|
||||
// Expand parent directories
|
||||
// Close all folders and expand only for this match
|
||||
self.expanded_dirs.clear();
|
||||
let mut parent = next_match.parent();
|
||||
while let Some(p) = parent {
|
||||
self.expanded_dirs.insert(p.to_path_buf());
|
||||
@@ -423,7 +536,8 @@ impl AppState {
|
||||
}
|
||||
let prev_match = self.tab_search_results[self.tab_search_index].clone();
|
||||
|
||||
// Expand parent directories
|
||||
// Close all folders and expand only for this match
|
||||
self.expanded_dirs.clear();
|
||||
let mut parent = prev_match.parent();
|
||||
while let Some(p) = parent {
|
||||
self.expanded_dirs.insert(p.to_path_buf());
|
||||
@@ -514,9 +628,6 @@ fn fuzzy_match(text: &str, query: &str) -> Option<i32> {
|
||||
}
|
||||
}
|
||||
|
||||
// Bonus for shorter strings (better matches)
|
||||
score += 100 - text_lower.len() as i32;
|
||||
|
||||
Some(score)
|
||||
}
|
||||
|
||||
|
||||
174
src/ui/mod.rs
174
src/ui/mod.rs
@@ -39,11 +39,77 @@ pub fn render(frame: &mut Frame, state: &mut AppState) {
|
||||
render_status_bar(frame, state, main_chunks[2]);
|
||||
}
|
||||
|
||||
fn highlight_search_matches<'a>(text: &str, query: &str, search_typing: bool, is_selected: bool) -> Vec<Span<'a>> {
|
||||
let query_lower = query.to_lowercase();
|
||||
|
||||
let mut spans = Vec::new();
|
||||
let mut query_chars = query_lower.chars();
|
||||
let mut current_query_char = query_chars.next();
|
||||
let mut current_segment = String::new();
|
||||
|
||||
for ch in text.chars() {
|
||||
let ch_lower = ch.to_lowercase().next().unwrap();
|
||||
|
||||
if let Some(query_ch) = current_query_char {
|
||||
if ch_lower == query_ch {
|
||||
// Found a match - flush current segment
|
||||
if !current_segment.is_empty() {
|
||||
spans.push(Span::raw(current_segment.clone()));
|
||||
current_segment.clear();
|
||||
}
|
||||
// Add matched character with styling based on mode
|
||||
if search_typing && is_selected {
|
||||
// While typing on selected row: green bg with black fg (inverted)
|
||||
spans.push(Span::styled(
|
||||
ch.to_string(),
|
||||
Style::default()
|
||||
.fg(Theme::background())
|
||||
.bg(Theme::success()),
|
||||
));
|
||||
} else if !search_typing && is_selected {
|
||||
// After Enter on selected row: bold black text on blue selection bar
|
||||
spans.push(Span::styled(
|
||||
ch.to_string(),
|
||||
Style::default()
|
||||
.fg(Theme::background())
|
||||
.add_modifier(Modifier::BOLD),
|
||||
));
|
||||
} else {
|
||||
// Other rows: just green text
|
||||
spans.push(Span::styled(
|
||||
ch.to_string(),
|
||||
Style::default().fg(Theme::success()),
|
||||
));
|
||||
}
|
||||
// Move to next query character
|
||||
current_query_char = query_chars.next();
|
||||
} else {
|
||||
// No match - add to current segment
|
||||
current_segment.push(ch);
|
||||
}
|
||||
} else {
|
||||
// No more query characters to match
|
||||
current_segment.push(ch);
|
||||
}
|
||||
}
|
||||
|
||||
// Flush remaining segment
|
||||
if !current_segment.is_empty() {
|
||||
spans.push(Span::raw(current_segment));
|
||||
}
|
||||
|
||||
spans
|
||||
}
|
||||
|
||||
fn render_file_panel(frame: &mut Frame, state: &mut AppState, area: Rect) {
|
||||
// Calculate visible height (subtract 2 for borders)
|
||||
let visible_height = area.height.saturating_sub(2) as usize;
|
||||
state.update_scroll_offset(visible_height);
|
||||
|
||||
let in_search = state.search_mode || !state.search_matches.is_empty();
|
||||
let search_typing = state.search_mode; // True when actively typing search
|
||||
let search_query = if in_search { state.search_query.to_lowercase() } else { String::new() };
|
||||
|
||||
let items: Vec<ListItem> = state
|
||||
.flattened_items
|
||||
.iter()
|
||||
@@ -51,20 +117,56 @@ fn render_file_panel(frame: &mut Frame, state: &mut AppState, area: Rect) {
|
||||
.map(|(idx, item)| {
|
||||
let indent = " ".repeat(item.depth);
|
||||
let mark = if state.marked_files.contains(&item.node.path) { "* " } else { "" };
|
||||
let suffix = if item.node.is_dir { "/" } else { "" };
|
||||
let text = format!("{}{}{}{}", indent, mark, item.node.name, suffix);
|
||||
|
||||
let style = if idx == state.selected_index {
|
||||
// Build name with search highlighting
|
||||
let is_selected = idx == state.selected_index;
|
||||
|
||||
// Add folder icon for directories
|
||||
let icon = if item.node.is_dir {
|
||||
// Bold black icon on selection bar, blue otherwise
|
||||
if !search_typing && is_selected {
|
||||
Span::styled("▸ ", Style::default().fg(Theme::background()).add_modifier(Modifier::BOLD))
|
||||
} else {
|
||||
Span::styled("▸ ", Style::default().fg(Theme::highlight()))
|
||||
}
|
||||
} else {
|
||||
Span::raw(" ")
|
||||
};
|
||||
let name_spans = if in_search && !search_query.is_empty() {
|
||||
highlight_search_matches(&item.node.name, &search_query, search_typing, is_selected)
|
||||
} else {
|
||||
vec![Span::raw(&item.node.name)]
|
||||
};
|
||||
|
||||
let suffix = if item.node.is_dir { "/" } else { "" };
|
||||
|
||||
let base_style = if search_typing {
|
||||
// While typing search: no selection bar, just normal colors
|
||||
if state.marked_files.contains(&item.node.path) {
|
||||
Theme::marked()
|
||||
} else {
|
||||
Theme::secondary()
|
||||
}
|
||||
} else if is_selected {
|
||||
// After pressing Enter or normal mode: normal blue selection bar
|
||||
Theme::selected()
|
||||
} else if item.node.is_dir {
|
||||
Theme::directory()
|
||||
} else if state.marked_files.contains(&item.node.path) {
|
||||
Theme::marked()
|
||||
} else {
|
||||
Theme::secondary()
|
||||
};
|
||||
|
||||
ListItem::new(text).style(style)
|
||||
let mut line_spans = vec![
|
||||
Span::raw(indent),
|
||||
Span::raw(mark),
|
||||
icon,
|
||||
];
|
||||
line_spans.extend(name_spans);
|
||||
line_spans.push(Span::raw(suffix));
|
||||
|
||||
let line = Line::from(line_spans);
|
||||
|
||||
ListItem::new(line).style(base_style)
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -78,7 +180,11 @@ fn render_file_panel(frame: &mut Frame, state: &mut AppState, area: Rect) {
|
||||
);
|
||||
|
||||
let mut list_state = ListState::default();
|
||||
list_state.select(Some(state.selected_index));
|
||||
// Don't show selection bar widget while typing search - we use inverted colors instead
|
||||
// Show it in normal mode and after executing search (Enter)
|
||||
if !search_typing {
|
||||
list_state.select(Some(state.selected_index));
|
||||
}
|
||||
*list_state.offset_mut() = state.scroll_offset;
|
||||
frame.render_stateful_widget(list, area, &mut list_state);
|
||||
}
|
||||
@@ -95,8 +201,12 @@ fn render_right_panel(frame: &mut Frame, state: &AppState, area: Rect) {
|
||||
.map(|n| n.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|| path.to_string_lossy().to_string());
|
||||
|
||||
let style = if idx == state.playlist_index && state.player_state != PlayerState::Stopped {
|
||||
Theme::selected()
|
||||
let style = if idx == state.playlist_index {
|
||||
// Current file: white bold
|
||||
Style::default()
|
||||
.fg(Theme::bright_foreground())
|
||||
.bg(Theme::background())
|
||||
.add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Theme::secondary()
|
||||
};
|
||||
@@ -121,14 +231,16 @@ fn render_right_panel(frame: &mut Frame, state: &AppState, area: Rect) {
|
||||
);
|
||||
|
||||
let mut playlist_state = ListState::default();
|
||||
if state.player_state != PlayerState::Stopped && !state.playlist.is_empty() {
|
||||
playlist_state.select(Some(state.playlist_index));
|
||||
}
|
||||
// Don't set selection - use bold text instead
|
||||
frame.render_stateful_widget(playlist_widget, area, &mut playlist_state);
|
||||
}
|
||||
|
||||
fn render_title_bar(frame: &mut Frame, state: &AppState, area: Rect) {
|
||||
let background_color = Theme::success(); // Green for normal operation
|
||||
let background_color = match state.player_state {
|
||||
PlayerState::Playing => Theme::success(), // Green for playing
|
||||
PlayerState::Paused => Theme::highlight(), // Blue for paused
|
||||
PlayerState::Stopped => Theme::dim_foreground(), // Gray for stopped
|
||||
};
|
||||
|
||||
// Split the title bar into left and right sections
|
||||
let chunks = Layout::default()
|
||||
@@ -205,29 +317,11 @@ fn render_title_bar(frame: &mut Frame, state: &AppState, area: Rect) {
|
||||
|
||||
// Volume
|
||||
right_spans.push(Span::styled(
|
||||
format!(" • Vol: {}%", state.volume),
|
||||
format!(" • Vol: {}% ", state.volume),
|
||||
Style::default()
|
||||
.fg(Theme::background())
|
||||
.bg(background_color)
|
||||
));
|
||||
|
||||
// Add search info if active
|
||||
if !state.search_matches.is_empty() {
|
||||
right_spans.push(Span::styled(
|
||||
format!(" • Search: {}/{} ", state.search_match_index + 1, state.search_matches.len()),
|
||||
Style::default()
|
||||
.fg(Theme::background())
|
||||
.bg(background_color)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
));
|
||||
} else {
|
||||
right_spans.push(Span::styled(
|
||||
" ",
|
||||
Style::default()
|
||||
.fg(Theme::background())
|
||||
.bg(background_color)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
let right_title = Paragraph::new(Line::from(right_spans))
|
||||
@@ -249,9 +343,21 @@ fn render_status_bar(frame: &mut Frame, state: &AppState, area: Rect) {
|
||||
let status_bar = Paragraph::new(search_text)
|
||||
.style(Style::default().fg(Theme::foreground()).bg(Theme::background()));
|
||||
frame.render_widget(status_bar, area);
|
||||
} else if !state.search_matches.is_empty() {
|
||||
// Show search navigation when search results are active
|
||||
let search_text = format!("Search: {}/{} • n: Next • N: Prev • Esc: Clear", state.search_match_index + 1, state.search_matches.len());
|
||||
let status_bar = Paragraph::new(search_text)
|
||||
.style(Style::default().fg(Theme::foreground()).bg(Theme::background()));
|
||||
frame.render_widget(status_bar, area);
|
||||
} else if state.visual_mode {
|
||||
// Show visual mode indicator
|
||||
let visual_text = format!("-- VISUAL -- {} files marked", state.marked_files.len());
|
||||
let status_bar = Paragraph::new(visual_text)
|
||||
.style(Style::default().fg(Theme::foreground()).bg(Theme::background()));
|
||||
frame.render_widget(status_bar, area);
|
||||
} else {
|
||||
// Normal mode shortcuts (always shown when not in search mode)
|
||||
let shortcuts = "/: Search • v: Mark • a: Add • c: Clear • Enter: Play • Space: Pause • s: Stop • ←→: Seek • +/-: Vol • n/p: Next/Prev • r: Rescan • q: Quit";
|
||||
// Normal mode shortcuts (always shown when not in search or visual mode)
|
||||
let shortcuts = "a: Add • c: Clear • Enter: Play • Space: Pause • s: Stop • +/-: Vol • r: Rescan";
|
||||
let status_bar = Paragraph::new(shortcuts)
|
||||
.style(Style::default().fg(Theme::muted_text()).bg(Theme::background()))
|
||||
.alignment(Alignment::Center);
|
||||
|
||||
@@ -86,12 +86,6 @@ impl Theme {
|
||||
.bg(Self::highlight())
|
||||
}
|
||||
|
||||
pub fn directory() -> Style {
|
||||
Style::default()
|
||||
.fg(Self::normal_blue())
|
||||
.bg(Self::background())
|
||||
}
|
||||
|
||||
pub fn marked() -> Style {
|
||||
Style::default()
|
||||
.fg(Self::warning())
|
||||
|
||||
Reference in New Issue
Block a user