3 Commits

Author SHA1 Message Date
bd11ec4837 add icon sync for flatpaks 2023-08-04 00:24:40 +02:00
b6f7ffccba Update PKGBUILD 2023-08-03 23:11:35 +02:00
3c16633482 improvements from roko 2023-08-03 23:09:23 +02:00
2 changed files with 23 additions and 29 deletions

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

@ -1,37 +1,31 @@
#!/bin/bash
# Set the directories
# Set the directory paths
shared_themes_dir=/usr/share/themes/
local_themes_dir="$HOME/.themes/"
home_local_themes_dir="$HOME/.local/share/themes/"
source_theme_dirs=("$shared_themes_dir" "$home_local_themes_dir")
target_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"
shared_icons_dir=/usr/share/icons/
home_local_icons_dir="$HOME/.local/share/icons/"
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
sync_themes_and_icons() {
rsync -av --delete --progress "${source_theme_dirs[@]}" "$target_themes_dir"
rsync -av --delete --progress "${source_icon_dirs[@]}" "$target_icons_dir"
echo "Directories $target_themes_dir and $target_icons_dir are synchronized with source directories"
}
# Initial synchronization
sync_themes
# Create the target and local directories if they don't exist
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; }
# Function to monitor shared themes directory
monitor_shared_themes() {
inotifywait -m -r -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "$shared_themes_dir" > /dev/null 2>&1 &
}
echo "Set watch for theme directories: ${source_theme_dirs[@]}, and icon directories: ${source_icon_dirs[@]}"
# Function to monitor local themes directory
monitor_local_themes() {
inotifywait -m -r -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "$local_themes_dir" > /dev/null 2>&1 &
}
# Start monitoring in the background
monitor_shared_themes
monitor_local_themes
# Monitor changes and sync periodically
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
# Start watching for file changes in the source theme and icon directories
inotifywait -qmr -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "${source_theme_dirs[@]}" "${source_icon_dirs[@]}" |
while read -r events; do
sync_themes_and_icons
done