Update GTK scripts

This commit is contained in:
Stephan Raabe 2024-01-24 09:48:01 +01:00
parent 923f5f56c2
commit d7549b4ab8
4 changed files with 54 additions and 8 deletions

View File

@ -2,6 +2,7 @@
.git
.install
.dev
gtk
README.md
CHANGELOG
LICENSE

49
.install/gtk.sh Normal file → Executable file
View File

@ -7,7 +7,50 @@ cat <<"EOF"
\____| |_| |_|\_\
EOF
# Ask for confirmation
# Remove existing configuration
# Copy target files into .config
# version="dotfiles"
# Remove existing symbolic links
gtk_symlink=0
gtk_overwrite=1
if [ -L ~/.config/gtk-3.0 ]; then
rm ~/.config/gtk-3.0
gtk_symlink=1
fi
if [ -L ~/.config/gtk-4.0 ]; then
rm ~/.config/gtk-4.0
gtk_symlink=1
fi
if [ -L ~/.gtkrc-2.0 ]; then
rm ~/.gtkrc-2.0
gtk_symlink=1
fi
if [ -L ~/.Xresources ]; then
rm ~/.Xresources
gtk_symlink=1
fi
if [ "$gtk_symlink" == "1" ] ;then
echo ":: Existing symbolic links to GTK configurations removed"
fi
if [ -d ~/.config/gtk-3.0 ] ;then
echo "The script has detected an existing GTK configuration."
if gum confirm "Do you want to overwrite your configuration?" ;then
gtk_overwrite=1
else
gtk_overwrite=0
fi
fi
if [ "$gtk_overwrite" == "1" ] ;then
cp -r ~/dotfiles-versions/$version/gtk/gtk-3.0 ~/.config/
cp -r ~/dotfiles-versions/$version/gtk/gtk-4.0 ~/.config/
cp -r ~/dotfiles-versions/$version/gtk/xsettingsd ~/.config/
cp ~/dotfiles-versions/$version/gtk/.gtkrc-2.0 ~/.config/
cp ~/dotfiles-versions/$version/gtk/.Xresources ~/.config/
echo ":: GTK Theme installed"
fi

View File

@ -12,7 +12,7 @@ exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once = dunst
# Load GTK settings
exec-once = ~/dotfiles/gtk/gtk.sh
exec-once = ~/dotfiles/hypr/scripts/gtk.sh
# Load swayidle and define the lock screen time
exec-once = ~/dotfiles/hypr/scripts/lockscreentime.sh

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Source: https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
config="~/.config/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi
gnome_schema="org.gnome.desktop.interface"
@ -10,6 +10,7 @@ icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')"
cursor_size="$(grep 'gtk-cursor-theme-size' "$config" | sed 's/.*\s*=\s*//')"
font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
echo $gtk_theme
echo $icon_theme
echo $cursor_theme
@ -22,6 +23,7 @@ gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
gsettings set "$gnome_schema" font-name "$font_name"
gsettings set "$gnome_schema" color-scheme "prefer-dark"
echo "exec-once = hyprctl setcursor $cursor_theme $cursor_size" > ~/dotfiles/hypr/conf/cursor.conf
shyprctl setcursor $cursor_theme $cursor_size
if [ -f ~/dotfiles/hypr/conf/cursor.conf ] ;then
echo "exec-once = hyprctl setcursor $cursor_theme $cursor_size" > ~/dotfiles/hypr/conf/cursor.conf
hyprctl setcursor $cursor_theme $cursor_size
fi