From d7549b4ab8943625be52a785cba9c6c1497a71a9 Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Wed, 24 Jan 2024 09:48:01 +0100 Subject: [PATCH] Update GTK scripts --- .install/excludes.txt | 1 + .install/gtk.sh | 49 +++++++++++++++++++++++++++++++++--- hypr/conf/autostart.conf | 2 +- {gtk => hypr/scripts}/gtk.sh | 10 +++++--- 4 files changed, 54 insertions(+), 8 deletions(-) mode change 100644 => 100755 .install/gtk.sh rename {gtk => hypr/scripts}/gtk.sh (78%) diff --git a/.install/excludes.txt b/.install/excludes.txt index 12f5388..3d894e2 100644 --- a/.install/excludes.txt +++ b/.install/excludes.txt @@ -2,6 +2,7 @@ .git .install .dev +gtk README.md CHANGELOG LICENSE diff --git a/.install/gtk.sh b/.install/gtk.sh old mode 100644 new mode 100755 index c22ce2e..d0c59cb --- a/.install/gtk.sh +++ b/.install/gtk.sh @@ -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 diff --git a/hypr/conf/autostart.conf b/hypr/conf/autostart.conf index b780a61..1f3b399 100644 --- a/hypr/conf/autostart.conf +++ b/hypr/conf/autostart.conf @@ -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 diff --git a/gtk/gtk.sh b/hypr/scripts/gtk.sh similarity index 78% rename from gtk/gtk.sh rename to hypr/scripts/gtk.sh index e440350..cfe29d3 100755 --- a/gtk/gtk.sh +++ b/hypr/scripts/gtk.sh @@ -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 \ No newline at end of file +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 \ No newline at end of file