HAZELNUT(1)

NAME

hazelnut โ€” ๐ŸŒฐ Terminal-based automated file organizer inspired by Hazel. Watch folders and organize files with rules.

SYNOPSIS

$brew install ricardodantas/tap/hazelnut

INFO

221 stars
8 forks
0 views

DESCRIPTION

๐ŸŒฐ Terminal-based automated file organizer inspired by Hazel. Watch folders and organize files with rules.

README

Hazelnut Dashboard

๐ŸŒฐ Hazelnut

A terminal-based automated file organizer inspired by Hazel

Watch your folders and automatically organize files based on rules you define โ€” all from your terminal.

Release Crates.io CI License Rust Version


๐Ÿ“– Table of Contents


โœจ Features

๐Ÿ“ Smart File Watching

Watch any folder for new and changed files with configurable debouncing and recursive monitoring. Paths support ~, $VAR, and ${VAR} expansion.

๐ŸŽฏ Flexible Rules Engine

Define powerful rules with conditions based on name, extension, size, age, and more. Multiple rules can match the same file โ€” all matching rules execute in order.

โšก Powerful Actions

Move, copy, rename, delete, archive files or directories, send to trash, or run custom scripts โ€” all automated. Cross-filesystem moves are handled transparently.

๐Ÿ–ฅ๏ธ Beautiful TUI

A gorgeous terminal interface for managing rules and monitoring activity in real-time.

๐Ÿ”ง Background Daemon

Set it and forget it โ€” the daemon runs quietly and applies rules 24/7.

๐Ÿ“ Simple Configuration

Human-readable TOML config that's easy to write and maintain.


Feature Highlights

FeatureDescription
๐Ÿ” Pattern MatchingGlob patterns and regex for precise file matching
๐Ÿ“Š Size ConditionsFilter files by size (greater than, less than)
๐Ÿ“… Age ConditionsMatch files by modification date
๐Ÿท๏ธ Multiple ExtensionsMatch any of multiple file types
๐Ÿ“‚ Recursive WatchingMonitor subdirectories automatically
๐ŸŽจ 15 Built-in ThemesFrom Dracula to Cyberpunk
๐Ÿ”” Desktop NotificationsGet alerted on errors (cross-platform)
๐Ÿ“‹ Activity LogFull history of all file operations

๐Ÿš€ Quick Start

Installation

macOS

# Homebrew (recommended - fast, pre-built binary)
brew install ricardodantas/tap/hazelnut

Linux

# Homebrew
brew install ricardodantas/tap/hazelnut

Or via Cargo

cargo install hazelnut

Arch Linux (pacman)
pacman -S hazelnut

Windows

# Via Cargo (requires Rust toolchain)
cargo install hazelnut

Or download pre-built binary from GitHub Releases:

https://github.com/ricardodantas/hazelnut/releases

From Source

git clone https://github.com/ricardodantas/hazelnut
cd hazelnut
cargo install --path .

Note: The daemon (hazelnutd) is only available on macOS and Linux. On Windows, only the TUI (hazelnut) is available.

First Run

Hazelnut needs two things to work:

  1. Watch folders โ€” which directories to monitor
  2. Rules โ€” what to do with files in those folders

โš ๏ธ Important: Rules alone won't do anything! You must also configure at least one watch folder.

  1. Create a config file at ~/.config/hazelnut/config.toml:
# โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
# STEP 1: Define which folders to watch
# โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
[[watch]]
path = "/home/youruser/Downloads"  # Full path, ~, $HOME all work
recursive = false                   # Set true to include subfolders

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

STEP 2: Define rules for what to do with files

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

[[rule]] name = "Organize PDFs"

[rule.condition] extension = "pdf"

[rule.action] type = "move" destination = "/home/youruser/Documents/PDFs"

  1. Launch the TUI to manage and monitor:
hazelnut
  1. Or start the daemon to run in the background:
hazelnutd start

Rules View


โš™๏ธ Configuration

Hazelnut uses TOML for configuration. The config file is always located at:

~/.config/hazelnut/config.toml

Full Configuration Example

# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# General Settings
# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

[general]

Logging level: trace, debug, info, warn, error

log_level = "info"

Optional log file path

log_file = "~/.local/share/hazelnut/hazelnut.log"

Wait time (seconds) before processing a file after change detected

debounce_seconds = 2

How often to check for file changes (seconds)

polling_interval_secs = 5

Desktop notifications on errors (cross-platform)

notifications_enabled = true

Theme for the TUI

theme = "catppuccin-mocha"

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Watch Folders

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

[[watch]] path = "~/Downloads" recursive = false

[[watch]] path = "~/Desktop" recursive = false

Only apply specific rules to this folder

rules = ["screenshots", "temp-files"]

[[watch]] path = "~/Documents/Inbox" recursive = true # Watch subdirectories too

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Rules

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

[[rule]] name = "Organize PDFs" enabled = true stop_processing = false # Continue checking other rules

[rule.condition] extension = "pdf"

[rule.action] type = "move" destination = "~/Documents/PDFs" create_destination = true overwrite = false

[[rule]] name = "Screenshots" enabled = true

[rule.condition] name_matches = "Screenshot*.png"

[rule.action] type = "move" destination = "~/Pictures/Screenshots"

[[rule]] name = "Clean Old Downloads" enabled = true

[rule.condition] age_days_greater_than = 30 extensions = ["tmp", "log", "bak"]

[rule.action] type = "trash"

See docs/configuration.md for the complete reference.

Watch Editor (TUI)

You can manage watch folders directly in the TUI:

  1. Add a new watch: Press a or n in the Watches view
  2. Edit an existing watch: Select a watch and press e
  3. Delete a watch: Select a watch and press d

The watch editor dialog allows you to configure:

  • Path - Path to the folder to watch (supports ~, $VAR, ${VAR}, or absolute paths)
  • Recursive - Whether to include subdirectories

Use Tab to move between fields, Enter to save, and Esc to cancel.


๐Ÿ“‹ Rules

Rules are the heart of Hazelnut. Each rule has a condition (what files to match) and an action (what to do with them).

Conditions

All conditions in a rule must match for the rule to apply.

File Name

[rule.condition]
# Glob pattern matching
name_matches = "Screenshot*.png"

Regex pattern matching

name_regex = "^invoice_\d{4}\.pdf$"

File Extension

[rule.condition]
# Single extension
extension = "pdf"

Multiple extensions (match any)

extensions = ["jpg", "jpeg", "png", "gif", "webp"]

File Size

[rule.condition]
# Size in bytes
size_greater_than = 10485760  # > 10 MB
size_less_than = 1048576      # < 1 MB

File Age

[rule.condition]
# Age in days (based on modification time)
age_days_greater_than = 30  # Older than 30 days
age_days_less_than = 7      # Newer than 7 days

File Type

[rule.condition]
is_directory = false  # Match only files
is_hidden = true      # Match hidden files (starting with .)

Actions

Move

[rule.action]
type = "move"
destination = "~/Documents/Archive"
create_destination = true  # Create folder if missing
overwrite = false          # Don't overwrite existing files

Copy

[rule.action]
type = "copy"
destination = "~/Backup"
create_destination = true
overwrite = false

Rename

[rule.action]
type = "rename"
pattern = "{date}_{name}.{ext}"

Available variables:

VariableDescriptionExample
{name}Filename without extensiondocument
{filename}Full filenamedocument.pdf
{ext}Extensionpdf (empty if none)
{path}Full path/home/user/document.pdf
{dir}Parent directory/home/user
{date}Current date2024-01-15
{datetime}Current datetime2024-01-15_14-30-00
{date:FORMAT}Custom format{date:%Y%m%d} โ†’ 20240115

Trash

[rule.action]
type = "trash"

Moves files to the system trash (recoverable).

Delete

[rule.action]
type = "delete"

โš ๏ธ Warning: This permanently deletes files!

Run Command

[rule.action]
type = "run"
command = "convert"
args = ["{path}", "-resize", "50%", "{dir}/{name}_small.{ext}"]

Archive

[rule.action]
type = "archive"
destination = "~/Archives"
delete_original = false

Rule Editor (TUI)

You can create and edit rules directly in the TUI without editing the config file:

  1. Create a new rule: Press n in the Rules view
  2. Edit an existing rule: Select a rule and press e
  3. Delete a rule: Select a rule and press d

The rule editor dialog allows you to configure:

  • Name - A descriptive name for your rule
  • Enabled - Toggle the rule on/off
  • Conditions - Extension, name patterns (glob/regex), size limits, age limits, is_directory, is_hidden
  • Action - Move, Copy, Rename, Trash, Delete, Run Command, or Archive

Use Tab to move between fields, Enter to save, and Esc to cancel.

๐Ÿ’ก Remember: Rules only apply to files in watched folders. Make sure you've configured at least one [[watch]] entry in your config, or add one via the Watches view.

Example Rules

๐Ÿ“ธ Organize Screenshots
[[rule]]
name = "Screenshots to folder"

[rule.condition]
name_matches = "Screenshot*.png"

[rule.action]
type = "move"
destination = "~/Pictures/Screenshots"
๐Ÿ“„ Sort Documents by Type
[[rule]]
name = "PDFs to Documents"

[rule.condition]
extension = "pdf"

[rule.action]
type = "move"
destination = "~/Documents/PDFs"

[[rule]]
name = "Spreadsheets to Documents"

[rule.condition]
extensions = ["xlsx", "xls", "csv"]

[rule.action]
type = "move"
destination = "~/Documents/Spreadsheets"
๐Ÿ—‘๏ธ Clean Old Files
[[rule]]
name = "Delete old temp files"

[rule.condition]
age_days_greater_than = 30
extensions = ["tmp", "log", "bak"]

[rule.action]
type = "trash"
๐Ÿ“… Date-Prefix Invoices
[[rule]]
name = "Prefix invoices with date"

[rule.condition]
name_regex = "^invoice.*\\.pdf$"

[rule.action]
type = "rename"
pattern = "{date:YYYY-MM-DD}_{filename}"
๐Ÿ–ผ๏ธ Compress Large Images
[[rule]]
name = "Compress large images"

[rule.condition]
extensions = ["jpg", "png"]
size_greater_than = 5242880  # > 5 MB

[rule.action]
type = "run"
command = "convert"
args = ["{path}", "-quality", "80", "{path}"]

โŒจ๏ธ Keybindings

Global

KeyAction
TabNext view
Shift+TabPrevious view
1 2 3 4Jump to view (Dashboard, Rules, Watches, Log)
sOpen settings
tOpen theme picker
AAbout Hazelnut
? / F1Show help
qQuit (from Dashboard)
Ctrl+c / Ctrl+qForce quit

Navigation

KeyAction
โ†‘ / kMove up
โ†“ / jMove down
g / HomeGo to first item
G / EndGo to last item
PageUpPage up
PageDownPage down

Rules View

KeyAction
Enter / SpaceToggle rule enabled/disabled
eEdit selected rule
nCreate new rule
d / DeleteDelete selected rule

Watches View

KeyAction
a / nAdd new watch folder
eEdit selected watch
d / DeleteDelete selected watch
o / EnterOpen folder

Log View

KeyAction
cClear log

Theme Picker

KeyAction
โ†‘ / kPrevious theme (with live preview)
โ†“ / jNext theme (with live preview)
EnterApply selected theme
EscCancel

Help Screen


๐ŸŽจ Themes

Hazelnut includes 15 beautiful themes based on popular terminal and editor color schemes.

Press t in the TUI to open the theme picker with live preview.

Theme Picker

Available Themes

ThemeDescription
๐Ÿฆ‡ DraculaDark purple aesthetic (default)
๐ŸŒ™ One Dark ProAtom's iconic dark theme
โ„๏ธ NordArctic, bluish color palette
๐Ÿฑ Catppuccin MochaWarm pastel dark theme
โ˜• Catppuccin LatteWarm pastel light theme
๐ŸŽธ Gruvbox DarkRetro groove colors
๐Ÿ“œ Gruvbox LightRetro groove, light variant
๐ŸŒƒ Tokyo NightFuturistic dark blue
๐ŸŒ… Solarized DarkPrecision colors, dark
๐ŸŒž Solarized LightPrecision colors, light
๐ŸŽจ Monokai ProClassic syntax highlighting
๐ŸŒน Rosรฉ PineAll natural pine with soho vibes
๐ŸŒŠ KanagawaInspired by Katsushika Hokusai
๐ŸŒฒ EverforestComfortable green forest theme
๐ŸŒ† CyberpunkNeon-soaked futuristic theme

Cyberpunk Theme


๐Ÿ—๏ธ Architecture

Hazelnut consists of two binaries that work together:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         User                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                       hazelnut (TUI)                            โ”‚
โ”‚  โ€ข Manage rules                                             โ”‚
โ”‚  โ€ข Monitor activity                                         โ”‚
โ”‚  โ€ข Change themes                                            โ”‚
โ”‚  โ€ข View logs                                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                         Unix Socket
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     hazelnutd (Daemon)                          โ”‚
โ”‚  โ€ข Watch folders                                            โ”‚
โ”‚  โ€ข Evaluate rules                                           โ”‚
โ”‚  โ€ข Execute actions                                          โ”‚
โ”‚  โ€ข Run 24/7 in background                                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      File System                            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

hazelnut โ€” The TUI

Interactive terminal interface for:

  • Viewing and managing rules
  • Monitoring watch folders
  • Viewing activity logs
  • Changing themes
  • Sending commands to the daemon
hazelnut              # Launch TUI
hazelnut list         # List all rules
hazelnut check        # Validate config
hazelnut run          # Run rules once (dry-run)
hazelnut run --apply  # Run rules once (for real)
hazelnut status       # Check daemon status

hazelnutd โ€” The Daemon

Background service that does the actual work:

hazelnutd start      # Start daemon (background)
hazelnutd stop       # Stop daemon
hazelnutd restart    # Restart daemon
hazelnutd status     # Show daemon status
hazelnutd reload     # Reload configuration (hot-reload, no restart)
hazelnutd run        # Run in foreground (for debugging)

Daemon Commands

CommandDescription
startStart daemon in background, detached from terminal
stopGracefully stop the daemon (SIGTERM)
restartStop and start the daemon
statusShow running state, PID, uptime, and log location
reloadHot-reload config via SIGHUP (no restart needed)
runRun in foreground with live logging (for debugging)

Status Output

$ hazelnutd status
๐ŸŒฐ Hazelnut daemon is running
   PID: 12345
   PID file: ~/.local/state/hazelnut/hazelnutd.pid
   Log file: ~/.local/state/hazelnut/hazelnutd.log
   Uptime: 2h 15m 30s

File Locations

All files use consistent paths across Linux and macOS:

FilePathPurpose
Config~/.config/hazelnut/config.tomlRules and settings
PID file~/.local/state/hazelnut/hazelnutd.pidTracks running daemon
Log file~/.local/state/hazelnut/hazelnutd.logDaemon activity log

Typical Workflow

# 1. Edit your rules in the TUI or config file
hazelnut

2. Start the daemon

hazelnutd start

3. Check it's running

hazelnutd status

4. After editing rules, reload without restart

hazelnutd reload

5. View logs if needed

tail -f ~/.local/state/hazelnut/hazelnutd.log


๐Ÿ”ง Building from Source

Requirements

  • Rust 1.93+ (uses Edition 2024 features)
  • Linux or macOS

Build

# Clone the repository
git clone https://github.com/ricardodantas/hazelnut
cd hazelnut

Build release binary

cargo build --release

The binaries will be at:

- target/release/hazelnut

- target/release/hazelnutd

Or install directly

cargo install --path .

Development

# Run TUI in development
cargo run

Run daemon in foreground

cargo run --bin hazelnutd run

Run tests

cargo test

Run linter

cargo clippy

Format code

cargo fmt


๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Quick Start for Contributors

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests: cargo test
  5. Run clippy: cargo clippy
  6. Format: cargo fmt
  7. Commit: git commit -m "Add amazing feature"
  8. Push: git push origin feature/amazing-feature
  9. Open a Pull Request

Project Structure

hazelnut/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.rs          # TUI entry point
โ”‚   โ”œโ”€โ”€ daemon.rs        # Daemon entry point
โ”‚   โ”œโ”€โ”€ lib.rs           # Library root
โ”‚   โ”œโ”€โ”€ theme.rs         # Color themes
โ”‚   โ”œโ”€โ”€ app/             # TUI application
โ”‚   โ”‚   โ”œโ”€โ”€ events.rs    # Key event handling
โ”‚   โ”‚   โ”œโ”€โ”€ state.rs     # Application state
โ”‚   โ”‚   โ””โ”€โ”€ ui.rs        # UI rendering
โ”‚   โ”œโ”€โ”€ config/          # Configuration loading
โ”‚   โ”œโ”€โ”€ rules/           # Rule engine
โ”‚   โ”‚   โ”œโ”€โ”€ action.rs    # Rule actions
โ”‚   โ”‚   โ”œโ”€โ”€ condition.rs # Rule conditions
โ”‚   โ”‚   โ””โ”€โ”€ engine.rs    # Rule evaluation
โ”‚   โ”œโ”€โ”€ watcher/         # File system watcher
โ”‚   โ””โ”€โ”€ ipc/             # TUI-daemon communication
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ configuration.md # Full config reference
โ”œโ”€โ”€ screenshots/         # Screenshots for docs
โ””โ”€โ”€ tests/               # Integration tests

๐Ÿ“„ License

This project is licensed under the GPL-3.0-or-later license โ€” see the LICENSE file for details.


Built with ๐Ÿฆ€ Rust and โค๏ธ by Ricardo Dantas

SEE ALSO

clihub3/4/2026HAZELNUT(1)