2022-09-19 12:09:49 +00:00
|
|
|
#!/bin/bash
|
2023-08-03 17:32:30 +00:00
|
|
|
|
|
|
|
# Set the directories
|
|
|
|
|
|
|
|
shared\_themes\_dir=/usr/share/themes/
|
|
|
|
local\_themes\_dir="$HOME/.themes/"
|
|
|
|
|
|
|
|
# Function to synchronize themes from shared to local directory
|
|
|
|
|
|
|
|
sync\_themes() {
|
|
|
|
rsync -av --delete --progress "$shared\_themes\_dir" "$local\_themes\_dir"
|
|
|
|
echo "Directory $local\_themes\_dir is synchronized with $shared\_themes\_dir"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Initial synchronization
|
|
|
|
|
|
|
|
sync\_themes
|
|
|
|
|
|
|
|
# Function to monitor both shared and local themes directories
|
|
|
|
|
|
|
|
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
|
|
|
|
sync\_themes
|
2022-10-01 16:30:00 +00:00
|
|
|
done
|
2023-08-03 17:32:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Start monitoring in the background
|
|
|
|
|
|
|
|
monitor\_themes
|