31 lines
709 B
Bash
Executable File
31 lines
709 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# 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
|
|
done
|
|
}
|
|
|
|
# Start monitoring in the background
|
|
|
|
monitor\_themes
|