Compare commits
No commits in common. "ef045c1265c3ace90f83bed1a45c8ce981d8bdd1" and "87e64585b0cfebb84952091aa61e484d05100037" have entirely different histories.
ef045c1265
...
87e64585b0
|
@ -1,9 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# shellcheck disable=SC2016
|
|
||||||
|
|
||||||
# This script will sync your XFCE theme & font to work systemwide and in
|
|
||||||
# a consistent manner accross different apps. It also improves
|
|
||||||
# the highDPI scaling to give you a better experience.
|
|
||||||
|
|
||||||
# Exit out if the same script is already running in the background
|
# Exit out if the same script is already running in the background
|
||||||
pidof -sq -o %PPID -x "$(basename "$0")" && exit
|
pidof -sq -o %PPID -x "$(basename "$0")" && exit
|
||||||
|
@ -21,25 +16,6 @@ mkdir -p "$flatpak_themes_dir" "$config_dir" ||
|
||||||
[ "$(xfconf-query -c xsettings -p /Xfce/SyncThemes)" != 'true' ] &&
|
[ "$(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 -n -t bool -s true
|
||||||
|
|
||||||
# Make sure ~/.profile is sourced inside ~/.bash_profile and ~/.zprofile
|
|
||||||
source_profile() {
|
|
||||||
for file in "$HOME/.bash_profile" "$HOME/.zprofile"; do
|
|
||||||
# Continue looping if it is already sourced
|
|
||||||
grep -Exq '\s*(.*&& )?\. "?\$HOME"?/\.profile"?\s*' "$file" ||
|
|
||||||
grep -Exq "\s*(.*&& )?\. ~/\.profile\s*" "$file" && continue
|
|
||||||
# If not then source it
|
|
||||||
if grep -q '\S' "$file"; then
|
|
||||||
# shellcheck disable=SC2015
|
|
||||||
tail -n1 "$file" | grep -qx '\s*' &&
|
|
||||||
local -r begin='' || local -r begin='\n'
|
|
||||||
printf '%b[ -f "$HOME/.profile" ] && . "$HOME/.profile"\n' "$begin" >> "$file"
|
|
||||||
else
|
|
||||||
echo '[ -f "$HOME/.profile" ] && . "$HOME/.profile"' > "$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
source_profile
|
|
||||||
|
|
||||||
xdg_directory_lookup() {
|
xdg_directory_lookup() {
|
||||||
# Go through each item in $XDG_DATA_DIRS and find the subdirectory $1
|
# Go through each item in $XDG_DATA_DIRS and find the subdirectory $1
|
||||||
while read -r dir; do
|
while read -r dir; do
|
||||||
|
@ -67,7 +43,7 @@ profile_set_variable() {
|
||||||
# Set the variable to the correct value under a comment mentioning this script
|
# Set the variable to the correct value under a comment mentioning this script
|
||||||
if grep -xq '\s*#\s*Values set by the fix-theming script\s*' "$profile"; then
|
if grep -xq '\s*#\s*Values set by the fix-theming script\s*' "$profile"; then
|
||||||
sed -i "/^\s*#\s*Values set by the fix-theming script\s*$/a export $1=$2" "$profile"
|
sed -i "/^\s*#\s*Values set by the fix-theming script\s*$/a export $1=$2" "$profile"
|
||||||
elif grep -q '\S' "$profile"; then
|
elif grep -q '\s' "$profile"; then
|
||||||
# shellcheck disable=SC2015
|
# shellcheck disable=SC2015
|
||||||
tail -n1 "$profile" | grep -qx '\s*' &&
|
tail -n1 "$profile" | grep -qx '\s*' &&
|
||||||
local -r begin='' || local -r begin='\n'
|
local -r begin='' || local -r begin='\n'
|
||||||
|
@ -218,8 +194,7 @@ sync_font() {
|
||||||
sync_theme 'initial_sync'
|
sync_theme 'initial_sync'
|
||||||
sync_font
|
sync_font
|
||||||
|
|
||||||
# Monitor when the user changes their system theme, font or
|
# Monitor when the user changes their system theme/icons/font in XFCE and sync them as needed
|
||||||
# DPI setting 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 ;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user