Compare commits
1 Commits
tio-patch-
...
tio-patch-
Author | SHA1 | Date | |
---|---|---|---|
a2c0ce3ec1 |
@@ -1,37 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Set the directories
|
# Set the directories
|
||||||
shared_themes_dir=/usr/share/themes/
|
|
||||||
local_themes_dir="$HOME/.themes/"
|
shared\_themes\_dir=/usr/share/themes/
|
||||||
|
local\_themes\_dir="$HOME/.themes/"
|
||||||
|
|
||||||
# Function to synchronize themes from shared to local directory
|
# Function to synchronize themes from shared to local directory
|
||||||
sync_themes() {
|
|
||||||
rsync -av --delete --progress "$shared_themes_dir" "$local_themes_dir"
|
sync\_themes() {
|
||||||
echo "Directory $local_themes_dir is synchronized with $shared_themes_dir"
|
rsync -av --delete --progress "$shared\_themes\_dir" "$local\_themes\_dir"
|
||||||
|
echo "Directory $local\_themes\_dir is synchronized with $shared\_themes\_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initial synchronization
|
# Initial synchronization
|
||||||
sync_themes
|
|
||||||
|
|
||||||
# Function to monitor shared themes directory
|
sync\_themes
|
||||||
monitor_shared_themes() {
|
|
||||||
inotifywait -m -r -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "$shared_themes_dir" > /dev/null 2>&1 &
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to monitor local themes directory
|
# Function to monitor both shared and local themes directories
|
||||||
monitor_local_themes() {
|
|
||||||
inotifywait -m -r -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "$local_themes_dir" > /dev/null 2>&1 &
|
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
|
# Start monitoring in the background
|
||||||
monitor_shared_themes
|
|
||||||
monitor_local_themes
|
|
||||||
|
|
||||||
# Monitor changes and sync periodically
|
monitor\_themes
|
||||||
while true; do
|
|
||||||
# Wait for a short period (e.g., 5 seconds) before syncing again
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Synchronize if there were changes in either directory
|
|
||||||
sync_themes
|
|
||||||
done
|
|
||||||
|
Reference in New Issue
Block a user