|
6 | 6 |
|
7 | 7 | [ -z "${HYDE_THEME}" ] && echo "ERROR: unable to detect theme" && exit 1 |
8 | 8 | get_themes |
9 | | -confDir="${XDG_CONFIG_HOME:-$(xdg-user-dir CONFIG)}" |
| 9 | +confDir="${XDG_CONFIG_HOME:-$HOME/.config}" |
10 | 10 | #// define functions |
11 | 11 |
|
12 | 12 | Theme_Change() { |
@@ -48,6 +48,44 @@ Notification font: ${NOTIFICATION_FONT} |
48 | 48 | EOF |
49 | 49 | } |
50 | 50 |
|
| 51 | +load_hypr_variables() { |
| 52 | + local hypr_file="${1}" |
| 53 | + |
| 54 | + #? Load theme specific variables |
| 55 | + eval "$( |
| 56 | + hyq "${hypr_file}" \ |
| 57 | + --export env \ |
| 58 | + -Q "\$GTK_THEME[string]" \ |
| 59 | + -Q "\$ICON_THEME[string]" \ |
| 60 | + -Q "\$CURSOR_THEME[string]" \ |
| 61 | + -Q "\$CURSOR_SIZE[int]" \ |
| 62 | + -Q "\$FONT[string]" \ |
| 63 | + -Q "\$FONT_SIZE[int]" \ |
| 64 | + -Q "\$FONT_STYLE[string]" \ |
| 65 | + -Q "\$DOCUMENT_FONT[string]" \ |
| 66 | + -Q "\$DOCUMENT_FONT_SIZE[int]" \ |
| 67 | + -Q "\$MONOSPACE_FONT[string]" \ |
| 68 | + -Q "\$MONOSPACE_FONT_SIZE[int]" |
| 69 | + )" |
| 70 | + |
| 71 | + GTK_THEME=${__GTK_THEME:-$GTK_THEME} |
| 72 | + ICON_THEME=${__ICON_THEME:-$ICON_THEME} |
| 73 | + CURSOR_THEME=${__CURSOR_THEME:-$CURSOR_THEME} |
| 74 | + CURSOR_SIZE=${__CURSOR_SIZE:-$CURSOR_SIZE} |
| 75 | + TERMINAL=${__TERMINAL:-$TERMINAL} |
| 76 | + FONT=${__FONT:-$FONT} |
| 77 | + FONT_STYLE=${__FONT_STYLE:-''} # using hyprland this should be empty by default |
| 78 | + FONT_SIZE=${__FONT_SIZE:-$FONT_SIZE} |
| 79 | + DOCUMENT_FONT=${__DOCUMENT_FONT:-$DOCUMENT_FONT} |
| 80 | + DOCUMENT_FONT_SIZE=${__DOCUMENT_FONT_SIZE:-$DOCUMENT_FONT_SIZE} |
| 81 | + MONOSPACE_FONT=${__MONOSPACE_FONT:-$MONOSPACE_FONT} |
| 82 | + MONOSPACE_FONT_SIZE=${__MONOSPACE_FONT_SIZE:-$MONOSPACE_FONT_SIZE} |
| 83 | + BAR_FONT=${__BAR_FONT:-$BAR_FONT} |
| 84 | + MENU_FONT=${__MENU_FONT:-$MENU_FONT} |
| 85 | + NOTIFICATION_FONT=${__NOTIFICATION_FONT:-$NOTIFICATION_FONT} |
| 86 | + |
| 87 | +} |
| 88 | + |
51 | 89 | sanitize_hypr_theme() { |
52 | 90 | input_file="${1}" |
53 | 91 | output_file="${2}" |
@@ -131,37 +169,11 @@ if [[ -r "${HYPRLAND_CONFIG}" ]]; then |
131 | 169 | [[ -n $HYPRLAND_INSTANCE_SIGNATURE ]] && hyprctl keyword misc:disable_autoreload 1 -q |
132 | 170 | [[ -r "${HYDE_THEME_DIR}/hypr.theme" ]] && sanitize_hypr_theme "${HYDE_THEME_DIR}/hypr.theme" "${XDG_CONFIG_HOME}/hypr/themes/theme.conf" |
133 | 171 |
|
134 | | - eval "$( |
135 | | - hyq "${HYDE_THEME_DIR}/hypr.theme" \ |
136 | | - --export env \ |
137 | | - -Q "\$GTK_THEME[string]" \ |
138 | | - -Q "\$ICON_THEME[string]" \ |
139 | | - -Q "\$CURSOR_THEME[string]" \ |
140 | | - -Q "\$CURSOR_SIZE[int]" \ |
141 | | - -Q "\$FONT[string]" \ |
142 | | - -Q "\$FONT_SIZE[int]" \ |
143 | | - -Q "\$FONT_STYLE[string]" \ |
144 | | - -Q "\$DOCUMENT_FONT[string]" \ |
145 | | - -Q "\$DOCUMENT_FONT_SIZE[int]" \ |
146 | | - -Q "\$MONOSPACE_FONT[string]" \ |
147 | | - -Q "\$MONOSPACE_FONT_SIZE[int]" |
148 | | - )" |
| 172 | + #? Load theme specific variables |
| 173 | + load_hypr_variables "${HYDE_THEME_DIR}/hypr.theme" |
149 | 174 |
|
150 | | - GTK_THEME=${__GTK_THEME:-$GTK_THEME} |
151 | | - ICON_THEME=${__ICON_THEME:-$ICON_THEME} |
152 | | - CURSOR_THEME=${__CURSOR_THEME:-$CURSOR_THEME} |
153 | | - CURSOR_SIZE=${__CURSOR_SIZE:-$CURSOR_SIZE} |
154 | | - TERMINAL=${__TERMINAL:-$TERMINAL} |
155 | | - FONT=${__FONT:-$FONT} |
156 | | - FONT_STYLE=${__FONT_STYLE:-''} # using hyprland this should be empty by default |
157 | | - FONT_SIZE=${__FONT_SIZE:-$FONT_SIZE} |
158 | | - DOCUMENT_FONT=${__DOCUMENT_FONT:-$DOCUMENT_FONT} |
159 | | - DOCUMENT_FONT_SIZE=${__DOCUMENT_FONT_SIZE:-$DOCUMENT_FONT_SIZE} |
160 | | - MONOSPACE_FONT=${__MONOSPACE_FONT:-$MONOSPACE_FONT} |
161 | | - MONOSPACE_FONT_SIZE=${__MONOSPACE_FONT_SIZE:-$MONOSPACE_FONT_SIZE} |
162 | | - BAR_FONT=${__BAR_FONT:-$BAR_FONT} |
163 | | - MENU_FONT=${__MENU_FONT:-$MENU_FONT} |
164 | | - NOTIFICATION_FONT=${__NOTIFICATION_FONT:-$NOTIFICATION_FONT} |
| 175 | + #? Load User's hyprland overrides |
| 176 | + load_hypr_variables "${XDG_STATE_DIR:-$HOME/.local/state}/hyde/hyprland.conf" |
165 | 177 |
|
166 | 178 | fi |
167 | 179 |
|
@@ -235,7 +247,11 @@ else |
235 | 247 | print_log -sec "theme" -stat "use" "'Wallbash-Gtk' as gtk4 theme" |
236 | 248 | fi |
237 | 249 | rm -rf "${confDir}/gtk-4.0" |
238 | | -ln -s "${themesDir}/${gtk4Theme}/gtk-4.0" "${confDir}/gtk-4.0" |
| 250 | +if [ -d "${themesDir}/${gtk4Theme}/gtk-4.0" ]; then |
| 251 | + ln -s "${themesDir}/${gtk4Theme}/gtk-4.0" "${confDir}/gtk-4.0" |
| 252 | +else |
| 253 | + print_log -sec "theme" -warn "gtk4" "theme directory '${themesDir}/${gtk4Theme}/gtk-4.0' does not exist" |
| 254 | +fi |
239 | 255 |
|
240 | 256 | #// flatpak GTK |
241 | 257 |
|
@@ -296,6 +312,11 @@ if [ -f "$HOME/.Xdefaults" ]; then |
296 | 312 | grep -q "^Xcursor\.size:" "$HOME/.Xdefaults" || echo "Xcursor.size: 30" >>"$HOME/.Xdefaults" |
297 | 313 | fi |
298 | 314 |
|
| 315 | +#? Workaround for gtk-4 having settings.ini! |
| 316 | +if [ -f "${confDir}/gtk-4.0/settings.ini" ]; then |
| 317 | + rm "${confDir}/gtk-4.0/settings.ini" |
| 318 | +fi |
| 319 | + |
299 | 320 | #// wallpaper |
300 | 321 | export -f pkg_installed |
301 | 322 |
|
|
0 commit comments