Compare commits

..

62 Commits

Author SHA1 Message Date
36a979547b fix the highDPI issue 2024-06-03 13:46:03 +00:00
ef045c1265 Merge pull request 'Make sure that ~/.profile will be run at boot/login' (#27) from rokosun-patch-1 into main
Reviewed-on: #27
2024-06-03 13:44:17 +00:00
7d189e0c06 Make sure that ~/.profile will be run at boot/login
Fixes issues with highDPI.
Added better comments and fixed a small bug.
2024-06-03 10:18:08 +00:00
87e64585b0 Update PKGBUILD 2024-01-06 21:47:51 +00:00
e8d7c816d0 added yad as dependency 2024-01-05 10:39:32 +00:00
2ae3788d3c Update PKGBUILD 2023-11-24 20:57:59 +01:00
c0e90900c4 icons update 2023-11-23 01:20:45 +01:00
5f89952f3f Update PKGBUILD 2023-11-07 01:44:23 +01:00
02d11a58d5 repalce qqc2-desktop-style with qqc2-desktop-style5 2023-11-07 01:44:11 +01:00
f9f5c95a7b Update PKGBUILD 2023-11-07 01:37:06 +01:00
b39dfffa5e revert 2a53d23139
revert delete the qqc2-desktop-style dependency
2023-11-06 16:36:55 +01:00
2a53d23139 delete the qqc2-desktop-style dependency 2023-11-06 16:28:53 +01:00
f989a2e1be revert 7c457fd1f7
revert removed the conflicts
2023-11-06 16:28:25 +01:00
7c457fd1f7 removed the conflicts 2023-11-06 14:41:24 +01:00
2a412d38c2 Update PKGBUILD 2023-10-27 15:19:07 +02:00
fb1c550768 Merge pull request 'Don't set the XFWM theme twice' (#26) from rokosun-patch-1 into main
Reviewed-on: #26
2023-10-27 15:18:39 +02:00
0600a8f119 Don't set the XFWM theme twice
Now the script won't set the XFWM theme twice on hiDPI systems every time the user changes their theme.
Also replaced read only variables inside loops with mutable ones.
2023-10-25 12:52:28 +02:00
b741df884e removed 'libadwaita-without-adwaita-git' 2023-10-16 01:30:18 +02:00
3195288734 Update PKGBUILD 2023-10-15 23:44:49 +02:00
de69301c82 Merge pull request 'Create symlink instead of copying directory' (#25) from rokosun-patch-1 into main
Reviewed-on: #25
2023-10-15 23:44:19 +02:00
a6dfcff64f Create symlink instead of copying directory 2023-10-15 10:48:52 +02:00
dd6743836e added libadwaita-without-adwaita-git conflict 2023-10-15 00:34:08 +02:00
573d116696 added conflicts 2023-10-15 00:27:26 +02:00
e3da289b27 switching to qt6gtk2 2023-10-15 00:26:55 +02:00
5c9e44bbcb typo 2023-10-15 00:17:50 +02:00
88d7f94095 replaced qt5-styleplugins with qt5gkt2 2023-10-15 00:09:28 +02:00
7e57c04518 Merge pull request 'Sync gtk-4.0 directory to fix theming' (#24) from rokosun-patch-1 into main
Reviewed-on: #24
2023-10-14 22:26:03 +02:00
b2a3bb83b4 Sync gtk-4.0 directory to fix theming
Also removed old code for flatpak_icons_dir which is not needed anymore.
2023-10-14 22:06:49 +02:00
07f4fc3c64 Merge pull request 'Don't change XFWM theme or mouse cursor size on reboot' (#23) from rokosun-patch-1 into main
Reviewed-on: #23
2023-10-13 23:58:53 +02:00
af5514884e Don't change XFWM theme or mouse cursor size on reboot
Also made the code easier to read by using descriptive functions and read-only variables. Removed some unnecessary comments that cluttered the code.
2023-10-12 16:55:05 +02:00
43221f6357 Update PKGBUILD 2023-10-04 23:22:02 +02:00
03e57e6eaf added qt5-styleplugins back 2023-10-04 23:21:55 +02:00
ab29eb9af5 replaced some dependencies
qt5style plugin with qt5gtk2 and qt6gtk2 with qt6gtk2-git
2023-10-04 14:53:20 +02:00
357e464269 removed the quick controls gtk2 force because it was breaking the qt6 apps 2023-10-04 14:50:10 +02:00
d4c07e8919 Update PKGBUILD 2023-08-10 18:38:34 +02:00
8b63ce497f Update bin/periodic/fix-theming 2023-08-10 18:38:06 +02:00
08a72d4659 better QT fix 2023-08-10 17:10:16 +02:00
05f4dae9e3 added QT scaling support 2023-08-10 17:03:39 +02:00
7d12c48835 Update PKGBUILD 2023-08-10 01:26:32 +02:00
db8328bd8b remove the QT support for now because it is broken 2023-08-10 01:26:19 +02:00
358094c4bf Update PKGBUILD 2023-08-09 15:57:46 +02:00
cfa7771ec0 Update PKGBUILD 2023-08-08 17:43:14 +02:00
ac76a669a9 Update bin/periodic/fix-theming 2023-08-08 17:06:38 +02:00
c6037978e6 Update PKGBUILD 2023-08-08 17:03:00 +02:00
7b07f05111 revert 82cd64a07d
revert removed the icons patch
2023-08-08 16:59:31 +02:00
b800bf0bcc Scales up the mouse pointer too plus other fixes 2023-08-08 15:58:10 +02:00
d389039f0d Update PKGBUILD 2023-08-08 03:53:24 +02:00
82cd64a07d removed the icons patch 2023-08-08 00:44:37 +02:00
56e049367d Update PKGBUILD 2023-08-08 00:42:23 +02:00
b7c64c8305 Update PKGBUILD 2023-08-06 23:44:19 +02:00
0cdccf7d72 Roko's improvments 2023-08-06 15:08:58 +02:00
eSh
3e259fb09e Bump package version 2023-08-06 02:29:58 +02:00
66c21a8192 Merge pull request 'Cleanup' (#22) from theme-folder-sync into main
Reviewed-on: #22
2023-08-06 02:25:07 +02:00
eSh
0fffd21076 Delete systemd/services/fix-flatpaks-theming.service 2023-08-06 02:23:51 +02:00
dabc52d7c2 Merge pull request 'Move themes and icons folder syncing to the theming script' (#21) from theme-folder-sync into main
Reviewed-on: #21
2023-08-06 02:19:18 +02:00
eSh
72dc4f5c0d Delete bin/periodic/fix-flatpaks-theming 2023-08-06 02:15:26 +02:00
eSh
c2fc6dd83b add themes and icons folder sync 2023-08-06 02:14:02 +02:00
d3cddde72f better flatpak handling 2023-08-05 20:25:03 +02:00
d63a3ccf33 flatpak fixes 2023-08-04 19:18:45 +02:00
4811e675d8 many improvements 2023-08-04 19:15:59 +02:00
b6f7ffccba Update PKGBUILD 2023-08-03 23:11:35 +02:00
3c16633482 improvements from roko 2023-08-03 23:09:23 +02:00
6 changed files with 219 additions and 82 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: TROM <contact@tromsite.com> # Maintainer: TROM <contact@tromsite.com>
pkgname=tromjaro-fixes pkgname=tromjaro-fixes
pkgver=1.6 pkgver=2
pkgrel=0 pkgrel=3.3
pkgdesc="Various fixes for TROMjaro OS" pkgdesc="Various fixes for TROMjaro OS"
arch=(any) arch=(any)
url="" url=""
@ -10,9 +10,11 @@ depends=('xfce4-appfinder'
'xdotool' 'xdotool'
'rsync' 'rsync'
'inotify-tools' 'inotify-tools'
'qt5-styleplugins' 'qt5gtk2'
'qt6gtk2' 'qt6gtk2-git'
'qqc2-desktop-style') 'qqc2-desktop-style5'
'yad')
conflicts=('qt5-styleplugins')
provides=('tromjaro-fixes') provides=('tromjaro-fixes')
backup=() backup=()
options=(!strip) options=(!strip)

View File

@ -1,37 +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 shared themes directory
monitor_shared_themes() {
inotifywait -m -r -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "$shared_themes_dir" > /dev/null 2>&1 &
}
# Function to monitor local themes directory
monitor_local_themes() {
inotifywait -m -r -e 'modify,attrib,move,move_self,create,delete,delete_self,unmount' "$local_themes_dir" > /dev/null 2>&1 &
}
# Start monitoring in the background
monitor_shared_themes
monitor_local_themes
# Monitor changes and sync periodically
while true; do
# Wait for a short period (e.g., 5 seconds) before syncing again
sleep 5
# Synchronize if there were changes in either directory
sync_themes
done

View File

@ -1,38 +1,229 @@
#!/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
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() { sync_theme() {
# Get the current system theme # Get the current system theme
theme=$(xfconf-query -c xsettings -p /Net/ThemeName) local -r current_theme=$(xfconf-query -c xsettings -p /Net/ThemeName)
# Enable syncing the current theme with xfwm4 if not already enabled # Get the current window scaling factor (highDPI setting)
[ "$(xfconf-query -c xsettings -p /Xfce/SyncThemes)" != 'true' ] && xfconf-query -c xsettings -p /Xfce/SyncThemes -n -t bool -s true local -r current_window_scaling=$(xfconf-query -c xsettings -p /Gdk/WindowScalingFactor)
# 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 "$current_theme"
# Apply the current theme for GTK apps in flatpak # Apply the current theme for GTK and Libadwaita apps on flatpak
flatpak override --user --env=GTK_THEME="$current_theme"
# Define the path to the flatpak override directory # Apply the current theme for XFWM unless it's initial_sync on system reboot
flatpak_override_dir="$HOME/.local/share/flatpak/overrides" if [ "$1" != 'initial_sync' ]; then
# Create the directory if it doesn't exist # Use the highDPI variant of the XFWM theme if the current_window_scaling factor is 2
[ -d "$flatpak_override_dir" ] || mkdir -p "$flatpak_override_dir" || { echo 'failed creating directory!'; return 1; } if [ "$current_window_scaling" -eq '2' ]; then
# Write the theme configuration to the global override file use_hdpi_theme_variant "$current_theme"
echo "[Environment] else
GTK_THEME=$theme" > "$flatpak_override_dir/global" 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
} }
sync_font() { sync_font() {
# Get the current system font # Get the current system font
font=$(xfconf-query -c xsettings -p /Gtk/FontName) local -r current_font=$(xfconf-query -c xsettings -p /Gtk/FontName)
# Apply the same font for the title of xfce windows # Apply the same font for the title of XFCE windows
xfconf-query -c xfwm4 -p /general/title_font -n -t string -s "$font" xfconf-query -c xfwm4 -p /general/title_font -n -t string -s "$current_font"
} }
sync_theme # Initial synchronization
sync_theme 'initial_sync'
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, font or
# 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 ;;
'set: /Gdk/WindowScalingFactor') hdpi_theme_fix ;;
'set: /Gtk/FontName') sync_font ;; 'set: /Gtk/FontName') sync_font ;;
esac esac
done < <(xfconf-query -c xsettings -m) done < <(xfconf-query -c xsettings -m)

View File

@ -1,5 +1,2 @@
[Context] [Context]
filesystems=~/.config/gtk-4.0;~/.themes;~/.icons;xdg-config/gtk-4.0;xdg-config/Kvantum:ro; filesystems=~/.config/gtk-4.0;~/.themes;~/.icons;xdg-config/gtk-4.0;
[Environment]
QT_STYLE_OVERRIDE=kvantum

View File

@ -1,15 +0,0 @@
# 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

View File

@ -1,6 +1,5 @@
# Sync the QT with GTK # Sync the QT with GTK
export QT_QPA_PLATFORMTHEME="gtk2" export QT_QPA_PLATFORMTHEME="qt6gtk2"
export QT_QUICK_CONTROLS_STYLE="gtk2"
export QT_AUTO_SCREEN_SCALE_FACTOR=1 export QT_AUTO_SCREEN_SCALE_FACTOR=1
# Show color output in less # Show color output in less