From 5ad8ad3b4c94d50c5020beb7552282d3376ee2d0 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Wed, 22 Jul 2026 14:20:00 -0400 Subject: Fixed hyprland-gui module not found Signed-off-by: Don Williams On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: config/hypr/lua/user_overrides.lua modified: scripts/lib_copy.sh modified: scripts/lib_detect.sh --- scripts/lib_detect.sh | 55 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 10 deletions(-) (limited to 'scripts/lib_detect.sh') diff --git a/scripts/lib_detect.sh b/scripts/lib_detect.sh index 5bb42c3f..26449962 100644 --- a/scripts/lib_detect.sh +++ b/scripts/lib_detect.sh @@ -69,11 +69,47 @@ detect_nixos_adjust() { # Qt Quick Controls style safety: enable Hyprland style only when module exists. adjust_qt_quick_controls_style() { local log="$1" - local env_conf="config/hypr/configs/ENVariables.conf" - local env_lua="config/hypr/lua/env.lua" + local source_hypr_dir="config/hypr" + local target_hypr_dir="${XDG_CONFIG_HOME:-$HOME/.config}/hypr" local style="Basic" local qt_style_override="Fusion" local has_kvantum_qml=0 + local set_env_conf_vars + local set_env_lua_vars + + set_env_conf_vars() { + local file="$1" + [ -f "$file" ] || return 0 + + if grep -q '^env = QT_QUICK_CONTROLS_STYLE,' "$file"; then + sed -i -E "s|^env = QT_QUICK_CONTROLS_STYLE,.*$|env = QT_QUICK_CONTROLS_STYLE,${style}|" "$file" + else + printf '\nenv = QT_QUICK_CONTROLS_STYLE,%s\n' "$style" >>"$file" + fi + + if grep -q '^env = QT_STYLE_OVERRIDE,' "$file"; then + sed -i -E "s|^env = QT_STYLE_OVERRIDE,.*$|env = QT_STYLE_OVERRIDE,${qt_style_override}|" "$file" + else + printf 'env = QT_STYLE_OVERRIDE,%s\n' "$qt_style_override" >>"$file" + fi + } + + set_env_lua_vars() { + local file="$1" + [ -f "$file" ] || return 0 + + if grep -q '^hl\.env("QT_QUICK_CONTROLS_STYLE",' "$file"; then + sed -i -E "s|^hl\\.env\\(\"QT_QUICK_CONTROLS_STYLE\", \".*\"\\)$|hl.env(\"QT_QUICK_CONTROLS_STYLE\", \"${style}\")|" "$file" + else + printf '\nhl.env("QT_QUICK_CONTROLS_STYLE", "%s")\n' "$style" >>"$file" + fi + + if grep -q '^hl\.env("QT_STYLE_OVERRIDE",' "$file"; then + sed -i -E "s|^hl\\.env\\(\"QT_STYLE_OVERRIDE\", \".*\"\\)$|hl.env(\"QT_STYLE_OVERRIDE\", \"${qt_style_override}\")|" "$file" + else + printf 'hl.env("QT_STYLE_OVERRIDE", "%s")\n' "$qt_style_override" >>"$file" + fi + } if find /usr/lib /usr/lib64 /usr/share -type d -path '*/qml/*/org/hyprland/style' -print -quit 2>/dev/null | grep -q .; then style="org.hyprland.style" @@ -86,14 +122,13 @@ adjust_qt_quick_controls_style() { qt_style_override="kvantum" fi - if [ -f "$env_conf" ]; then - sed -i -E "s|^env = QT_QUICK_CONTROLS_STYLE,.*$|env = QT_QUICK_CONTROLS_STYLE,${style}|" "$env_conf" - sed -i -E "s|^env = QT_STYLE_OVERRIDE,.*$|env = QT_STYLE_OVERRIDE,${qt_style_override}|" "$env_conf" - fi - if [ -f "$env_lua" ]; then - sed -i -E "s|^hl\\.env\\(\"QT_QUICK_CONTROLS_STYLE\", \".*\"\\)$|hl.env(\"QT_QUICK_CONTROLS_STYLE\", \"${style}\")|" "$env_lua" - sed -i -E "s|^hl\\.env\\(\"QT_STYLE_OVERRIDE\", \".*\"\\)$|hl.env(\"QT_STYLE_OVERRIDE\", \"${qt_style_override}\")|" "$env_lua" - fi + set_env_conf_vars "$source_hypr_dir/configs/ENVariables.conf" + set_env_lua_vars "$source_hypr_dir/lua/env.lua" + set_env_lua_vars "$source_hypr_dir/configs/system_env.lua" + + set_env_conf_vars "$target_hypr_dir/configs/ENVariables.conf" + set_env_lua_vars "$target_hypr_dir/lua/env.lua" + set_env_lua_vars "$target_hypr_dir/configs/system_env.lua" if [ "$style" = "org.hyprland.style" ]; then echo "${INFO:-[INFO]} hyprland Qt style module detected. Using QT_QUICK_CONTROLS_STYLE=$style" 2>&1 | tee -a "$log" || true -- cgit v1.2.3