Expand description

Watch files using calloop.

This crate provides a wrapper around the notify crate to allow integration with the calloop event loop. To get started, just create a NotifySource and insert it into your event loop.


use std::path::Path;

use calloop::EventLoop;
use calloop_notify::notify::{RecursiveMode, Watcher};
use calloop_notify::NotifySource;

// Create calloop event loop.
let mut event_loop = EventLoop::try_new().unwrap();
let loop_handle = event_loop.handle();

// Watch current directory recursively.
let mut notify_source = NotifySource::new().unwrap();
notify_source.watch(Path::new("."), RecursiveMode::Recursive).unwrap();

// Insert notify source into calloop.
    .insert_source(notify_source, |event, _, _: &mut ()| {
        println!("Notify Event: {event:?}");

// Dispatch event loop.
loop {
    event_loop.dispatch(None, &mut ()).unwrap();


pub use notify;


Calloop event source for watching files.