diff --git a/Configs/.local/lib/hyde/color/hypr.sh b/Configs/.local/lib/hyde/color/hypr.sh index c39dc3ac9b..b46bbc44fb 100755 --- a/Configs/.local/lib/hyde/color/hypr.sh +++ b/Configs/.local/lib/hyde/color/hypr.sh @@ -38,6 +38,17 @@ eval "$(hyq "$HYDE_THEME_DIR/hypr.theme" \ [[ -z ${__MONOSPACE_FONT_SIZE} ]] && __MONOSPACE_FONT_SIZE=$(get_hyprConf "MONOSPACE_FONT_SIZE[int]") [[ -z ${__CODE_THEME} ]] && __CODE_THEME=$(get_hyprConf "CODE_THEME") +# Faster: assigns escaped result to a variable instead of using subshell +lua_quote_to() { + local _val="${2:-}" + _val="${_val//\\/\\\\}" + _val="${_val//\"/\\\"}" + _val="${_val//$'\n'/\\n}" + _val="${_val//$'\r'/\\r}" + + printf -v "$1" '%s' "$_val" +} + handle_on_lua() { ui_state="${XDG_STATE_HOME}/hyde/lua_state/ui.lua" wallbash_mode="theme" @@ -48,38 +59,59 @@ handle_on_lua() { elif [[ ${enableWallDcol:-0} -eq 3 ]]; then wallbash_mode="light" fi + + local _hyde_theme _gtk_theme _icon_theme _color_scheme + local _cursor_theme _font _document_font _monospace_font + local _notification_font _bar_font _menu_font + local _code_theme _sddm_theme _wallbash_mode + + lua_quote_to _hyde_theme "${HYDE_THEME}" + lua_quote_to _gtk_theme "${__GTK_THEME}" + lua_quote_to _icon_theme "${__ICON_THEME}" + lua_quote_to _color_scheme "${__COLOR_SCHEME}" + lua_quote_to _cursor_theme "${__CURSOR_THEME}" + lua_quote_to _font "${__FONT}" + lua_quote_to _document_font "${__DOCUMENT_FONT}" + lua_quote_to _monospace_font "${__MONOSPACE_FONT}" + lua_quote_to _notification_font "${__NOTIFICATION_FONT:-${__FONT}}" + lua_quote_to _bar_font "${__BAR_FONT:-${__FONT}}" + lua_quote_to _menu_font "${__MENU_FONT:-${__FONT}}" + lua_quote_to _code_theme "${__CODE_THEME}" + lua_quote_to _sddm_theme "${__SDDM_THEME}" + lua_quote_to _wallbash_mode "${wallbash_mode}" + # ? UI config state cat <"${ui_state}" && print_log -sec "theme" -stat "Updating HyDE Lua UI state for wallbash mode" -- Auto-generated by HyDE // Read-only local ui_state = { ui = { - hyde_theme = "${HYDE_THEME}", + hyde_theme = "$_hyde_theme", -- gtk - gtk_theme = "${__GTK_THEME}", - icon_theme = "${__ICON_THEME}", - color_scheme = "${__COLOR_SCHEME}", + gtk_theme = "$_gtk_theme", + icon_theme = "$_icon_theme", + color_scheme = "$_color_scheme", -- Cursor - cursor_theme = "${__CURSOR_THEME}", + cursor_theme = "$_cursor_theme", cursor_size = ${__CURSOR_SIZE:-nil}, -- Fonts - font = "${__FONT}", + font = "$_font", font_size = ${__FONT_SIZE:-nil}, - document_font = "${__DOCUMENT_FONT}", + document_font = "$_document_font", document_font_size = ${__DOCUMENT_FONT_SIZE:-nil}, - monospace_font = "${__MONOSPACE_FONT}", + monospace_font = "$_monospace_font", monospace_font_size = ${__MONOSPACE_FONT_SIZE:-nil}, - notification_font = "${__NOTIFICATION_FONT:-${__FONT}}", - bar_font = "${__BAR_FONT:-${__FONT}}", - menu_font = "${__MENU_FONT:-${__FONT}}", + notification_font = "$_notification_font", + bar_font = "$_bar_font", + menu_font = "$_menu_font", -- Extra Themes - code_theme = "${__CODE_THEME}", - sddm_theme = "${__SDDM_THEME}", + code_theme = "$_code_theme", + sddm_theme = "$_sddm_theme", }, wallbash = { - mode = "${wallbash_mode}", + mode = "$_wallbash_mode", }, }