diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-10-25 13:42:14 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-10-25 13:42:14 +0200 |
| commit | 965dbc37dbb218f1fdc95b35798a6e8b04cd5c45 (patch) | |
| tree | 77d672aa1bc1a87100695ad15ecb2ca305acb235 | |
| parent | 68a2612c8b737f6770a4d23848fe6409ddce7888 (diff) | |
| download | dotfiles-965dbc37dbb218f1fdc95b35798a6e8b04cd5c45.tar.gz dotfiles-965dbc37dbb218f1fdc95b35798a6e8b04cd5c45.zip | |
Track recent books for neovim
| -rwxr-xr-x | track-books.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/track-books.sh b/track-books.sh new file mode 100755 index 0000000..4a828e0 --- /dev/null +++ b/track-books.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +books_directory="$HOME/documents/books" +recent_books_file="$HOME/.config/nvim/tmp/recent_books.txt" + +inotifywait -m -e CREATE -e OPEN -r "$books_directory" | +while read -r path action file; do + if [[ $file == *.pdf ]]; then + echo "$path/$file" >>"$recent_books_file" + # Remove duplicates and overwrite the recent_books_file + sort -u -o "$recent_books_file" "$recent_books_file" + fi +done |
