8 Commits

3 changed files with 64 additions and 55 deletions

View File

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

View File

@@ -1,30 +0,0 @@
#!/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

View File

@@ -1,38 +1,77 @@
#!/bin/bash
# Exit out if the same script is already running in the background
pidof -sq -o %PPID -x "$(basename "$0")" && exit
# Set the directory paths
target_themes_dir="$HOME/.themes"
target_icons_dir="$HOME/.icons"
# Create target directories if they don't exist
mkdir -p "$target_themes_dir" "$target_icons_dir" ||
{ echo "failed to make directories $target_themes_dir & $target_icons_dir"; exit 1; }
sync_theme() {
# Get the current system theme
theme=$(xfconf-query -c xsettings -p /Net/ThemeName)
# Enable syncing the current theme with xfwm4 if not already enabled
[ "$(xfconf-query -c xsettings -p /Xfce/SyncThemes)" != 'true' ] && xfconf-query -c xsettings -p /Xfce/SyncThemes -n -t bool -s true
# Apply the current theme with gsettings
gsettings set org.gnome.desktop.interface gtk-theme "$theme"
# Get the current system theme
theme_name=$(xfconf-query -c xsettings -p /Net/ThemeName)
# Apply the current theme for GTK apps in flatpak
# Cleanup source & target themes directories
source_themes_dirs=()
rm -rf "$target_themes_dir"/*
# Define the path to the flatpak override directory
flatpak_override_dir="$HOME/.local/share/flatpak/overrides"
# Create the directory if it doesn't exist
[ -d "$flatpak_override_dir" ] || mkdir -p "$flatpak_override_dir" || { echo 'failed creating directory!'; return 1; }
# Write the theme configuration to the global override file
echo "[Environment]
GTK_THEME=$theme" > "$flatpak_override_dir/global"
# Go through each item in $XDG_DATA_DIRS to find all other directories where
# themes are stored, and save only the current one to source_themes_dirs
while read -r dir; do
themes_subdir=${dir%/}/themes/${theme_name}
[ -d "$themes_subdir" ] && source_themes_dirs+=("$themes_subdir")
done < <(printf '%s:%s\n' "$XDG_DATA_DIRS" "$HOME/.local/share" | tr ':' '\n' | sort -u)
rsync -av --delete --progress "${source_themes_dirs[@]}" "$target_themes_dir"
echo "Directory $target_themes_dir is synchronized with source directories"
# Enable syncing the current theme with xfwm4 if not already enabled
[ "$(xfconf-query -c xsettings -p /Xfce/SyncThemes)" != 'true' ] && xfconf-query -c xsettings -p /Xfce/SyncThemes -n -t bool -s true
# Apply the current theme with gsettings
gsettings set org.gnome.desktop.interface gtk-theme "$theme_name"
# Apply the current theme for the all the GTK flatpaks
flatpak override --user --env=GTK_THEME="$theme_name"
}
sync_icons() {
# Get the current icons theme
icons_theme_name=$(xfconf-query -c xsettings -p /Net/IconThemeName)
# Cleanup source & target themes directories
source_icons_dirs=()
rm -rf "$target_icons_dir"/*
# Go through each item in $XDG_DATA_DIRS to find all other directories where
# icons are stored, and save only the current one to source_icons_dirs
while read -r dir; do
icons_subdir=${dir%/}/icons/${icons_theme_name}
[ -d "$icons_subdir" ] && source_icons_dirs+=("$icons_subdir")
done < <(printf '%s:%s\n' "$XDG_DATA_DIRS" "$HOME/.local/share" | tr ':' '\n' | sort -u)
rsync -av --delete --progress "${source_icons_dirs[@]}" "$target_icons_dir"
echo "Directory $target_icons_dir is synchronized with source directories"
}
sync_font() {
# Get the current system font
font=$(xfconf-query -c xsettings -p /Gtk/FontName)
# Apply the same font for the title of xfce windows
xfconf-query -c xfwm4 -p /general/title_font -n -t string -s "$font"
# Get the current system font
font=$(xfconf-query -c xsettings -p /Gtk/FontName)
# Apply the same font for the title of xfce windows
xfconf-query -c xfwm4 -p /general/title_font -n -t string -s "$font"
}
sync_theme
sync_icons
sync_font
# Monitor when the user changes their system theme or font in XFCE and sync them as needed
while read -r line; do
case "$line" in
'set: /Net/ThemeName') sync_theme ;;
'set: /Gtk/FontName') sync_font ;;
esac
case "$line" in
'set: /Net/ThemeName') sync_theme ;;
'set: /Net/IconThemeName') sync_icons ;;
'set: /Gtk/FontName') sync_font ;;
esac
done < <(xfconf-query -c xsettings -m)