Compare commits
No commits in common. "main" and "c69a3bb163ef9cd219eb03df0f48e3bc8eae9f70" have entirely different histories.
main
...
c69a3bb163
12 changed files with 152 additions and 224 deletions
2
Makefile
2
Makefile
|
@ -9,4 +9,4 @@ remove:
|
|||
pamac-installer --remove tromjaro-fixes
|
||||
|
||||
clean:
|
||||
$(RM) -rf src/ pkg/ *.tar.xz
|
||||
$(RM) -rf src/ pkg/ *.tar.xz
|
13
PKGBUILD
13
PKGBUILD
|
@ -1,7 +1,7 @@
|
|||
# Maintainer: TROM <contact@tromsite.com>
|
||||
pkgname=tromjaro-fixes
|
||||
pkgver=3
|
||||
pkgrel=4
|
||||
pkgver=1.4.1
|
||||
pkgrel=1
|
||||
pkgdesc="Various fixes for TROMjaro OS"
|
||||
arch=(any)
|
||||
url=""
|
||||
|
@ -10,10 +10,9 @@ depends=('xfce4-appfinder'
|
|||
'xdotool'
|
||||
'rsync'
|
||||
'inotify-tools'
|
||||
'qt6gtk2-tromjaro'
|
||||
'qt5gtk2'
|
||||
'yad')
|
||||
conflicts=('qt5-styleplugins')
|
||||
'qt5-styleplugins'
|
||||
'qt6gtk2'
|
||||
'qqc2-desktop-style')
|
||||
provides=('tromjaro-fixes')
|
||||
backup=()
|
||||
options=(!strip)
|
||||
|
@ -56,4 +55,4 @@ package() {
|
|||
install -d ${pkgdir}/etc/profile.d/
|
||||
install -Dm644 ${srcdir}/tromjaro-fixes.sh ${pkgdir}/etc/profile.d/
|
||||
|
||||
}
|
||||
}
|
|
@ -8,4 +8,4 @@ Target = *
|
|||
[Action]
|
||||
Description = Refreshing the chaotic-aur keyring...
|
||||
When = PreTransaction
|
||||
Exec = /usr/bin/fix-chaotic-keyring
|
||||
Exec = /usr/bin/fix-chaotic-keyring
|
16
bin/periodic/fix-flatpaks-theming
Executable file
16
bin/periodic/fix-flatpaks-theming
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
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"
|
||||
|
||||
if [ ! -e "$home_local_themes_dir" ]; then
|
||||
mkdir -p "$home_local_themes_dir"
|
||||
echo "Directory $home_local_themes_dir is created."
|
||||
fi
|
||||
|
||||
echo "Set watch for" "${source_theme_dirs[@]}" "directories ..."
|
||||
while inotifywait -qr -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "${source_theme_dirs[@]}"; do
|
||||
rsync -av --delete --progress "${source_theme_dirs[@]}" "$target_themes_dir"
|
||||
echo "Directory $target_themes_dir is synchronized with" "${source_theme_dirs[@]}"
|
||||
done
|
|
@ -1,229 +1,30 @@
|
|||
#!/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
|
||||
pidof -sq -o %PPID -x "$(basename "$0")" && exit
|
||||
|
||||
# Set the directory/file paths
|
||||
declare -r flatpak_themes_dir="$HOME/.themes"
|
||||
declare -r config_dir="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
declare -r profile="$HOME/.profile"
|
||||
|
||||
# Create directories if they don't exist
|
||||
mkdir -p "$flatpak_themes_dir" "$config_dir" ||
|
||||
{ echo "failed to make directories $flatpak_themes_dir & $config_dir"; exit 1; }
|
||||
|
||||
# Enable option for syncing the current theme with XFWM theme if not already enabled
|
||||
[ "$(xfconf-query -c xsettings -p /Xfce/SyncThemes)" != '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() {
|
||||
# Go through each item in $XDG_DATA_DIRS and find the subdirectory $1
|
||||
while read -r dir; do
|
||||
local subdir="${dir%/}/$1"
|
||||
if [ -d "$subdir" ]; then
|
||||
echo "$subdir"
|
||||
break
|
||||
fi
|
||||
done < <(printf '%s:%s\n' "$HOME/.local/share" "$XDG_DATA_DIRS" | tr ':' '\n')
|
||||
}
|
||||
|
||||
theme_exists() {
|
||||
local -r theme_dir=$(xdg_directory_lookup "themes/$1")
|
||||
[ -d "$theme_dir" ]
|
||||
}
|
||||
|
||||
# Function for setting variables in ~/.profile
|
||||
profile_set_variable() {
|
||||
# Return if the variable is already set to the correct value
|
||||
grep -xq "\s*export\s\+$1=$2\s*" "$profile" && return
|
||||
|
||||
# If the variable is set to a different value then remove that line
|
||||
grep -q "^\s*export\s\+$1=" "$profile" && sed -i "/^\s*export\s\+$1=/d" "$profile"
|
||||
|
||||
# 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
|
||||
sed -i "/^\s*#\s*Values set by the fix-theming script\s*$/a export $1=$2" "$profile"
|
||||
elif grep -q '\S' "$profile"; then
|
||||
# shellcheck disable=SC2015
|
||||
tail -n1 "$profile" | grep -qx '\s*' &&
|
||||
local -r begin='' || local -r begin='\n'
|
||||
printf '%b# Values set by the fix-theming script\nexport %s=%s\n' "$begin" "$1" "$2" >> "$profile"
|
||||
else
|
||||
printf '# Values set by the fix-theming script\nexport %s=%s\n' "$1" "$2" > "$profile"
|
||||
fi
|
||||
|
||||
logout_required='true'
|
||||
}
|
||||
|
||||
set_QT_scaling() {
|
||||
for var in QT_SCALE_FACTOR QT_AUTO_SCREEN_SCALE_FACTOR QT_ENABLE_HIGHDPI_SCALING; do
|
||||
profile_set_variable "$var" "$1"
|
||||
done
|
||||
}
|
||||
|
||||
set_cursor_size() {
|
||||
xfconf-query -c xsettings -p /Gtk/CursorThemeSize -s "$1"
|
||||
}
|
||||
|
||||
set_xfwm_theme() {
|
||||
xfconf-query -c xfwm4 -p /general/theme -n -t string -s "$1"
|
||||
}
|
||||
|
||||
# Use the highDPI variant of the XFWM theme
|
||||
use_hdpi_theme_variant() {
|
||||
# shellcheck disable=SC2015
|
||||
[ -n "$1" ] && local -r xfwm_theme="$1" ||
|
||||
local -r xfwm_theme=$(xfconf-query -c xfwm4 -p /general/theme)
|
||||
|
||||
for variant in xhdpi hdpi; do
|
||||
# If this variant of the theme is already enabled then break out of the loop
|
||||
[ "${xfwm_theme##*-}" = "$variant" ] && break
|
||||
|
||||
# Store the name for this variant of the theme in highDPI_theme variable
|
||||
local highDPI_theme=$xfwm_theme-$variant
|
||||
|
||||
if theme_exists "$highDPI_theme"; then
|
||||
set_xfwm_theme "$highDPI_theme"
|
||||
[ -z "$1" ] &&
|
||||
notify-send "XFWM theme changed to $highDPI_theme" "Changed to the highDPI variant of your chosen theme because you've enabled highDPI on your system"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if ! theme_exists "$highDPI_theme"; then
|
||||
[ -n "$1" ] && theme_exists "$1" && set_xfwm_theme "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Use the normal variant of the XFWM theme
|
||||
use_normal_theme_variant() {
|
||||
local -r current_xfwm_theme=$(xfconf-query -c xfwm4 -p /general/theme)
|
||||
|
||||
for variant in xhdpi hdpi; do
|
||||
# Continue looping if this (highDPI) variant of the theme is not enabled
|
||||
[ "${current_xfwm_theme##*-}" != "$variant" ] && continue
|
||||
|
||||
# Store the name for the normal variant of this theme in normal_theme variable
|
||||
local normal_theme=${current_xfwm_theme%-"$variant"}
|
||||
|
||||
if theme_exists "$normal_theme"; then
|
||||
set_xfwm_theme "$normal_theme"
|
||||
notify-send "XFWM theme changed to $normal_theme" "Changed to the normal variant of your chosen theme because you've disabled highDPI on your system"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Change XFWM theme, QT apps scaling, and mouse cursor size according to
|
||||
# the user's current window scaling (highDPI setting)
|
||||
hdpi_theme_fix() {
|
||||
local -r current_window_scaling=$(xfconf-query -c xsettings -p /Gdk/WindowScalingFactor)
|
||||
local -r current_cursor_size=$(xfconf-query -c xsettings -p /Gtk/CursorThemeSize)
|
||||
|
||||
unset logout_required
|
||||
|
||||
if [ "$current_window_scaling" -eq '2' ]; then
|
||||
# Increase scaling for QT apps
|
||||
set_QT_scaling 2
|
||||
# Use the highDPI variant of the XFWM theme
|
||||
use_hdpi_theme_variant
|
||||
if [ "$current_cursor_size" -eq 25 ]; then
|
||||
set_cursor_size '45'
|
||||
notify-send 'Mouse cursor size increased to 45' "Changed to a larger mouse cursor because you've enabled highDPI on your system"
|
||||
fi
|
||||
else
|
||||
# Decrease scaling for QT apps
|
||||
set_QT_scaling 1
|
||||
# Use the normal variant of the XFWM theme
|
||||
use_normal_theme_variant
|
||||
if [ "$current_cursor_size" -eq 45 ]; then
|
||||
set_cursor_size '25'
|
||||
notify-send 'Mouse cursor size decreased to 25' "Changed to a smaller mouse cursor because you've disabled highDPI on your system"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Show popup menu about logout if it's required
|
||||
[ "$logout_required" = 'true' ] &&
|
||||
yad --image "dialog-question" --title "Alert" --buttons-layout=center --text-align=center --button=yad-yes:0 --button=yad-no:1 --text 'Logout is required in order to apply your DPI preferences to QT apps.\nWould you like to logout now?' &&
|
||||
xfce4-session-logout --logout
|
||||
}
|
||||
|
||||
sync_theme() {
|
||||
# Get the current system theme
|
||||
local -r current_theme=$(xfconf-query -c xsettings -p /Net/ThemeName)
|
||||
# Get the current window scaling factor (highDPI setting)
|
||||
local -r current_window_scaling=$(xfconf-query -c xsettings -p /Gdk/WindowScalingFactor)
|
||||
|
||||
theme=$(xfconf-query -c xsettings -p /Net/ThemeName)
|
||||
# Find the best match for the xfwm4 theme that corresponds with the current system theme
|
||||
xfwm4_theme=$(find /usr/share/themes/ /usr/local/share/themes/ "$HOME"/.themes/ "$HOME"/.local/share/themes/ -mindepth 2 -maxdepth 2 -type d -name xfwm4 -printf '%h\n' 2>/dev/null | grep -o "/${theme}[^/]*$" | sort | head -n1)
|
||||
# If a match is not found then use the Default theme
|
||||
[ -z "$xfwm4_theme" ] && xfwm4_theme='Default'
|
||||
# Apply the xfwm4 theme
|
||||
xfconf-query -c xfwm4 -p /general/theme -n -t string -s "${xfwm4_theme#/}"
|
||||
# Apply the current theme with gsettings
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "$current_theme"
|
||||
|
||||
# Apply the current theme for GTK and Libadwaita apps on flatpak
|
||||
flatpak override --user --env=GTK_THEME="$current_theme"
|
||||
|
||||
# Apply the current theme for XFWM unless it's initial_sync on system reboot
|
||||
if [ "$1" != 'initial_sync' ]; then
|
||||
# Use the highDPI variant of the XFWM theme if the current_window_scaling factor is 2
|
||||
if [ "$current_window_scaling" -eq '2' ]; then
|
||||
use_hdpi_theme_variant "$current_theme"
|
||||
else
|
||||
set_xfwm_theme "$current_theme"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cleanup flatpak_themes_dir and remove ~/.config/gtk-4.0
|
||||
rm -rf "${flatpak_themes_dir:?}"/{*,.*} "$config_dir/gtk-4.0"
|
||||
|
||||
# Find the directory where the current theme is stored
|
||||
local -r current_theme_dir=$(xdg_directory_lookup "themes/$current_theme")
|
||||
|
||||
if [ -d "$current_theme_dir" ]; then
|
||||
# Copy/sync current_theme_dir to flatpak_themes_dir
|
||||
rsync -av --delete --progress "$current_theme_dir" "$flatpak_themes_dir"
|
||||
# Create symlink for gtk-4.0 directory
|
||||
ln -s "$current_theme_dir/gtk-4.0" "$config_dir"
|
||||
fi
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "$theme"
|
||||
}
|
||||
|
||||
sync_font() {
|
||||
# Get the current system font
|
||||
local -r current_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 "$current_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"
|
||||
}
|
||||
|
||||
# Initial synchronization
|
||||
sync_theme 'initial_sync'
|
||||
sync_theme
|
||||
sync_font
|
||||
|
||||
# Monitor when the user changes their system theme, font or
|
||||
# DPI setting in XFCE and sync them as needed
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
'set: /Net/ThemeName') sync_theme ;;
|
||||
'set: /Gdk/WindowScalingFactor') hdpi_theme_fix ;;
|
||||
'set: /Gtk/FontName') sync_font ;;
|
||||
esac
|
||||
done < <(xfconf-query -c xsettings -m)
|
||||
|
|
79
bin/periodic/fix-zombie-appicons
Executable file
79
bin/periodic/fix-zombie-appicons
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash
|
||||
pidof -sq -o %PPID -x "$(basename "$0")" && exit
|
||||
datastore="$HOME"/.local/share/fix-zombie-appicons
|
||||
bakdir="$datastore"/backup
|
||||
data="$datastore"/tweaked-desktop-files
|
||||
|
||||
mkdir -p "$bakdir" || { echo "failed to make directory $bakdir"; exit 1; }
|
||||
|
||||
# Directories where desktop files are stored
|
||||
user="$HOME"/.local/share/applications
|
||||
pacman_global=/usr/share/applications
|
||||
pacman_local=/usr/local/share/applications
|
||||
flatpak_global=/var/lib/flatpak/exports/share/applications
|
||||
flatpak_local="$HOME"/.local/share/flatpak/exports/share/applications
|
||||
snap=/var/lib/snapd/desktop/applications
|
||||
|
||||
mkdir -p "$user" "$flatpak_local" || { echo "failed to make directoris $user & $flatpak_local"; exit 1; }
|
||||
|
||||
detectfiles() {
|
||||
for file in "$user"/*.desktop; do
|
||||
name=$(basename "$file") || continue
|
||||
[ -d "$file" ] || grep -xq "$name" "$data" && continue
|
||||
[ -f "$pacman_global/$name" ] ||
|
||||
[ -f "$pacman_local/$name" ] ||
|
||||
[ -f "$flatpak_global/$name" ] ||
|
||||
[ -f "$flatpak_local/$name" ] ||
|
||||
[ -f "$snap/$name" ] &&
|
||||
echo "$name" >> "$data"
|
||||
done
|
||||
}
|
||||
|
||||
fixfiles() {
|
||||
lastmod=$(stat -c "%Y" "$data")
|
||||
tmp="$(mktemp)"
|
||||
trap 'rm $tmp' EXIT
|
||||
[ -f "$data" ] && cp "$data" "$tmp" && copied='true'
|
||||
lineno=0
|
||||
[ "$copied" = 'true' ] && while IFS= read -r name; do
|
||||
((lineno++))
|
||||
file="$user/$name"
|
||||
[ -f "$file" ] || { sed -i "${lineno}d" "$tmp" && ((lineno--)) ; continue; }
|
||||
[ -f "$pacman_global/$name" ] ||
|
||||
[ -f "$pacman_local/$name" ] ||
|
||||
[ -f "$flatpak_global/$name" ] ||
|
||||
[ -f "$flatpak_local/$name" ] ||
|
||||
[ -f "$snap/$name" ] ||
|
||||
mv "$file" "$bakdir/$name.bak"
|
||||
done < "$data"
|
||||
|
||||
[ "$copied" = 'true' ] && [ "$(stat -c '%Y' "$data")" = "$lastmod" ] && sort "$tmp" | uniq > "$data"
|
||||
|
||||
for bakfile in "$bakdir"/*.desktop.bak; do
|
||||
name=$(basename "${bakfile%.bak}") || continue
|
||||
origfile="$user/$name"
|
||||
[ -f "$origfile" ] && continue
|
||||
[ -f "$pacman_global/$name" ] ||
|
||||
[ -f "$pacman_local/$name" ] ||
|
||||
[ -f "$flatpak_global/$name" ] ||
|
||||
[ -f "$flatpak_local/$name" ] ||
|
||||
[ -f "$snap/$name" ] &&
|
||||
mv "$bakfile" "$origfile"
|
||||
done
|
||||
}
|
||||
|
||||
existing_dirs=()
|
||||
for dir in "$user" "$pacman_global" "$pacman_local" "$flatpak_global" "$flatpak_local" "$snap"; do
|
||||
[ -d "$dir" ] && existing_dirs=("${existing_dirs[@]}" "$dir")
|
||||
done
|
||||
|
||||
detectfiles
|
||||
fixfiles
|
||||
|
||||
while read -r line; do
|
||||
if [ "$line" = "$user/" ]; then
|
||||
detectfiles
|
||||
else
|
||||
fixfiles
|
||||
fi
|
||||
done < <(inotifywait -qm --format '%w' --include '\.desktop$' -e 'move,move_self,create,delete,delete_self,unmount' "${existing_dirs[@]}")
|
2
bin/standalone/app-finder
Executable file
2
bin/standalone/app-finder
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
xdotool search --onlyvisible --class xfce4-appfinder windowkill || setsid -f xfce4-appfinder
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
pacman-key --populate chaotic
|
||||
pacman-key --populate chaotic
|
|
@ -1,2 +1,2 @@
|
|||
[Context]
|
||||
filesystems=~/.config/gtk-4.0;~/.themes;~/.icons;xdg-config/gtk-4.0;
|
||||
filesystems=~/.themes;
|
15
systemd/services/fix-flatpaks-theming.service
Normal file
15
systemd/services/fix-flatpaks-theming.service
Normal file
|
@ -0,0 +1,15 @@
|
|||
# This service unit is for fix-flatpaks-theming script
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Fix flatpak theming script
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
ExecStart=/usr/bin/fix-flatpaks-theming
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
15
systemd/services/fix-zombie-appicons.service
Normal file
15
systemd/services/fix-zombie-appicons.service
Normal file
|
@ -0,0 +1,15 @@
|
|||
# This service unit is for fix-tweaked-desktop-files script
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Fix tweaked desktop files script
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
ExecStart=/usr/bin/fix-zombie-appicons
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
|
@ -1,5 +1,6 @@
|
|||
# Sync the QT with GTK
|
||||
export QT_QPA_PLATFORMTHEME="qt6gtk2"
|
||||
export QT_QPA_PLATFORMTHEME="gtk2"
|
||||
export QT_QUICK_CONTROLS_STYLE="gtk2"
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR=1
|
||||
|
||||
# Show color output in less
|
||||
|
@ -13,4 +14,4 @@ export LESS_TERMCAP_us=$'\e[1;32m'
|
|||
export LESS_TERMCAP_ue=$'\e[0m'
|
||||
|
||||
# Disable the beep sound
|
||||
[ -n "$DISPLAY" ] && xset b off
|
||||
xset b off
|
Loading…
Add table
Add a link
Reference in a new issue