Compare commits
3 Commits
tio-patch-
...
d3cddde72f
Author | SHA1 | Date | |
---|---|---|---|
d3cddde72f | |||
d63a3ccf33 | |||
4811e675d8 |
2
PKGBUILD
2
PKGBUILD
@@ -1,7 +1,7 @@
|
|||||||
# Maintainer: TROM <contact@tromsite.com>
|
# Maintainer: TROM <contact@tromsite.com>
|
||||||
pkgname=tromjaro-fixes
|
pkgname=tromjaro-fixes
|
||||||
pkgver=1.6
|
pkgver=1.6
|
||||||
pkgrel=1
|
pkgrel=2
|
||||||
pkgdesc="Various fixes for TROMjaro OS"
|
pkgdesc="Various fixes for TROMjaro OS"
|
||||||
arch=(any)
|
arch=(any)
|
||||||
url=""
|
url=""
|
||||||
|
@@ -1,31 +1,44 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Set the directory paths
|
# Exit out if the same script is already running in the background
|
||||||
shared_themes_dir=/usr/share/themes/
|
pidof -sq -o %PPID -x "$(basename "$0")" && exit
|
||||||
home_local_themes_dir="$HOME/.local/share/themes/"
|
|
||||||
source_theme_dirs=("$shared_themes_dir" "$home_local_themes_dir")
|
|
||||||
target_themes_dir="$HOME/.themes"
|
|
||||||
|
|
||||||
shared_icons_dir=/usr/share/icons/
|
# Set the directory paths
|
||||||
home_local_icons_dir="$HOME/.local/share/icons/"
|
|
||||||
source_icon_dirs=("$shared_icons_dir" "$home_local_icons_dir")
|
target_themes_dir="$HOME/.themes"
|
||||||
target_icons_dir="$HOME/.icons"
|
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; }
|
||||||
|
|
||||||
|
# Go through each item in $XDG_DATA_DIRS to find all other directories where
|
||||||
|
# themes & icons are stored, and save these to source_themes_dirs & source_icons_dirs respectively
|
||||||
|
while read -r dir; do
|
||||||
|
themes_subdir=${dir%/}/themes
|
||||||
|
icons_subdir=${dir%/}/icons
|
||||||
|
# Directories inside user's home directory will be created if nonexistant
|
||||||
|
for subdir in $themes_subdir $icons_subdir; do
|
||||||
|
[[ "$subdir" = "$HOME"/* ]] && mkdir -p "$subdir"
|
||||||
|
done
|
||||||
|
[ -d "$themes_subdir" ] && source_themes_dirs+=("$themes_subdir/")
|
||||||
|
[ -d "$icons_subdir" ] && source_icons_dirs+=("$icons_subdir/")
|
||||||
|
done < <(printf '%s:%s\n' "$XDG_DATA_DIRS" "$HOME/.local/share" | tr ':' '\n' | sort -u)
|
||||||
|
|
||||||
# Function to synchronize themes and icons from source to target directory
|
# Function to synchronize themes and icons from source to target directory
|
||||||
sync_themes_and_icons() {
|
sync_themes_and_icons() {
|
||||||
rsync -av --delete --progress "${source_theme_dirs[@]}" "$target_themes_dir"
|
rsync -av --delete --progress "${source_themes_dirs[@]}" "$target_themes_dir"
|
||||||
rsync -av --delete --progress "${source_icon_dirs[@]}" "$target_icons_dir"
|
rsync -av --delete --progress "${source_icons_dirs[@]}" "$target_icons_dir"
|
||||||
echo "Directories $target_themes_dir and $target_icons_dir are synchronized with source directories"
|
echo "Directories $target_themes_dir and $target_icons_dir are synchronized with source directories"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create the target and local directories if they don't exist
|
# Initial synchronization
|
||||||
mkdir -p "$target_themes_dir" "$home_local_themes_dir" "$target_icons_dir" "$home_local_icons_dir" ||
|
sync_themes_and_icons
|
||||||
{ echo "failed to make directories $target_themes_dir & $home_local_themes_dir & $target_icons_dir & $home_local_icons_dir"; exit 1; }
|
|
||||||
|
|
||||||
echo "Set watch for theme directories: ${source_theme_dirs[@]}, and icon directories: ${source_icon_dirs[@]}"
|
echo "Set watch for theme directories:" "${source_themes_dirs[@]}" ", and icon directories:" "${source_icons_dirs[@]}"
|
||||||
|
|
||||||
# Start watching for file changes in the source theme and icon directories
|
# 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[@]}" |
|
inotifywait -qmr -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "${source_themes_dirs[@]}" "${source_icons_dirs[@]}" |
|
||||||
while read -r events; do
|
while read -r _; do
|
||||||
sync_themes_and_icons
|
sync_themes_and_icons
|
||||||
done
|
done
|
||||||
|
@@ -7,16 +7,8 @@ sync_theme() {
|
|||||||
[ "$(xfconf-query -c xsettings -p /Xfce/SyncThemes)" != 'true' ] && xfconf-query -c xsettings -p /Xfce/SyncThemes -n -t bool -s true
|
[ "$(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
|
# Apply the current theme with gsettings
|
||||||
gsettings set org.gnome.desktop.interface gtk-theme "$theme"
|
gsettings set org.gnome.desktop.interface gtk-theme "$theme"
|
||||||
|
# Apply the current theme for the all the GTK flatpaks
|
||||||
# Apply the current theme for GTK apps in flatpak
|
flatpak override --user --env=GTK_THEME="$theme"
|
||||||
|
|
||||||
# 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"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_font() {
|
sync_font() {
|
||||||
|
Reference in New Issue
Block a user