1 Commits

Author SHA1 Message Date
a2c0ce3ec1 another gpt with inotifywait addition
seems to work....
2023-08-03 19:32:30 +02:00
2 changed files with 21 additions and 22 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: TROM <contact@tromsite.com> # Maintainer: TROM <contact@tromsite.com>
pkgname=tromjaro-fixes pkgname=tromjaro-fixes
pkgver=1.6 pkgver=1.6
pkgrel=1 pkgrel=0
pkgdesc="Various fixes for TROMjaro OS" pkgdesc="Various fixes for TROMjaro OS"
arch=(any) arch=(any)
url="" url=""

View File

@ -1,31 +1,30 @@
#!/bin/bash #!/bin/bash
# Set the directory paths # Set the directories
shared_themes_dir=/usr/share/themes/
home_local_themes_dir="$HOME/.local/share/themes/"
source_theme_dirs=("$shared_themes_dir" "$home_local_themes_dir")
target_themes_dir="$HOME/.themes"
shared_icons_dir=/usr/share/icons/ shared\_themes\_dir=/usr/share/themes/
home_local_icons_dir="$HOME/.local/share/icons/" local\_themes\_dir="$HOME/.themes/"
source_icon_dirs=("$shared_icons_dir" "$home_local_icons_dir")
target_icons_dir="$HOME/.icons"
# Function to synchronize themes and icons from source to target directory # Function to synchronize themes from shared to local directory
sync_themes_and_icons() {
rsync -av --delete --progress "${source_theme_dirs[@]}" "$target_themes_dir" sync\_themes() {
rsync -av --delete --progress "${source_icon_dirs[@]}" "$target_icons_dir" rsync -av --delete --progress "$shared\_themes\_dir" "$local\_themes\_dir"
echo "Directories $target_themes_dir and $target_icons_dir are synchronized with source directories" echo "Directory $local\_themes\_dir is synchronized with $shared\_themes\_dir"
} }
# Create the target and local directories if they don't exist # Initial synchronization
mkdir -p "$target_themes_dir" "$home_local_themes_dir" "$target_icons_dir" "$home_local_icons_dir" ||
{ echo "failed to make directories $target_themes_dir & $home_local_themes_dir & $target_icons_dir & $home_local_icons_dir"; exit 1; }
echo "Set watch for theme directories: ${source_theme_dirs[@]}, and icon directories: ${source_icon_dirs[@]}" sync\_themes
# Start watching for file changes in the source theme and icon directories # Function to monitor both shared and local themes directories
inotifywait -qmr -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "${source_theme_dirs[@]}" "${source_icon_dirs[@]}" |
monitor\_themes() {
inotifywait -m -r -e modify,attrib,move,move\_self,create,delete,delete\_self,unmount "$shared\_themes\_dir" "$local\_themes\_dir" |
while read -r events; do while read -r events; do
sync_themes_and_icons sync\_themes
done done
}
# Start monitoring in the background
monitor\_themes