Compare commits
1 Commits
dabc52d7c2
...
tio-patch-
Author | SHA1 | Date | |
---|---|---|---|
bd11ec4837 |
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=2
|
pkgrel=1
|
||||||
pkgdesc="Various fixes for TROMjaro OS"
|
pkgdesc="Various fixes for TROMjaro OS"
|
||||||
arch=(any)
|
arch=(any)
|
||||||
url=""
|
url=""
|
||||||
|
31
bin/periodic/fix-flatpaks-theming
Executable file
31
bin/periodic/fix-flatpaks-theming
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set the directory paths
|
||||||
|
shared_themes_dir=/usr/share/themes/
|
||||||
|
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/
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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; }
|
||||||
|
|
||||||
|
echo "Set watch for theme directories: ${source_theme_dirs[@]}, and icon directories: ${source_icon_dirs[@]}"
|
||||||
|
|
||||||
|
# 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
|
@@ -1,59 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/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() {
|
sync_theme() {
|
||||||
# Get the current system theme
|
# Get the current system theme
|
||||||
theme_name=$(xfconf-query -c xsettings -p /Net/ThemeName)
|
theme=$(xfconf-query -c xsettings -p /Net/ThemeName)
|
||||||
|
|
||||||
# Cleanup source & target themes directories
|
|
||||||
source_themes_dirs=()
|
|
||||||
rm -rf "$target_themes_dir"/*
|
|
||||||
|
|
||||||
# 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
|
# 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
|
[ "$(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_name"
|
gsettings set org.gnome.desktop.interface gtk-theme "$theme"
|
||||||
# Apply the current theme for the all the GTK flatpaks
|
|
||||||
flatpak override --user --env=GTK_THEME="$theme_name"
|
|
||||||
}
|
|
||||||
|
|
||||||
sync_icons() {
|
# Apply the current theme for GTK apps in flatpak
|
||||||
# Get the current icons theme
|
|
||||||
icons_theme_name=$(xfconf-query -c xsettings -p /Net/IconThemeName)
|
|
||||||
|
|
||||||
# Cleanup source & target themes directories
|
# Define the path to the flatpak override directory
|
||||||
source_icons_dirs=()
|
flatpak_override_dir="$HOME/.local/share/flatpak/overrides"
|
||||||
rm -rf "$target_icons_dir"/*
|
# Create the directory if it doesn't exist
|
||||||
|
[ -d "$flatpak_override_dir" ] || mkdir -p "$flatpak_override_dir" || { echo 'failed creating directory!'; return 1; }
|
||||||
# Go through each item in $XDG_DATA_DIRS to find all other directories where
|
# Write the theme configuration to the global override file
|
||||||
# icons are stored, and save only the current one to source_icons_dirs
|
echo "[Environment]
|
||||||
while read -r dir; do
|
GTK_THEME=$theme" > "$flatpak_override_dir/global"
|
||||||
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() {
|
sync_font() {
|
||||||
@@ -64,14 +27,12 @@ sync_font() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sync_theme
|
sync_theme
|
||||||
sync_icons
|
|
||||||
sync_font
|
sync_font
|
||||||
|
|
||||||
# Monitor when the user changes their system theme or font in XFCE and sync them as needed
|
# Monitor when the user changes their system theme or font in XFCE and sync them as needed
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
case "$line" in
|
case "$line" in
|
||||||
'set: /Net/ThemeName') sync_theme ;;
|
'set: /Net/ThemeName') sync_theme ;;
|
||||||
'set: /Net/IconThemeName') sync_icons ;;
|
|
||||||
'set: /Gtk/FontName') sync_font ;;
|
'set: /Gtk/FontName') sync_font ;;
|
||||||
esac
|
esac
|
||||||
done < <(xfconf-query -c xsettings -m)
|
done < <(xfconf-query -c xsettings -m)
|
||||||
|
Reference in New Issue
Block a user