From 76c50a654ae46dea7a6a9a4c39569eeeb593652e Mon Sep 17 00:00:00 2001 From: purian23 Date: Wed, 11 Mar 2026 16:22:37 -0400 Subject: [PATCH] fix(qmllint): Update distro detection logic for qmllint --- CONTRIBUTING.md | 2 +- quickshell/README.md | 1 + quickshell/scripts/qmllint-entrypoints.sh | 21 ++++++++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ba0db20..986fe8f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,7 @@ touch .qmlls.ini 4. Restart dms to generate the `.qmlls.ini` file -5. Run `make lint-qml` from the repo root to lint QML entrypoints (requires the `.qmlls.ini` generated above). The script needs the **Qt 6** `qmllint`; it checks `qmllint6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint` in `PATH`. If your Qt 6 binary lives elsewhere, set `QMLLINT=/path/to/qmllint`. +5. Run `make lint-qml` from the repo root to lint QML entrypoints (requires the `.qmlls.ini` generated above). The script needs the **Qt 6** `qmllint`; it checks `qmllint6`, Fedora's `qmllint-qt6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint` in `PATH`. If your Qt 6 binary lives elsewhere, set `QMLLINT=/path/to/qmllint`. 6. Make your changes, test, and open a pull request. diff --git a/quickshell/README.md b/quickshell/README.md index 49fe191d..df852954 100644 --- a/quickshell/README.md +++ b/quickshell/README.md @@ -29,6 +29,7 @@ quickshell -p quickshell/ qmlfmt -t 4 -i 4 -b 250 -w path/to/file.qml make lint-qml # Run from repo root; requires quickshell/.qmlls.ini (generated by `qs -p quickshell/`) # Uses Qt 6 qmllint. Override path with QMLLINT=/path/to/qmllint if needed. + # Auto-detects `qmllint6`, Fedora's `qmllint-qt6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint`. ``` ## Components diff --git a/quickshell/scripts/qmllint-entrypoints.sh b/quickshell/scripts/qmllint-entrypoints.sh index 188b8db4..41c5a740 100755 --- a/quickshell/scripts/qmllint-entrypoints.sh +++ b/quickshell/scripts/qmllint-entrypoints.sh @@ -12,8 +12,8 @@ repo_root="$( quickshell_dir="${repo_root}/quickshell" qmlls_config="${quickshell_dir}/.qmlls.ini" -# Resolve qmllint: honour QMLLINT, then try qmllint6, then the common Qt 6 -# install path, and finally bare qmllint. We need the Qt 6 build (>= 6.x) +# Resolve qmllint: honour QMLLINT, then try common Qt 6 binary names and +# install paths, and finally bare qmllint. We need the Qt 6 build (>= 6.x) # because older Qt 5 qmllint doesn't understand --ignore-settings / -W. resolve_qmllint() { if [[ -n "${QMLLINT:-}" ]]; then @@ -21,7 +21,7 @@ resolve_qmllint() { return fi local candidate - for candidate in qmllint6 /usr/lib/qt6/bin/qmllint qmllint; do + for candidate in qmllint6 qmllint-qt6 /usr/lib/qt6/bin/qmllint qmllint; do if command -v -- "${candidate}" >/dev/null 2>&1; then printf '%s\n' "${candidate}" return @@ -35,6 +35,16 @@ if ! qmllint_bin="$(resolve_qmllint)"; then exit 127 fi +print_broken_qmlls_link() { + local target="" + target="$(readlink -- "${qmlls_config}" 2>/dev/null || true)" + printf 'error: %s is a broken symlink. lint-qml requires a live Quickshell tooling VFS.\n' "${qmlls_config}" >&2 + if [[ -n "${target}" ]]; then + printf 'Broken target: %s\n' "${target}" >&2 + fi + print_vfs_recovery +} + trim_ini_value() { local value="$1" value="${value#\"}" @@ -61,6 +71,11 @@ print_vfs_recovery() { printf ' qs -p %q\n' "${quickshell_dir}" >&2 } +if [[ -L "${qmlls_config}" && ! -e "${qmlls_config}" ]]; then + print_broken_qmlls_link + exit 1 +fi + if [[ ! -e "${qmlls_config}" ]]; then printf 'error: %s is missing. lint-qml requires the Quickshell tooling VFS.\n' "${qmlls_config}" >&2 print_vfs_recovery