From 275a4eebe795a1660200263ecbe63a599035b847 Mon Sep 17 00:00:00 2001 From: rokosun Date: Mon, 19 Sep 2022 14:09:49 +0200 Subject: [PATCH] Listen for more specific events using inotifywait Also implemented some changes suggested by [Shellcheck](https://github.com/koalaman/shellcheck) --- bin/periodic/fix-flatpaks-theming | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/periodic/fix-flatpaks-theming b/bin/periodic/fix-flatpaks-theming index d87dad6..fbd0f68 100755 --- a/bin/periodic/fix-flatpaks-theming +++ b/bin/periodic/fix-flatpaks-theming @@ -1,16 +1,16 @@ -#!/bin/sh +#!/bin/bash shared_themes_dir=/usr/share/themes/ home_local_themes_dir="$HOME/.local/share/themes/" -source_theme_dirs="$shared_themes_dir $home_local_themes_dir" +source_theme_dirs=("$shared_themes_dir" "$home_local_themes_dir") target_themes_dir="$HOME/.themes" -if [ ! -e $home_local_themes_dir ]; then - mkdir -p $home_local_themes_dir +if [ ! -e "$home_local_themes_dir" ]; then + mkdir -p "$home_local_themes_dir" echo "Directory $home_local_themes_dir is created." fi -echo "Set watch for $source_theme_dirs directories ..." -while inotifywait -r $source_theme_dirs; do - rsync -av --delete --progress $source_theme_dirs $target_themes_dir - echo "Directory $target_themes_dir is synchronized with $source_theme_dirs." -done +echo "Set watch for" "${source_theme_dirs[@]}" "directories ..." +while inotifywait -qr -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "${source_theme_dirs[@]}"; do + rsync -av --delete --progress "${source_theme_dirs[@]}" "$target_themes_dir" + echo "Directory $target_themes_dir is synchronized with" "${source_theme_dirs[@]}" +done \ No newline at end of file -- 2.30.2