# mu-fm (Micro Dual-Panel File Manager)

A lightweight, highly hackable dual-panel file manager written in Vala and GTK+ 3.

## 🎯 Project Philosophy & Goal

**This project is NOT intended to be a standard, feature-bloated file manager.** 

The core goal of `mu-fm` is to provide a ultra-minimalist, dual-panel file manager specifically tailored to **execute custom commands** and shell scripts on your files. 

Instead of adding complex internal systems for every possible file operation, `mu-fm` leaves the heavy lifting to your favorite terminal tools, utilities, and scripts via its built-in commands dropdown menu (`~/.mu-fm/commands.rc`).

### 🤖 Built for AI-Assisted Hacking (Gemini Companion)
The entire codebase is intentionally kept clean, split into small modular files, and completely free of complex abstractions or hidden dependencies. 

It is specifically designed so that **you can easily modify, extend, and adapt it to your exact personal needs with the help of Gemini** (or other AI assistants). Because the code is highly scannable and direct, you can paste small chunks to your AI companion, ask for a new feature (like a hotkey, a style change, or a new button), and inject it into your build within seconds.

---

## ✨ Features

- **Dual-Pane Layout:** Side-by-side file lists with persistent session memory (remembers your last closed directories).
- **Custom Commands Dropdown:** Read rules from `~/.mu-fm/commands.rc` (e.g., `edit=leafpad`) and run them instantly against selected files.
- **Dynamic Argument Substitution:** Supports the `SELECTED` keyword in commands to pass a file from the inactive pane as an argument to the active pane.
- **Drag-and-Drop Operations:** Native `text/uri-list` support to copy or move files between panes or directly into subfolders with safety confirmation prompts.
- **Instant Search Filters:** A live text filter box above each list panel to instantly search rows by name.
- **Inbuilt Editors:** Modify your main settings (`mu-fm.rc`) or your custom actions (`commands.rc`) inside the file manager with live hot-reloading.
- **Terminal Integration:** One-click button to spawn an `urxvt` terminal instance initialized exactly inside your active directory path.
- **Smart Sorting:** Group folders together first, and ensure hidden entries (leading dot `.`) are neatly sorted before standard items.

---

## 📁 File Structure

The project is split into clean modules to ensure easy maintenance and scannability:
- `manager.vala`: The main container window shell and UI layout wiring.
- `panel_layout.vala`: Abstract layout defining columns, entries, and statistics.
- `panel.vala`: Core filesystem enumeration, sorting algorithms, and drag-and-drop mechanics.
- `actions_handler.vala`: Handles file creation dialogs, background processing, and custom command interpolation.
- `commands_combo.vala`: Parses and updates the custom actions dropdown and the "Run" button.
- `editors_handler.vala`: Generates text editors for editing files within the app.
- `config_handler.vala`: Manages loading and saving state to `~/.mu-fm/mu-fm.rc`.
- `Makefile`: Straightforward build configuration rule script.

---

## 🛠️ Building and Running

### 1. Prerequisites
Ensure you have the Vala compiler and GTK+ 3 development headers installed on your system (e.g., Debian/Ubuntu):
```bash
sudo apt install valac libgtk-3-dev
```

### 2. Compile
Compile the application by running the build script configuration:
```bash
make
```

### 3. Run
Launch the compiled binary target:
```bash
./mini_filemanager
```

On your very first run, `mu-fm` will automatically create its configuration workspace directory under `~/.mu-fm/` and populate it with clean templates.

---

## ⚙️ Customization Example

To add a custom command, open the **Edit Commands** window inside the application, or edit `~/.mu-fm/commands.rc` manually. You can add placeholders like `SELECTED` (which expands to the file highlighted in your *other* panel):

```ini
compare=meld SELECTED
append-text=cat SELECTED >>
extract-to-here=tar -xf
```
When you click **Run**, a safe confirmation dialog will display the exact command syntax before it executes asynchronously in the background.