FileWatcher is a simple Linux daemon that monitors file events using inotify and sends desktop notifications to the user. It can notify the user about file creations, deletions, accesses, writes and closes, modifications, and file movements.
- Monitors specified file or directory for various file events.
- Sends desktop notifications using libnotify on file events.
- Gracefully handles shutdown signals for proper cleanup.
- Linux system with inotify support.
- libnotify library for desktop notifications.
- Clone the repository or download the source code.
- Compile the code using a C compiler, for example:
gcc -o filewatcher filewatcher.c -linotify -lnotify
- Run the compiled binary with the path of the file or directory to monitor as an argument.
- Recommend : Use the makefile to build the daemon
./filewatcher /path/to/monitor
FileWatcher handles the following signals for proper cleanup:
- SIGABRT
- SIGINT
- SIGTERM
When any of these signals is received, the daemon will remove the file from the inotify watch, close the inotify descriptors, and uninitialize the libnotify library before exiting.
- inotify: Inotify system calls for monitoring file system events.
- libnotify: GNOME library for sending desktop notifications.
- ArchWiki - Desktop Notifications: ArchWiki page on desktop notifications for additional information.
Note: Ensure that you have the necessary permissions to access the files or directories being monitored. The daemon will display notifications for specified file events as they occur.