Skip to content

feat: add LXQt and MATE desktop environment support - #7

Merged
devohmycode merged 14 commits into
mainfrom
1.2.2
Feb 20, 2026
Merged

devohmycode merged 14 commits into
mainfrom
1.2.2

Conversation

@devohmycode

@devohmycode devohmycode commented Feb 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Desktop environment selection: Replace --xfce flag with --desktop <xfce|lxqt|mate> (--xfce retained for backward compatibility). Users can now choose their DE via gum UI or CLI flag.
  • New scripts: lxqt.sh (654 lines) and mate.sh (551 lines) as standalone installation scripts mirroring xfce.sh structure, with Kvantum/Openbox config for LXQt and Marco/GTK config for MATE.
  • DE-aware start/stop scripts: start and kill_termux_x11 detect the installed DE via desktop.conf, binary detection fallback, and theme_config.tmp fallback.
  • i18n: 110+ new message keys in English and French for desktop selection, LXQt, and MATE installation flows.
  • PRoot integration: Theme configuration skips GTK themes for LXQt (uses Qt/Kvantum instead).

Test plan

  • Run ./install.sh --gum and verify DE selection menu appears (XFCE / LXQt / MATE)
  • Run ./install.sh --desktop lxqt --gum and verify LXQt installation flow
  • Run ./install.sh --desktop mate --gum and verify MATE installation flow
  • Run ./install.sh --xfce --gum and verify backward compatibility
  • Verify start script detects and launches the correct DE
  • Verify kill_termux_x11 stops the correct DE processes
  • Verify i18n messages display correctly in French (--lang fr)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for LXQt and MATE desktop environments alongside existing XFCE option
    • Implemented desktop environment selection during installation with version and browser configuration
    • Enhanced startup script with automatic desktop environment detection and configuration
  • Chores

    • Version bumped to 1.2.2
    • Improved internationalization message refresh mechanism
    • Updated repository URLs

devohmycode and others added 14 commits February 20, 2026 12:02
Save detected GPU vendor to OHMYTERMUX_CONFIG_DIR/gpu_vendor (for zrun/zrunhud) and update the Adreno path to install mesa-vulkan-drivers via proot-distro/apt. Replaces the previous hardcoded .deb download and dpkg check for mesa-vulkan-kgsl with a simpler apt install, and updates the function header/comment to reflect GPU detection and saving.
Add i18n messages for desktop environment selection (XFCE/LXQt),
LXQt installation flow, and LXQt script-specific messages in both
English and French.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add --desktop/-de flag for desktop environment selection, keeping
--xfce/-x for backwards compatibility. Update all references in
CLI parsing, main execution, help, and cleanup.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…nd LXQt

Add desktop environment selection UI (gum and text mode) that prompts
for XFCE or LXQt. Saves choice to desktop.conf. Branches to
_install_xfce() or _install_lxqt() accordingly.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace install_xfce_scripts() with install_desktop_scripts() that
reads desktop.conf to launch the correct DE session (xfce4-session
or startlxqt) and kill the right processes.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add complete LXQt installation script with bootstrap, argument
parsing, package definitions (base + recommended), LXQt/Openbox/
Kvantum/qterminal configuration, browser and icon installation.
Mirrors xfce.sh structure with minimal and recommended modes only.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Skip GTK-specific theme application when DESKTOP_ENV=lxqt in
theme_config.tmp, since LXQt uses Qt/Kvantum themes instead.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace XFCE-specific references in start/stop/cp2menu messages
with generic desktop session wording.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Fix stop script config path to use $OHMYTERMUX_CONFIG_DIR (OhMyTermux
with capitals) instead of hardcoded lowercase path. Fix tput cuu
off-by-one in LXQt version selection menu.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Bump the BRANCH variable from 1.2.1 to 1.2.2 in lxqt.sh so downloads point to the 1.2.2 GitHub branch.
Fix download_and_execute() to prefer local script files over remote
download, preventing 404 errors for scripts not yet pushed to GitHub.
Add -f flag to curl to fail properly on HTTP errors. Fix lxqt.sh
BRANCH from "1.2.2" to "1.2.1" to match install.sh and xfce.sh.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Save selected DE and generate robust start/stop scripts with LXQt detection and handling. Writes DESKTOP_SESSION=lxqt to ~/.config/OhMyTermux/desktop.conf and adds _update_start_script to lxqt.sh to deploy updated $PREFIX/bin/start and kill_termux_x11 (handles XFCE and LXQt). Updates src/start and the generated start script in utils.sh to: detect DE from desktop.conf or theme_config.tmp or binaries; start PulseAudio, Termux-X11 and virgl_test_server (with Adreno flag); launch either startlxqt or xfce4-session; and disable screensavers. Also improves kill script to stop virgl/openbox/lxqt processes, clean X11 locks, and small formatting fixes for desktop files.
Introduce full MATE desktop support and improve i18n handling. Adds a new mate.sh installer (packages, config, start/stop scripts, theme/icon handling) and integrates MATE selection into install.sh and desktop start logic (xfce/lxqt/mate). Add MSG_I18N_VERSION and many MATE-related messages to en.sh and fr.sh. Implement safer i18n_loader download/refresh across scripts (install.sh, lxqt.sh, proot.sh, utils.sh, xfce.sh) using a temp file and shebang validation, and add version-based message file refresh in lib/i18n_loader.sh. Also update App-Installer repository URL in utils.sh and minor start/stop adjustments to detect/handle mate-session and marco.
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add LXQt and MATE desktop environment support with multi-DE awareness

✨ Enhancement 📝 Documentation

Grey Divider

Walkthroughs

Description
• Add LXQt and MATE desktop environment support alongside XFCE
• Replace --xfce flag with --desktop <xfce|lxqt|mate> for flexible DE selection
• Create standalone lxqt.sh and mate.sh installation scripts (654 and 551 lines)
• Make start and kill_termux_x11 scripts DE-aware via desktop.conf detection
• Add 110+ i18n message keys in English and French for new DEs
• Improve i18n loader robustness with version checking and fallback caching
• Skip GTK themes for LXQt (uses Qt/Kvantum instead) in PRoot integration
• Save GPU vendor detection for zrun/zrunhud utilities
Diagram
flowchart LR
  A["install.sh<br/>--desktop flag"] -->|xfce| B["_install_xfce"]
  A -->|lxqt| C["_install_lxqt"]
  A -->|mate| D["_install_mate"]
  B --> E["xfce.sh"]
  C --> F["lxqt.sh"]
  D --> G["mate.sh"]
  E --> H["desktop.conf<br/>saved"]
  F --> H
  G --> H
  H -->|detected by| I["start script"]
  H -->|detected by| J["kill_termux_x11 script"]
  I --> K["Launch correct DE<br/>xfce4-session|startlxqt|mate-session"]
  J --> L["Kill correct DE<br/>processes"]
Loading

Grey Divider

File Changes

1. install.sh ✨ Enhancement +377/-110

Refactor XFCE to multi-DE support with desktop selection

install.sh


2. lxqt.sh ✨ Enhancement +654/-0

New standalone LXQt installation script with full config

lxqt.sh


3. mate.sh ✨ Enhancement +551/-0

New standalone MATE installation script with full config

mate.sh


View more (7)
4. utils.sh ✨ Enhancement +145/-28

Update start/stop scripts for DE detection and multi-DE support

utils.sh


5. proot.sh ✨ Enhancement +18/-14

Save GPU vendor and simplify mesa-vulkan installation via apt

proot.sh


6. xfce.sh ✨ Enhancement +10/-3

Update branch version and i18n loader robustness

xfce.sh


7. i18n/messages/en.sh 📝 Documentation +107/-3

Add 110+ new i18n keys for LXQt, MATE, and desktop selection

i18n/messages/en.sh


8. i18n/messages/fr.sh 📝 Documentation +107/-3

Add 110+ new French i18n keys for LXQt, MATE, and desktop selection

i18n/messages/fr.sh


9. lib/i18n_loader.sh ✨ Enhancement +35/-0

Add version checking and auto-refresh for stale message files

lib/i18n_loader.sh


10. src/start ✨ Enhancement +114/-6

Rewrite start script with DE detection and multi-DE session launch

src/start


Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Feb 20, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Multi-desktop environment support (LXQt, MATE, XFCE) is introduced to the Termux-X11 installation framework. Changes include expanded i18n messages for desktop environments, centralized desktop selection and installation orchestration, new installer scripts for each environment, automated i18n message refresh logic, version bump to 1.2.2, and updated startup/stop scripts with desktop detection.

Changes

Cohort / File(s) Summary
Internationalization Extensions
i18n/messages/en.sh, i18n/messages/fr.sh
Added i18n version identifier, desktop environment selection messages, and comprehensive LXQt and MATE configuration message keys (help, error, installation, configuration). Updated existing XFCE references to generic desktop language. (+107/-3 in each file)
Core Installation Orchestration
install.sh
Introduced desktop selection and installation flow with install_desktop() orchestrator routing to _install_xfce(), _install_lxqt(), _install_mate(). Renamed install_xfce_scripts() to install_desktop_scripts() with persistence of desktop choice. Enhanced CLI argument parsing for --desktop and improved i18n loader refresh logic. (+377/-110)
i18n Loader Enhancement
lib/i18n_loader.sh
Added _check_and_refresh_messages() function that validates and refreshes i18n message files by comparing MSG_I18N_VERSION, downloading fresh copies when needed, with fallback to cached versions. (+35/-0)
New Desktop Environment Installers
lxqt.sh, mate.sh
Introduced comprehensive bootstrapping scripts for LXQt (~654 lines) and MATE (~551 lines) environments, each supporting language override, i18n loading, browser/version selection, configuration generation, and start/stop script creation. Both follow similar patterns with environment-specific configuration and package management.
Version Bumps and Infrastructure Updates
utils.sh, xfce.sh, proot.sh
Version bumped from 1.2.1 to 1.2.2. Enhanced i18n_loader.sh refresh logic across files with temp file validation. Updated repository URLs in utils.sh (GiGIDKR/OhMyAppInstaller → devohmycode/App-Installer). Modified proot.sh GPU installation for Adreno and LXQt theme handling. (+18/-14 in proot.sh, +10/-3 in xfce.sh, +145/-28 in utils.sh)
Desktop Startup/Shutdown Scripts
src/start
Replaced simple virgl startup with comprehensive session orchestration: cleans existing X11 processes, detects desktop environment via config/theme/binary presence, starts PulseAudio and Termux-X11, initializes VirGL with GPU vendor awareness, and launches appropriate desktop session (lxqt/xfce/mate). (+114/-6)

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant InstallScript as install.sh
    participant DesktopOrch as Desktop<br/>Orchestrator
    participant Installer as Desktop<br/>Installer<br/>(XFCE/LXQt/MATE)
    participant i18n as i18n Loader
    participant System as System<br/>Packages

    User->>InstallScript: Run installer with--desktop=lxqt
    InstallScript->>i18n: Load messages (with refresh check)
    i18n-->>InstallScript: Messages loaded
    InstallScript->>DesktopOrch: install_desktop(lxqt)
    DesktopOrch->>Installer: _install_lxqt()
    Installer->>System: Update system packages
    System-->>Installer: Success
    Installer->>System: Install base LXQt packages
    System-->>Installer: Success
    Installer->>System: Install browser (Firefox/Chromium)
    System-->>Installer: Success
    Installer->>Installer: Generate config files<br/>(lxqt.conf, panel.conf,<br/>openbox config, themes)
    Installer->>Installer: Create start/stop scripts<br/>(with environment detection)
    Installer->>Installer: Persist DESKTOP_SESSION=lxqt
    Installer-->>DesktopOrch: Installation complete
    DesktopOrch-->>InstallScript: Success
    InstallScript-->>User: Desktop environment ready
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Poem

🐰 A rabbit hops through desktops three,
LXQt, MATE, and XFCE!
With i18n refreshed and messages spun,
Multi-environment magic—setup in one!
Desktop detection, no more terminal plight,
Termux-X11 springs to life, shining bright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: add LXQt and MATE desktop environment support' accurately summarizes the main change—adding LXQt and MATE as new desktop environment options alongside XFCE. This aligns with the extensive additions across i18n files, installers (lxqt.sh, mate.sh), start/stop scripts, and configuration logic.
Docstring Coverage ✅ Passed Docstring coverage is 92.31% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 1.2.2

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (4) 📎 Requirement gaps (0)

Grey Divider


Action required

1. i18n_loader.sh sourced without guard 📘 Rule violation ⛯ Reliability
Description
If the download fails and no cached i18n_loader.sh exists, the scripts still source it, causing
hard-to-diagnose runtime failures. This is not graceful degradation and provides limited actionable
recovery for users.
Code

install.sh[R75-86]

+# Always try to refresh i18n_loader.sh; fall back to cached version if download fails
+_loader_tmp=$(mktemp 2>/dev/null || echo "$SCRIPT_DIR/lib/i18n_loader.sh.tmp")
+if curl -fL -s -o "$_loader_tmp" "$_loader_url" 2>/dev/null && head -1 "$_loader_tmp" 2>/dev/null | grep -q "^#!/bin/bash"; then
+    mv "$_loader_tmp" "$SCRIPT_DIR/lib/i18n_loader.sh"
+else
+    rm -f "$_loader_tmp" 2>/dev/null
+    if [ ! -f "$SCRIPT_DIR/lib/i18n_loader.sh" ]; then
+        echo "Warning: Could not download i18n_loader.sh and no cached version available" >&2
+    fi
fi
I18N_DEFER_INIT=true
source "$SCRIPT_DIR/lib/i18n_loader.sh"
Evidence
The compliance rule requires handling failure points with actionable context; here a failed download
only prints a warning but then unconditionally sources the missing file, which can break execution.
The same pattern is repeated in the new lxqt.sh and mate.sh scripts.

Rule 3: Generic: Robust Error Handling and Edge Case Management
install.sh[75-86]
lxqt.sh[37-47]
mate.sh[37-47]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The scripts attempt to download `lib/i18n_loader.sh`, but if the download fails and there is no cached copy, they still run `source &quot;$SCRIPT_DIR/lib/i18n_loader.sh&quot;`. This can lead to immediate failures without a controlled fallback.

## Issue Context
This affects `install.sh`, `lxqt.sh`, and `mate.sh` and violates robust error-handling expectations.

## Fix Focus Areas
- install.sh[75-86]
- lxqt.sh[35-47]
- mate.sh[35-47]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. --desktop invalid value ignored 📘 Rule violation ✓ Correctness
Description
When --desktop is provided with a missing/invalid value, the script silently continues instead of
failing with a clear error. This can lead to unintended defaults or interactive prompts in
non-interactive usage.
Code

install.sh[R225-233]

+        --desktop|-de)
+            DESKTOP_CHOICE=true
+            ONLY_GUM=false
+            shift
+            if [ -n "$1" ] && [[ "$1" =~ ^(xfce|lxqt|mate)$ ]]; then
+                DESKTOP_ENV="$1"
+                shift
+            fi
+            ;;
Evidence
Security-first input validation requires external inputs (CLI args) to be validated and rejected
when invalid; here invalid input is neither rejected nor reported, and no actionable error is
provided.

Rule 6: Generic: Security-First Input Validation and Data Handling
Rule 3: Generic: Robust Error Handling and Edge Case Management
install.sh[225-233]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`install.sh --desktop` silently ignores invalid or missing values instead of rejecting them with an actionable error.

## Issue Context
This is a user-controlled external input and should be validated explicitly; silent fallback can break automation.

## Fix Focus Areas
- install.sh[225-233]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. desktop.conf sourced unsafely 📘 Rule violation ⛨ Security
Description
The generated scripts load desktop.conf using source, which executes its contents as shell code.
Because this file is user-writable, it can be used for command injection when the start/stop scripts
run.
Code

install.sh[R2179-2182]

+# Read desktop configuration
+CONFIG_FILE="$OHMYTERMUX_CONFIG_DIR/desktop.conf"
+DESKTOP_SESSION="xfce"
+[ -f "\$CONFIG_FILE" ] && source "\$CONFIG_FILE"
Evidence
The compliance rule requires safe handling of external inputs, including file reads; using source
on a user-controlled file executes arbitrary code rather than parsing a value and validating it
against an allowlist.

Rule 6: Generic: Security-First Input Validation and Data Handling
install.sh[2179-2182]
install.sh[2119-2122]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`desktop.conf` is loaded with `source`, so its contents are executed as shell code, enabling command injection if the file is modified.

## Issue Context
`desktop.conf` is stored under the user&#x27;s config directory and is user-writable; it should be treated as untrusted input.

## Fix Focus Areas
- install.sh[2119-2122]
- install.sh[2179-2182]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (2)
4. MATE start/stop broken 🐞 Bug ✓ Correctness
Description
install.sh always installs its own start/kill scripts (when PROOT is false), but those scripts only
support XFCE/LXQt; with DESKTOP_SESSION=mate they fall back to XFCE, so MATE installs won’t
start/stop correctly.
Code

install.sh[R2115-2170]

+install_desktop_scripts() {
+    local de_name="XFCE"
+    local msg_config_key="MSG_CONFIG_XFCE_SCRIPTS"
+
+    # Read desktop config
+    if [ -f "$OHMYTERMUX_CONFIG_DIR/desktop.conf" ]; then
+        source "$OHMYTERMUX_CONFIG_DIR/desktop.conf"
+    fi
+
+    case "${DESKTOP_SESSION:-xfce}" in
+        lxqt)
+            de_name="LXQt"
+            msg_config_key="MSG_CONFIG_LXQT_SCRIPTS"
+            ;;
+    esac
+
+    title_msg "$(t "$msg_config_key")"

    # Installation of the start script
-    cat <<'EOF' > start
+    cat <<EOF > start
#!/bin/bash

+# Read desktop configuration
+DESKTOP_SESSION="${DESKTOP_SESSION:-xfce}"
+
# Activate PulseAudio on the network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1

-XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
+XDG_RUNTIME_DIR=\${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
sleep 1

am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1

-env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
+case "\$DESKTOP_SESSION" in
+    lxqt)
+        env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session startlxqt & > /dev/null 2>&1
+        ;;
+    *)
+        env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
+        ;;
+esac

# Set the audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1

sleep 5
-process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
-kill "$process_id" > /dev/null 2>&1
+
+case "\$DESKTOP_SESSION" in
+    xfce|"")
+        process_id=\$(ps -aux | grep '[x]fce4-screensaver' | awk '{print \$2}')
+        [ -n "\$process_id" ] && kill "\$process_id" > /dev/null 2>&1
+        ;;
+esac
Evidence
install_desktop_scripts only switches messaging for lxqt and the generated start script only has a
lxqt branch; any other DESKTOP_SESSION (including 'mate') goes to the default XFCE branch.
install_desktop_scripts is executed for any desktop install when PROOT is false, so this script
becomes authoritative.

install.sh[2115-2131]
install.sh[2134-2158]
install.sh[2482-2489]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`install.sh` generates and installs `start` and `kill_termux_x11` scripts that only handle XFCE/LXQt. When the user selects MATE, these scripts still get installed and will start/stop the wrong session.

### Issue Context
The PR goal is DE-aware start/stop based on `desktop.conf` (and fallbacks), but `install_desktop_scripts()` currently does not implement MATE.

### Fix Focus Areas
- install.sh[2115-2227]
 - Extend the DE selection logic to include `mate`
 - In the generated `start` script: add a `mate)` branch that launches `mate-session`
 - In the generated `kill_termux_x11`: add a `mate)` branch that finds/kills `mate-session` (and likely `marco`) and uses `de_name=&quot;MATE&quot;`
 - Prefer runtime reading of `desktop.conf` instead of embedding a fixed DESKTOP_SESSION at generation-time (consider using a quoted heredoc and explicit `source &quot;$HOME/.config/OhMyTermux/desktop.conf&quot;` at runtime)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. PROOT path lacks MATE 🐞 Bug ✓ Correctness
Description
The start/stop scripts installed via utils.sh (used in PROOT flows) and the tracked src/start script
only recognize xfce/lxqt. In MATE+PROOT installs, utils.sh can overwrite mate.sh’s more complete
scripts, leaving no way to start/stop MATE properly.
Code

utils.sh[R236-354]

+# Start Termux-X11 with XFCE or LXQt depending on the installed DE
#------------------------------------------------------------------------------
cat <<'EOF' > start
#!/bin/bash

-# Enable PulseAudio on the network
-pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1
-
-XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
+# ---------------------------------------------------------------------------
+# OhMyTermux - start
+# Démarre Termux-X11 avec XFCE ou LXQt selon l'environnement installé
+# ---------------------------------------------------------------------------
+
+# ---------------------------------------------------------------------------
+# NETTOYAGE DU SERVEUR X EXISTANT
+# ---------------------------------------------------------------------------
+pkill -f "termux.x11"    > /dev/null 2>&1
+pkill -f "Xwayland"      > /dev/null 2>&1
+pkill -f "xfce4-session" > /dev/null 2>&1
+pkill -f "lxqt-session"  > /dev/null 2>&1
+pkill -f "startlxqt"     > /dev/null 2>&1
+pkill -f "openbox"       > /dev/null 2>&1
sleep 1

-am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
-sleep 1
+# Supprimer les verrous X11 résiduels
+rm -f /tmp/.X1-lock > /dev/null 2>&1
+rm -f /tmp/.X11-unix/X1 > /dev/null 2>&1
+
+# ---------------------------------------------------------------------------
+# DÉTECTER L'ENVIRONNEMENT DE BUREAU
+# ---------------------------------------------------------------------------
+DESKTOP_SESSION="unknown"
+OHMYTERMUX_CONFIG="$HOME/.config/OhMyTermux"
+
+# 1. Lire depuis desktop.conf (priorité haute - écrit par install.sh / lxqt.sh)
+if [ -f "$OHMYTERMUX_CONFIG/desktop.conf" ]; then
+    source "$OHMYTERMUX_CONFIG/desktop.conf"
+fi

-MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1
+# 2. Fallback : lire depuis theme_config.tmp (écrit par lxqt.sh)
+if [ "$DESKTOP_SESSION" = "unknown" ] || [ -z "$DESKTOP_SESSION" ]; then
+    if [ -f "$OHMYTERMUX_CONFIG/theme_config.tmp" ]; then
+        DETECTED=$(grep '^DESKTOP_ENV=' "$OHMYTERMUX_CONFIG/theme_config.tmp" | cut -d'=' -f2 | tr -d '"')
+        [ -n "$DETECTED" ] && DESKTOP_SESSION="$DETECTED"
+    fi
+fi

-#GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.0 program
+# 3. Fallback final : détecter par la présence des binaires
+if [ "$DESKTOP_SESSION" = "unknown" ] || [ -z "$DESKTOP_SESSION" ]; then
+    if command -v startlxqt > /dev/null 2>&1 || command -v lxqt-session > /dev/null 2>&1; then
+        DESKTOP_SESSION="lxqt"
+    elif command -v xfce4-session > /dev/null 2>&1; then
+        DESKTOP_SESSION="xfce"
+    else
+        echo "[start] Aucun environnement de bureau détecté (xfce4-session ou startlxqt)."
+        exit 1
+    fi
+fi

-#MESA_LOADER_DRIVER_OVERRIDE=zink TU_DEBUG=noconform program
+# ---------------------------------------------------------------------------
+# PULSEAUDIO
+# ---------------------------------------------------------------------------
+pulseaudio --start \
+    --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" \
+    --exit-idle-time=-1 > /dev/null 2>&1

-env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
+export PULSE_SERVER=127.0.0.1

-# Set the audio server
-export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1
+# ---------------------------------------------------------------------------
+# DÉMARRER TERMUX-X11
+# ---------------------------------------------------------------------------
+XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 &> /dev/null &
+sleep 1

-sleep 5
-process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
-kill "$process_id" > /dev/null 2>&1
+# Ouvrir l'activité Termux-X11
+am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
+sleep 1
+
+# ---------------------------------------------------------------------------
+# VIRGL (rendu GPU)
+# ---------------------------------------------------------------------------
+GPU_VENDOR="unknown"
+if [ -f "$OHMYTERMUX_CONFIG/gpu_vendor" ]; then
+    GPU_VENDOR=$(cat "$OHMYTERMUX_CONFIG/gpu_vendor")
+fi
+
+if [ "$GPU_VENDOR" = "adreno" ]; then
+    MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 \
+        virgl_test_server_android --angle-gl &> /dev/null &
+else
+    MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 \
+        virgl_test_server_android &> /dev/null &
+fi
+sleep 1
+
+# ---------------------------------------------------------------------------
+# DÉMARRER LA SESSION DE BUREAU
+# ---------------------------------------------------------------------------
+export DISPLAY=:1.0
+export GALLIUM_DRIVER=virpipe
+
+case "$DESKTOP_SESSION" in
+    lxqt)
+        env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe \
+            dbus-launch --exit-with-session startlxqt &> /dev/null &
+        sleep 5
+        process_id=$(ps -aux | grep '[x]screensaver' | awk '{print $2}')
+        [ -n "$process_id" ] && kill "$process_id" > /dev/null 2>&1
+        ;;
+    xfce)
+        env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe \
+            dbus-launch --exit-with-session xfce4-session &> /dev/null &
+        sleep 5
+        process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
+        [ -n "$process_id" ] && kill "$process_id" > /dev/null 2>&1
+        ;;
+    *)
+        echo "[start] Environnement de bureau non reconnu : $DESKTOP_SESSION"
+        echo "        Valeurs acceptées : xfce, lxqt"
+        exit 1
+        ;;
+esac
Evidence
utils.sh installs a DE-aware start script but it only supports lxqt and xfce; unknown values error
with accepted values 'xfce, lxqt'. src/start similarly lacks mate. In the PROOT flow, install.sh
doesn’t call install_desktop_scripts, but it does call install_utils, which installs these utils.sh
scripts, so they can become the final scripts on PATH.

utils.sh[234-355]
utils.sh[362-412]
src/start[98-122]
install.sh[2487-2489]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
In PROOT installs, the `start`/`kill_termux_x11` scripts produced by `utils.sh` don’t support MATE, so MATE+PROOT users can’t start/stop the correct desktop session.

### Issue Context
The PR adds MATE, but only some script installation paths were updated.

### Fix Focus Areas
- utils.sh[234-355]
 - Add a `mate)` branch to launch `mate-session`
 - Update accepted values text to include mate
- utils.sh[362-412]
 - Add detection/kill of `mate-session` and window manager `marco` (similar to mate.sh)
- src/start[1-122]
 - If this file is distributed/used as a template, add MATE support consistently

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

6. Message refresh ignores download errors 📘 Rule violation ⛯ Reliability
Description
Message refresh silently ignores curl failures, potentially leaving stale or partially downloaded
message files without notifying the user. This reduces debuggability and can cause unexpected
behavior later when messages are loaded.
Code

lib/i18n_loader.sh[R83-90]

+    if [ "$_needs_refresh" = "true" ]; then
+        mkdir -p "$SCRIPT_DIR/i18n/messages"
+        local _base_url="${_BOOTSTRAP_BASE_URL:-https://raw.githubusercontent.com/devohmycode/OhMyTermux/$BRANCH}"
+        for _lang in en fr; do
+            curl -fL -s -o "$SCRIPT_DIR/i18n/messages/${_lang}.sh" \
+                "$_base_url/i18n/messages/${_lang}.sh" 2>/dev/null || true
+        done
+    fi
Evidence
The rule requires meaningful error handling; curl ... || true explicitly swallows failures and
provides no actionable context or recovery behavior if the refresh cannot be performed.

Rule 3: Generic: Robust Error Handling and Edge Case Management
lib/i18n_loader.sh[83-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`lib/i18n_loader.sh` refresh logic uses `curl ... || true`, which suppresses download failures and can overwrite message files with incomplete content.

## Issue Context
The loader is meant to keep i18n files in sync with `BRANCH`/`MSG_I18N_VERSION`, but it must degrade gracefully and be debuggable when downloads fail.

## Fix Focus Areas
- lib/i18n_loader.sh[83-90]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. mate.sh not cached 🐞 Bug ⛯ Reliability
Description
install.sh’s end-of-run “Saving the installation scripts” step moves xfce.sh and lxqt.sh into the
config cache but omits mate.sh, so it won’t be available offline/reused and may be left behind
unexpectedly.
Code

install.sh[R2539-2540]

+mv -f xfce.sh lxqt.sh proot.sh utils.sh install.sh $OHMYTERMUX_CONFIG_DIR/ >/dev/null 2>&1
+rm -f xfce.sh lxqt.sh proot.sh utils.sh install.sh >/dev/null 2>&1
Evidence
The script explicitly moves and removes a list of installer scripts, but mate.sh is missing from
both lists despite being downloaded/executed for MATE installs.

install.sh[2537-2540]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`mate.sh` is downloaded/executed but not included in the final script caching/cleanup step.

### Issue Context
This affects offline reuse and leaves inconsistent state compared to XFCE/LXQt.

### Fix Focus Areas
- install.sh[2537-2540]
 - Add `mate.sh` to both the `mv -f ...` and `rm -f ...` lists

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. --lang parsing shifts args 🐞 Bug ✓ Correctness
Description
lxqt.sh and mate.sh pre-parse --lang by looping over "$@" while calling shift, which mutates
positional parameters and can break subsequent option parsing (e.g., dropping flags).
Code

lxqt.sh[R15-25]

+for ARG in "$@"; do
+    case $ARG in
+        --lang|-l)
+            shift
+            if [ -n "$1" ]; then
+                OVERRIDE_LANG="$1"
+                shift
+            else
+                echo "Error: --lang requires an argument (ex: --lang fr)" >&2
+                exit 1
+            fi
Evidence
Both scripts shift positional parameters inside a for ARG in "$@" loop. This pattern is not safe
because it changes $1/$@ during iteration and before the main parsing loop, potentially skipping
arguments or misreading values.

lxqt.sh[15-25]
mate.sh[15-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Argument pre-parsing for `--lang` shifts positional parameters during a `for ARG in &quot;$@&quot;` loop, which can corrupt later argument parsing.

### Issue Context
The scripts later do a second pass over args for other options; pre-parsing should not mutate `$@`.

### Fix Focus Areas
- lxqt.sh[15-30]
- mate.sh[15-30]
 - Replace the loop with an index-based scan (no `shift`), or unify into a single robust option parser

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread install.sh
Comment on lines +75 to 86
# Always try to refresh i18n_loader.sh; fall back to cached version if download fails
_loader_tmp=$(mktemp 2>/dev/null || echo "$SCRIPT_DIR/lib/i18n_loader.sh.tmp")
if curl -fL -s -o "$_loader_tmp" "$_loader_url" 2>/dev/null && head -1 "$_loader_tmp" 2>/dev/null | grep -q "^#!/bin/bash"; then
mv "$_loader_tmp" "$SCRIPT_DIR/lib/i18n_loader.sh"
else
rm -f "$_loader_tmp" 2>/dev/null
if [ ! -f "$SCRIPT_DIR/lib/i18n_loader.sh" ]; then
echo "Warning: Could not download i18n_loader.sh and no cached version available" >&2
fi
fi
I18N_DEFER_INIT=true
source "$SCRIPT_DIR/lib/i18n_loader.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. i18n_loader.sh sourced without guard 📘 Rule violation ⛯ Reliability

If the download fails and no cached i18n_loader.sh exists, the scripts still source it, causing
hard-to-diagnose runtime failures. This is not graceful degradation and provides limited actionable
recovery for users.
Agent Prompt
## Issue description
The scripts attempt to download `lib/i18n_loader.sh`, but if the download fails and there is no cached copy, they still run `source "$SCRIPT_DIR/lib/i18n_loader.sh"`. This can lead to immediate failures without a controlled fallback.

## Issue Context
This affects `install.sh`, `lxqt.sh`, and `mate.sh` and violates robust error-handling expectations.

## Fix Focus Areas
- install.sh[75-86]
- lxqt.sh[35-47]
- mate.sh[35-47]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread install.sh
Comment on lines +225 to +233
--desktop|-de)
DESKTOP_CHOICE=true
ONLY_GUM=false
shift
if [ -n "$1" ] && [[ "$1" =~ ^(xfce|lxqt|mate)$ ]]; then
DESKTOP_ENV="$1"
shift
fi
;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. --desktop invalid value ignored 📘 Rule violation ✓ Correctness

When --desktop is provided with a missing/invalid value, the script silently continues instead of
failing with a clear error. This can lead to unintended defaults or interactive prompts in
non-interactive usage.
Agent Prompt
## Issue description
`install.sh --desktop` silently ignores invalid or missing values instead of rejecting them with an actionable error.

## Issue Context
This is a user-controlled external input and should be validated explicitly; silent fallback can break automation.

## Fix Focus Areas
- install.sh[225-233]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread install.sh
Comment on lines +2179 to +2182
# Read desktop configuration
CONFIG_FILE="$OHMYTERMUX_CONFIG_DIR/desktop.conf"
DESKTOP_SESSION="xfce"
[ -f "\$CONFIG_FILE" ] && source "\$CONFIG_FILE"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. desktop.conf sourced unsafely 📘 Rule violation ⛨ Security

The generated scripts load desktop.conf using source, which executes its contents as shell code.
Because this file is user-writable, it can be used for command injection when the start/stop scripts
run.
Agent Prompt
## Issue description
`desktop.conf` is loaded with `source`, so its contents are executed as shell code, enabling command injection if the file is modified.

## Issue Context
`desktop.conf` is stored under the user's config directory and is user-writable; it should be treated as untrusted input.

## Fix Focus Areas
- install.sh[2119-2122]
- install.sh[2179-2182]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread install.sh
Comment on lines +2115 to +2170
install_desktop_scripts() {
local de_name="XFCE"
local msg_config_key="MSG_CONFIG_XFCE_SCRIPTS"

# Read desktop config
if [ -f "$OHMYTERMUX_CONFIG_DIR/desktop.conf" ]; then
source "$OHMYTERMUX_CONFIG_DIR/desktop.conf"
fi

case "${DESKTOP_SESSION:-xfce}" in
lxqt)
de_name="LXQt"
msg_config_key="MSG_CONFIG_LXQT_SCRIPTS"
;;
esac

title_msg "$(t "$msg_config_key")"

# Installation of the start script
cat <<'EOF' > start
cat <<EOF > start
#!/bin/bash

# Read desktop configuration
DESKTOP_SESSION="${DESKTOP_SESSION:-xfce}"

# Activate PulseAudio on the network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
XDG_RUNTIME_DIR=\${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
sleep 1

am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1

env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
case "\$DESKTOP_SESSION" in
lxqt)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session startlxqt & > /dev/null 2>&1
;;
*)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
;;
esac

# Set the audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1

sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
kill "$process_id" > /dev/null 2>&1

case "\$DESKTOP_SESSION" in
xfce|"")
process_id=\$(ps -aux | grep '[x]fce4-screensaver' | awk '{print \$2}')
[ -n "\$process_id" ] && kill "\$process_id" > /dev/null 2>&1
;;
esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Mate start/stop broken 🐞 Bug ✓ Correctness

install.sh always installs its own start/kill scripts (when PROOT is false), but those scripts only
support XFCE/LXQt; with DESKTOP_SESSION=mate they fall back to XFCE, so MATE installs won’t
start/stop correctly.
Agent Prompt
### Issue description
`install.sh` generates and installs `start` and `kill_termux_x11` scripts that only handle XFCE/LXQt. When the user selects MATE, these scripts still get installed and will start/stop the wrong session.

### Issue Context
The PR goal is DE-aware start/stop based on `desktop.conf` (and fallbacks), but `install_desktop_scripts()` currently does not implement MATE.

### Fix Focus Areas
- install.sh[2115-2227]
  - Extend the DE selection logic to include `mate`
  - In the generated `start` script: add a `mate)` branch that launches `mate-session`
  - In the generated `kill_termux_x11`: add a `mate)` branch that finds/kills `mate-session` (and likely `marco`) and uses `de_name="MATE"`
  - Prefer runtime reading of `desktop.conf` instead of embedding a fixed DESKTOP_SESSION at generation-time (consider using a quoted heredoc and explicit `source "$HOME/.config/OhMyTermux/desktop.conf"` at runtime)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread utils.sh
Comment on lines +236 to +354
# Start Termux-X11 with XFCE or LXQt depending on the installed DE
#------------------------------------------------------------------------------
cat <<'EOF' > start
#!/bin/bash

# Enable PulseAudio on the network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
# ---------------------------------------------------------------------------
# OhMyTermux - start
# Démarre Termux-X11 avec XFCE ou LXQt selon l'environnement installé
# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------
# NETTOYAGE DU SERVEUR X EXISTANT
# ---------------------------------------------------------------------------
pkill -f "termux.x11" > /dev/null 2>&1
pkill -f "Xwayland" > /dev/null 2>&1
pkill -f "xfce4-session" > /dev/null 2>&1
pkill -f "lxqt-session" > /dev/null 2>&1
pkill -f "startlxqt" > /dev/null 2>&1
pkill -f "openbox" > /dev/null 2>&1
sleep 1

am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1
# Supprimer les verrous X11 résiduels
rm -f /tmp/.X1-lock > /dev/null 2>&1
rm -f /tmp/.X11-unix/X1 > /dev/null 2>&1

# ---------------------------------------------------------------------------
# DÉTECTER L'ENVIRONNEMENT DE BUREAU
# ---------------------------------------------------------------------------
DESKTOP_SESSION="unknown"
OHMYTERMUX_CONFIG="$HOME/.config/OhMyTermux"

# 1. Lire depuis desktop.conf (priorité haute - écrit par install.sh / lxqt.sh)
if [ -f "$OHMYTERMUX_CONFIG/desktop.conf" ]; then
source "$OHMYTERMUX_CONFIG/desktop.conf"
fi

MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1
# 2. Fallback : lire depuis theme_config.tmp (écrit par lxqt.sh)
if [ "$DESKTOP_SESSION" = "unknown" ] || [ -z "$DESKTOP_SESSION" ]; then
if [ -f "$OHMYTERMUX_CONFIG/theme_config.tmp" ]; then
DETECTED=$(grep '^DESKTOP_ENV=' "$OHMYTERMUX_CONFIG/theme_config.tmp" | cut -d'=' -f2 | tr -d '"')
[ -n "$DETECTED" ] && DESKTOP_SESSION="$DETECTED"
fi
fi

#GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.0 program
# 3. Fallback final : détecter par la présence des binaires
if [ "$DESKTOP_SESSION" = "unknown" ] || [ -z "$DESKTOP_SESSION" ]; then
if command -v startlxqt > /dev/null 2>&1 || command -v lxqt-session > /dev/null 2>&1; then
DESKTOP_SESSION="lxqt"
elif command -v xfce4-session > /dev/null 2>&1; then
DESKTOP_SESSION="xfce"
else
echo "[start] Aucun environnement de bureau détecté (xfce4-session ou startlxqt)."
exit 1
fi
fi

#MESA_LOADER_DRIVER_OVERRIDE=zink TU_DEBUG=noconform program
# ---------------------------------------------------------------------------
# PULSEAUDIO
# ---------------------------------------------------------------------------
pulseaudio --start \
--load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" \
--exit-idle-time=-1 > /dev/null 2>&1

env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
export PULSE_SERVER=127.0.0.1

# Set the audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1
# ---------------------------------------------------------------------------
# DÉMARRER TERMUX-X11
# ---------------------------------------------------------------------------
XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 &> /dev/null &
sleep 1

sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
kill "$process_id" > /dev/null 2>&1
# Ouvrir l'activité Termux-X11
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

# ---------------------------------------------------------------------------
# VIRGL (rendu GPU)
# ---------------------------------------------------------------------------
GPU_VENDOR="unknown"
if [ -f "$OHMYTERMUX_CONFIG/gpu_vendor" ]; then
GPU_VENDOR=$(cat "$OHMYTERMUX_CONFIG/gpu_vendor")
fi

if [ "$GPU_VENDOR" = "adreno" ]; then
MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 \
virgl_test_server_android --angle-gl &> /dev/null &
else
MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 \
virgl_test_server_android &> /dev/null &
fi
sleep 1

# ---------------------------------------------------------------------------
# DÉMARRER LA SESSION DE BUREAU
# ---------------------------------------------------------------------------
export DISPLAY=:1.0
export GALLIUM_DRIVER=virpipe

case "$DESKTOP_SESSION" in
lxqt)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe \
dbus-launch --exit-with-session startlxqt &> /dev/null &
sleep 5
process_id=$(ps -aux | grep '[x]screensaver' | awk '{print $2}')
[ -n "$process_id" ] && kill "$process_id" > /dev/null 2>&1
;;
xfce)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe \
dbus-launch --exit-with-session xfce4-session &> /dev/null &
sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
[ -n "$process_id" ] && kill "$process_id" > /dev/null 2>&1
;;
*)
echo "[start] Environnement de bureau non reconnu : $DESKTOP_SESSION"
echo " Valeurs acceptées : xfce, lxqt"
exit 1
;;
esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Proot path lacks mate 🐞 Bug ✓ Correctness

The start/stop scripts installed via utils.sh (used in PROOT flows) and the tracked src/start script
only recognize xfce/lxqt. In MATE+PROOT installs, utils.sh can overwrite mate.sh’s more complete
scripts, leaving no way to start/stop MATE properly.
Agent Prompt
### Issue description
In PROOT installs, the `start`/`kill_termux_x11` scripts produced by `utils.sh` don’t support MATE, so MATE+PROOT users can’t start/stop the correct desktop session.

### Issue Context
The PR adds MATE, but only some script installation paths were updated.

### Fix Focus Areas
- utils.sh[234-355]
  - Add a `mate)` branch to launch `mate-session`
  - Update accepted values text to include mate
- utils.sh[362-412]
  - Add detection/kill of `mate-session` and window manager `marco` (similar to mate.sh)
- src/start[1-122]
  - If this file is distributed/used as a template, add MATE support consistently

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
utils.sh (1)

366-425: ⚠️ Potential issue | 🟠 Major

Stop script in utils.sh also missing MATE process handling.

The kill_termux_x11 script generated here kills xfce4-session, lxqt-session, openbox, and virgl_test_server, but does not handle mate-session or marco. The dynamic message check on line 408 also only checks for $lxqt_pid but not any MATE process ID.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@utils.sh` around lines 366 - 425, The kill_termux_x11 script is missing MATE
session handling; add pgrep assignments for mate-session and marco (e.g.,
mate_pid and marco_pid) alongside the existing
termux_x11_pid/xfce_pid/lxqt_pid/openbox_pid/virgl_pid, add conditional kill -9
blocks for $mate_pid and $marco_pid (silencing errors), and include those
variables in the final dynamic-message test (the if that currently checks
termux_x11_pid, xfce_pid, lxqt_pid) so the success/failure zenity message
reflects MATE sessions as well.
i18n/messages/en.sh (1)

249-249: ⚠️ Potential issue | 🟡 Minor

Pre-existing: French text in the English message file.

MSG_INSTALL_POWERLEVEL10K_PROGRESS contains "Installation de PowerLevel10k" (French) instead of "Installation of PowerLevel10k". This is an existing defect in a file being actively modified — good moment to fix it.

🐛 Proposed fix
-MSG_INSTALL_POWERLEVEL10K_PROGRESS="Installation de PowerLevel10k"
+MSG_INSTALL_POWERLEVEL10K_PROGRESS="Installation of PowerLevel10k"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@i18n/messages/en.sh` at line 249, Replace the French text in the English
messages constant MSG_INSTALL_POWERLEVEL10K_PROGRESS with the correct English
phrase; locate the MSG_INSTALL_POWERLEVEL10K_PROGRESS definition and change its
value from "Installation de PowerLevel10k" to "Installation of PowerLevel10k" so
the English locale file contains the proper English message.
🧹 Nitpick comments (5)
src/start (1)

30-32: Sourcing desktop.conf executes arbitrary shell code.

source "$OHMYTERMUX_CONFIG/desktop.conf" will execute any code in that file, not just read DESKTOP_SESSION. Since it's in the user's home directory, risk is low, but a safer alternative would be to grep for the specific variable as done with theme_config.tmp in the next fallback block.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/start` around lines 30 - 32, The snippet sources the user file
desktop.conf (source "$OHMYTERMUX_CONFIG/desktop.conf"), which can execute
arbitrary code; instead, stop sourcing and extract only the DESKTOP_SESSION
value like the theme_config.tmp fallback does: read or grep for the
DESKTOP_SESSION key within "$OHMYTERMUX_CONFIG/desktop.conf" (and validate/trim
quotes) and export or assign it to DESKTOP_SESSION if found, avoiding executing
the file contents; reference OHMYTERMUX_CONFIG, desktop.conf, DESKTOP_SESSION
and the existing theme_config.tmp extraction approach when implementing the
change.
install.sh (1)

225-233: --desktop without a valid argument silently leaves DESKTOP_ENV empty.

If --desktop is followed by an unrecognized value (e.g., --desktop kde), the value is not consumed and DESKTOP_ENV stays empty, which later triggers the interactive selection. This is acceptable behavior but may confuse CLI users who expect an error. Consider adding an explicit warning for invalid desktop values.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 225 - 233, The --desktop|-de case currently only
sets DESKTOP_ENV when the next token matches ^(xfce|lxqt|mate)$ and otherwise
leaves the unrecognized value unconsumed causing surprising interactive
fallback; update the case block to detect when a next argument exists but does
not match the allowed set, print a concise warning to stderr mentioning the
invalid desktop value, and shift to consume that token (so it isn't treated as a
separate flag), while keeping DESKTOP_CHOICE=true and ONLY_GUM=false; reference
the --desktop|-de case and the DESKTOP_ENV variable when implementing this
change.
mate.sh (1)

342-343: Icons installed unconditionally, inconsistent with LXQt's gated approach.

install_icons() is called for all MATE versions (line 343), but in lxqt.sh (line 440-442) it's gated behind if [ "$LXQT_VERSION" = "recommended" ]. This means minimal MATE installs get Papirus icons while minimal LXQt installs don't. If this is intentional, consider adding a comment; otherwise, gate it similarly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mate.sh` around lines 342 - 343, The install_icons() call is unconditional;
mirror LXQt's gating by wrapping or guarding the install_icons invocation with
the same version check used in lxqt.sh (e.g., check a MATE_VERSION variable like
if [ "$MATE_VERSION" = "recommended" ] or reuse the existing LXQT-style
conditional) so icons are only installed for the "recommended" MATE flavor (or
add a clarifying comment if unconditional behavior is intentional); update the
call to reference the install_icons() function and the version variable used
elsewhere in the script.
i18n/messages/fr.sh (1)

1-11: Suppress pervasive SC2034 false positives with a file-level directive.

All variables in this definitions file are consumed externally via source. ShellCheck flags every one of them (80+ warnings). A single disable directive at the top of the file is the idiomatic fix.

♻️ Suggested directive placement
 #!/bin/bash
+# shellcheck disable=SC2034  # Variables are sourced/used externally

 # =============================================================================
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@i18n/messages/fr.sh` around lines 1 - 11, Add a file-level ShellCheck disable
for SC2034 to suppress the false positives caused by variables (e.g.,
MSG_I18N_VERSION and the other exported message variables) that are only
referenced when the file is sourced; place the directive immediately after the
shebang so ShellCheck ignores unused-variable warnings for this whole file while
keeping the rest of the file unchanged.
i18n/messages/en.sh (1)

1-11: Same SC2034 noise — add a file-level # shellcheck disable=SC2034.

Same as fr.sh: all variables here are sourced externally; a single top-level directive eliminates ~80 false-positive warnings.

♻️ Suggested directive placement
 #!/bin/bash
+# shellcheck disable=SC2034  # Variables are sourced/used externally

 # =============================================================================
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@i18n/messages/en.sh` around lines 1 - 11, The file emits ShellCheck SC2034
false positives because exported message variables like MSG_I18N_VERSION are
only referenced when the file is sourced; add a top-level ShellCheck directive
(e.g., a file-level "# shellcheck disable=SC2034" comment) near the top of
i18n/messages/en.sh to suppress these warnings for the whole file so variables
such as MSG_I18N_VERSION are not flagged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@i18n/messages/en.sh`:
- Line 31: Update the MSG_OPT_DESKTOP string so its help text lists MATE as a
valid option; locate the MSG_OPT_DESKTOP variable definition and change the
parenthetical from "(xfce or lxqt)" to something like "(xfce, lxqt or mate)" so
the message accurately reflects all supported desktop environment choices.

In `@i18n/messages/fr.sh`:
- Around line 394-397: Update the hard-coded "XFCE" strings for
MSG_KILL_X11_GET_PIDS, MSG_KILL_X11_SESSIONS_CLOSED, and MSG_KILL_X11_NOT_FOUND
to a DE-agnostic term (e.g., "DE" or "desktop") so messages are correct for
MATE/LXQt; locate these symbols in the file and replace the literal "XFCE" with
the chosen neutral word in their French translations, keeping surrounding
phrasing and punctuation intact and matching existing capitalization/grammar.
- Line 31: Update the French help string for MSG_OPT_DESKTOP to include the
newly supported "mate" desktop; locate the MSG_OPT_DESKTOP definition and change
its value so the parenthetical lists all three options (xfce, lxqt et mate) in
French, e.g. replacing "(xfce ou lxqt)" with a phrase that mentions mate as
well.

In `@install.sh`:
- Around line 2124-2130: The branch handling DESKTOP_SESSION == "lxqt" assigns
de_name="LXQt" but de_name is never used; remove the unused assignment or use it
consistently. Edit the case block that matches lxqt to either delete the
de_name="LXQt" line or replace references to msg_config_key elsewhere with
de_name where appropriate (or set msg_config_key from de_name), ensuring only
the necessary variable (msg_config_key or de_name) remains and no unused
variables are left.
- Around line 2482-2489: The desktop script generation is inconsistent:
install_desktop_scripts is skipped when PROOT_CHOICE=true causing install_proot
→ install_utils (utils.sh) to generate scripts that lack full MATE support and
may overwrite later; fix by centralizing script generation into a single helper
(e.g., generate_desktop_scripts) that implements full support for all three DEs
(including MATE) and invoke that helper from both the non-PROOT path (after
install_desktop) and the PROOT path (from install_proot/install_utils) — or
alternatively make install_utils call install_desktop_scripts (or source the
same logic) after install_proot to ensure the canonical, MATE-capable scripts
are produced and not overwritten.
- Around line 2112-2170: install_desktop_scripts currently only special-cases
lxqt and defaults everything else to XFCE, so DESKTOP_SESSION=mate will launch
xfce4-session and kill xfce-related processes; update install_desktop_scripts to
add a mate branch: set de_name and msg_config_key for "mate", and in the
generated start script's case on "$DESKTOP_SESSION" add a "mate)" branch that
starts mate-session (env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch
--exit-with-session mate-session & ...) instead of the default xfce4-session;
likewise update the stop/cleanup script case that currently looks for
xfce4-screensaver/xfce4-session to handle "mate" (use mate-session and the
proper mate process names to kill) so MATE users launch and stop mate sessions
correctly.

In `@lib/i18n_loader.sh`:
- Around line 83-91: The _check_and_refresh_messages function currently writes
downloads directly to "$SCRIPT_DIR/i18n/messages/${_lang}.sh" and silences
failures; change it to download each file to a secure temporary file (e.g.,
"${SCRIPT_DIR}/i18n/messages/${_lang}.sh.tmp" or mktemp), verify the curl exit
status and file integrity (non-empty or valid shell syntax), then atomically mv
the temp file to "${_lang}.sh"; remove the trailing "|| true" so failures are
detected and ensure mkdir -p still runs before using the temp path; keep
references to SCRIPT_DIR, _base_url, and the for _lang in en fr loop to locate
where to implement this.

In `@mate.sh`:
- Around line 495-545: The stop script generated for kill_termux_x11 lacks the
Termux app termination block; update the here-doc that creates
"$PREFIX/bin/kill_termux_x11" to append the same Termux termination logic used
in lxqt.sh/utils.sh/install_desktop_scripts(): after the zenity dialogs check
termux_info/termux_x11_pid (variable termux_x11_pid) and call termux-info/kill
on the Termux app PID (e.g., kill "$pid" or kill -9 "$termux_x11_pid") if
present, ensuring the Termux app process is terminated just like in the other
stop scripts.
- Around line 176-178: The local variable version in configure_mate() is unused;
either remove the version parameter from configure_mate and its local assignment
to stop the false positive, or use it like configure_lxqt to apply different
Mate configuration for "minimal" vs "recommended" (e.g., conditional
Kvantum/theme steps) so the parameter is meaningful; update the function
signature and all callers if you remove the parameter, or add a version-based
conditional inside configure_mate() referencing the existing local version="$1"
to drive differing configuration paths.

In `@src/start`:
- Line 51: Replace the hardcoded French echo messages with the project's i18n
system (or at minimum English strings) so user-facing text is consistent; locate
the echo statements that print "Aucun environnement de bureau détecté
(xfce4-session ou startlxqt).", "Lancement de LXQt...", "Environnement de bureau
non reconnu" in the start script and the embedded start scripts in utils.sh (the
block around the start logic), and change them to call the i18n helper (e.g.,
i18n.t("desktop.no_environment") or similar) or replace the literal French text
with equivalent English messages; ensure the same change is applied to the other
echoed lines referenced (around the other occurrences) and keep existing
logging/exit behavior intact.
- Around line 3-6: The start script lacks MATE support: add cleanup pkill
targets for "mate-session" and "marco" where other desktops are cleaned up,
extend the desktop-binary fallback detection to check for MATE binaries (e.g.,
"mate-session" and "marco") alongside xfce/lxqt, and add a MATE branch in the
session handler to launch mate-session (mirroring how XFCE and LXQt cases are
handled); ensure the same symbols referenced in the PR (_update_start_script(),
mate-session, marco) are used so the installed/inline start script behaves
identically whether overwritten or not.

In `@utils.sh`:
- Around line 236-354: The generated start/stop scripts in utils.sh and
install_desktop_scripts() lack MATE support and overwrite correct mate.sh
versions; update both places to add MATE handling by: (1) adding pkill entries
for "mate-session" and "marco" in the start script cleanup, (2) adding MATE
detection in the desktop detection fallback (check command -v mate-session/marco
and set DESKTOP_SESSION="mate"), (3) adding a mate case in the session launch
case block that launches mate-session (with same DISPLAY/GALLIUM env +
dbus-launch pattern) and kills any mate screensaver processes, and (4) in the
stop script add mate_pid and marco_pid variables and include them in the
kill/cleanup logic so stop properly terminates mate-session and marco; apply
these same edits inside install_desktop_scripts() so neither path overwrites a
complete MATE-capable start/stop script.

In `@xfce.sh`:
- Around line 37-47: The current block attempts to source
"$SCRIPT_DIR/lib/i18n_loader.sh" unconditionally (see the use of _loader_tmp,
_loader_url and the final source line), which will crash if the download failed
and no cached file exists; change the flow to only source the file when it
actually exists (e.g., test -f "$SCRIPT_DIR/lib/i18n_loader.sh") and otherwise
handle the error path by exiting non-zero or skipping functionality that depends
on the loader; apply the same guard/fix to the identical blocks in proot.sh,
utils.sh, lxqt.sh, mate.sh and install.sh so they do not attempt to source a
missing i18n_loader.sh.

---

Outside diff comments:
In `@i18n/messages/en.sh`:
- Line 249: Replace the French text in the English messages constant
MSG_INSTALL_POWERLEVEL10K_PROGRESS with the correct English phrase; locate the
MSG_INSTALL_POWERLEVEL10K_PROGRESS definition and change its value from
"Installation de PowerLevel10k" to "Installation of PowerLevel10k" so the
English locale file contains the proper English message.

In `@utils.sh`:
- Around line 366-425: The kill_termux_x11 script is missing MATE session
handling; add pgrep assignments for mate-session and marco (e.g., mate_pid and
marco_pid) alongside the existing
termux_x11_pid/xfce_pid/lxqt_pid/openbox_pid/virgl_pid, add conditional kill -9
blocks for $mate_pid and $marco_pid (silencing errors), and include those
variables in the final dynamic-message test (the if that currently checks
termux_x11_pid, xfce_pid, lxqt_pid) so the success/failure zenity message
reflects MATE sessions as well.

---

Nitpick comments:
In `@i18n/messages/en.sh`:
- Around line 1-11: The file emits ShellCheck SC2034 false positives because
exported message variables like MSG_I18N_VERSION are only referenced when the
file is sourced; add a top-level ShellCheck directive (e.g., a file-level "#
shellcheck disable=SC2034" comment) near the top of i18n/messages/en.sh to
suppress these warnings for the whole file so variables such as MSG_I18N_VERSION
are not flagged.

In `@i18n/messages/fr.sh`:
- Around line 1-11: Add a file-level ShellCheck disable for SC2034 to suppress
the false positives caused by variables (e.g., MSG_I18N_VERSION and the other
exported message variables) that are only referenced when the file is sourced;
place the directive immediately after the shebang so ShellCheck ignores
unused-variable warnings for this whole file while keeping the rest of the file
unchanged.

In `@install.sh`:
- Around line 225-233: The --desktop|-de case currently only sets DESKTOP_ENV
when the next token matches ^(xfce|lxqt|mate)$ and otherwise leaves the
unrecognized value unconsumed causing surprising interactive fallback; update
the case block to detect when a next argument exists but does not match the
allowed set, print a concise warning to stderr mentioning the invalid desktop
value, and shift to consume that token (so it isn't treated as a separate flag),
while keeping DESKTOP_CHOICE=true and ONLY_GUM=false; reference the
--desktop|-de case and the DESKTOP_ENV variable when implementing this change.

In `@mate.sh`:
- Around line 342-343: The install_icons() call is unconditional; mirror LXQt's
gating by wrapping or guarding the install_icons invocation with the same
version check used in lxqt.sh (e.g., check a MATE_VERSION variable like if [
"$MATE_VERSION" = "recommended" ] or reuse the existing LXQT-style conditional)
so icons are only installed for the "recommended" MATE flavor (or add a
clarifying comment if unconditional behavior is intentional); update the call to
reference the install_icons() function and the version variable used elsewhere
in the script.

In `@src/start`:
- Around line 30-32: The snippet sources the user file desktop.conf (source
"$OHMYTERMUX_CONFIG/desktop.conf"), which can execute arbitrary code; instead,
stop sourcing and extract only the DESKTOP_SESSION value like the
theme_config.tmp fallback does: read or grep for the DESKTOP_SESSION key within
"$OHMYTERMUX_CONFIG/desktop.conf" (and validate/trim quotes) and export or
assign it to DESKTOP_SESSION if found, avoiding executing the file contents;
reference OHMYTERMUX_CONFIG, desktop.conf, DESKTOP_SESSION and the existing
theme_config.tmp extraction approach when implementing the change.

Comment thread i18n/messages/en.sh
MSG_OPT_PACKAGE="Install packages module"
MSG_OPT_FONT="Install font module"
MSG_OPT_XFCE="Install XFCE module"
MSG_OPT_DESKTOP="Install desktop environment module (xfce or lxqt)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

MSG_OPT_DESKTOP description omits mate.

Same issue as fr.sh — the help text only mentions (xfce or lxqt) despite MATE being a valid third option.

🐛 Proposed fix
-MSG_OPT_DESKTOP="Install desktop environment module (xfce or lxqt)"
+MSG_OPT_DESKTOP="Install desktop environment module (xfce, lxqt, or mate)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MSG_OPT_DESKTOP="Install desktop environment module (xfce or lxqt)"
MSG_OPT_DESKTOP="Install desktop environment module (xfce, lxqt, or mate)"
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 31-31: MSG_OPT_DESKTOP appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@i18n/messages/en.sh` at line 31, Update the MSG_OPT_DESKTOP string so its
help text lists MATE as a valid option; locate the MSG_OPT_DESKTOP variable
definition and change the parenthetical from "(xfce or lxqt)" to something like
"(xfce, lxqt or mate)" so the message accurately reflects all supported desktop
environment choices.

Comment thread i18n/messages/fr.sh
MSG_OPT_PACKAGE="Module d'installation des packages"
MSG_OPT_FONT="Module d'installation de la police"
MSG_OPT_XFCE="Module d'installation de XFCE"
MSG_OPT_DESKTOP="Module d'installation de l'environnement de bureau (xfce ou lxqt)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

MSG_OPT_DESKTOP description omits mate.

The PR adds MATE as a third supported desktop environment, but the help string only lists (xfce ou lxqt).

🐛 Proposed fix
-MSG_OPT_DESKTOP="Module d'installation de l'environnement de bureau (xfce ou lxqt)"
+MSG_OPT_DESKTOP="Module d'installation de l'environnement de bureau (xfce, lxqt ou mate)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MSG_OPT_DESKTOP="Module d'installation de l'environnement de bureau (xfce ou lxqt)"
MSG_OPT_DESKTOP="Module d'installation de l'environnement de bureau (xfce, lxqt ou mate)"
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 31-31: MSG_OPT_DESKTOP appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@i18n/messages/fr.sh` at line 31, Update the French help string for
MSG_OPT_DESKTOP to include the newly supported "mate" desktop; locate the
MSG_OPT_DESKTOP definition and change its value so the parenthetical lists all
three options (xfce, lxqt et mate) in French, e.g. replacing "(xfce ou lxqt)"
with a phrase that mentions mate as well.

Comment thread i18n/messages/fr.sh
Comment on lines +394 to +397
MSG_UTILS_COMMENT_CP2MENU="Lancer des programmes à partir du menu de bureau au lieu du terminal"
MSG_UTILS_COMMENT_APP_INSTALLER="Installer des apps indisponibles dans les dépôts Termux / Debian proot"
MSG_UTILS_COMMENT_START_SCRIPT="Démarrer Termux-X11 et XFCE"
MSG_UTILS_COMMENT_STOP_SCRIPT="Stopper Termux-X11 et XFCE"
MSG_UTILS_COMMENT_START_SCRIPT="Démarrer la session de bureau Termux-X11"
MSG_UTILS_COMMENT_STOP_SCRIPT="Arrêter la session de bureau Termux-X11"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Existing MSG_KILL_X11_* strings still hard-code "XFCE" — now user-visible for MATE/LXQt sessions.

Lines 425–429 (MSG_KILL_X11_GET_PIDS, MSG_KILL_X11_SESSIONS_CLOSED, MSG_KILL_X11_NOT_FOUND) still contain "XFCE" verbatim. The PR makes kill_termux_x11 DE-aware, so these messages will be shown to MATE and LXQt users with inaccurate text. Consider generalizing them (e.g., replace "XFCE" with "DE" or "desktop").

🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 394-394: MSG_UTILS_COMMENT_CP2MENU appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 395-395: MSG_UTILS_COMMENT_APP_INSTALLER appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 396-396: MSG_UTILS_COMMENT_START_SCRIPT appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 397-397: MSG_UTILS_COMMENT_STOP_SCRIPT appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@i18n/messages/fr.sh` around lines 394 - 397, Update the hard-coded "XFCE"
strings for MSG_KILL_X11_GET_PIDS, MSG_KILL_X11_SESSIONS_CLOSED, and
MSG_KILL_X11_NOT_FOUND to a DE-agnostic term (e.g., "DE" or "desktop") so
messages are correct for MATE/LXQt; locate these symbols in the file and replace
the literal "XFCE" with the chosen neutral word in their French translations,
keeping surrounding phrasing and punctuation intact and matching existing
capitalization/grammar.

Comment thread install.sh
Comment on lines 2112 to +2170
#------------------------------------------------------------------------------
# INSTALLATION OF THE XFCE SCRIPTS
# INSTALLATION OF THE DESKTOP SCRIPTS
#------------------------------------------------------------------------------
install_xfce_scripts() {
title_msg "$(t MSG_CONFIG_XFCE_SCRIPTS)"
install_desktop_scripts() {
local de_name="XFCE"
local msg_config_key="MSG_CONFIG_XFCE_SCRIPTS"

# Read desktop config
if [ -f "$OHMYTERMUX_CONFIG_DIR/desktop.conf" ]; then
source "$OHMYTERMUX_CONFIG_DIR/desktop.conf"
fi

case "${DESKTOP_SESSION:-xfce}" in
lxqt)
de_name="LXQt"
msg_config_key="MSG_CONFIG_LXQT_SCRIPTS"
;;
esac

title_msg "$(t "$msg_config_key")"

# Installation of the start script
cat <<'EOF' > start
cat <<EOF > start
#!/bin/bash

# Read desktop configuration
DESKTOP_SESSION="${DESKTOP_SESSION:-xfce}"

# Activate PulseAudio on the network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
XDG_RUNTIME_DIR=\${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
sleep 1

am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1

env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
case "\$DESKTOP_SESSION" in
lxqt)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session startlxqt & > /dev/null 2>&1
;;
*)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
;;
esac

# Set the audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1

sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
kill "$process_id" > /dev/null 2>&1

case "\$DESKTOP_SESSION" in
xfce|"")
process_id=\$(ps -aux | grep '[x]fce4-screensaver' | awk '{print \$2}')
[ -n "\$process_id" ] && kill "\$process_id" > /dev/null 2>&1
;;
esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

install_desktop_scripts doesn't handle MATE — will launch XFCE instead.

The generated start script (lines 2134-2171) uses a case with only lxqt and * (default). If DESKTOP_SESSION=mate, the * wildcard matches and launches xfce4-session instead of mate-session. The stop script (lines 2176-2227) has the same issue — it would try to kill xfce4-session for MATE users.

Similarly, install_desktop_scripts only maps lxqt to the LXQt config key (line 2124-2129) with no mate case.

Proposed fix for the start script case block
 case "\$DESKTOP_SESSION" in
     lxqt)
         env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session startlxqt & > /dev/null 2>&1
         ;;
+    mate)
+        env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session mate-session & > /dev/null 2>&1
+        ;;
     *)
         env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
         ;;
 esac

And for the stop script:

 case "\$DESKTOP_SESSION" in
     lxqt)
         de_pid=\$(pgrep -f "lxqt-session")
         de_name="LXQt"
         ;;
+    mate)
+        de_pid=\$(pgrep -f "mate-session")
+        de_name="MATE"
+        ;;
     *)
         de_pid=\$(pgrep -f "xfce4-session")
         de_name="XFCE"
         ;;
 esac
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#------------------------------------------------------------------------------
# INSTALLATION OF THE XFCE SCRIPTS
# INSTALLATION OF THE DESKTOP SCRIPTS
#------------------------------------------------------------------------------
install_xfce_scripts() {
title_msg "$(t MSG_CONFIG_XFCE_SCRIPTS)"
install_desktop_scripts() {
local de_name="XFCE"
local msg_config_key="MSG_CONFIG_XFCE_SCRIPTS"
# Read desktop config
if [ -f "$OHMYTERMUX_CONFIG_DIR/desktop.conf" ]; then
source "$OHMYTERMUX_CONFIG_DIR/desktop.conf"
fi
case "${DESKTOP_SESSION:-xfce}" in
lxqt)
de_name="LXQt"
msg_config_key="MSG_CONFIG_LXQT_SCRIPTS"
;;
esac
title_msg "$(t "$msg_config_key")"
# Installation of the start script
cat <<'EOF' > start
cat <<EOF > start
#!/bin/bash
# Read desktop configuration
DESKTOP_SESSION="${DESKTOP_SESSION:-xfce}"
# Activate PulseAudio on the network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1
XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
XDG_RUNTIME_DIR=\${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
sleep 1
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1
MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
case "\$DESKTOP_SESSION" in
lxqt)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session startlxqt & > /dev/null 2>&1
;;
*)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
;;
esac
# Set the audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1
sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
kill "$process_id" > /dev/null 2>&1
case "\$DESKTOP_SESSION" in
xfce|"")
process_id=\$(ps -aux | grep '[x]fce4-screensaver' | awk '{print \$2}')
[ -n "\$process_id" ] && kill "\$process_id" > /dev/null 2>&1
;;
esac
`#------------------------------------------------------------------------------`
# INSTALLATION OF THE DESKTOP SCRIPTS
`#------------------------------------------------------------------------------`
install_desktop_scripts() {
local de_name="XFCE"
local msg_config_key="MSG_CONFIG_XFCE_SCRIPTS"
# Read desktop config
if [ -f "$OHMYTERMUX_CONFIG_DIR/desktop.conf" ]; then
source "$OHMYTERMUX_CONFIG_DIR/desktop.conf"
fi
case "${DESKTOP_SESSION:-xfce}" in
lxqt)
de_name="LXQt"
msg_config_key="MSG_CONFIG_LXQT_SCRIPTS"
;;
esac
title_msg "$(t "$msg_config_key")"
# Installation of the start script
cat <<EOF > start
#!/bin/bash
# Read desktop configuration
DESKTOP_SESSION="${DESKTOP_SESSION:-xfce}"
# Activate PulseAudio on the network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1
XDG_RUNTIME_DIR=\${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
sleep 1
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1
MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1
case "\$DESKTOP_SESSION" in
lxqt)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session startlxqt & > /dev/null 2>&1
;;
mate)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session mate-session & > /dev/null 2>&1
;;
*)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
;;
esac
# Set the audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1
sleep 5
case "\$DESKTOP_SESSION" in
xfce|"")
process_id=\$(ps -aux | grep '[x]fce4-screensaver' | awk '{print \$2}')
[ -n "\$process_id" ] && kill "\$process_id" > /dev/null 2>&1
;;
esac
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 2126-2126: de_name appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 2112 - 2170, install_desktop_scripts currently only
special-cases lxqt and defaults everything else to XFCE, so DESKTOP_SESSION=mate
will launch xfce4-session and kill xfce-related processes; update
install_desktop_scripts to add a mate branch: set de_name and msg_config_key for
"mate", and in the generated start script's case on "$DESKTOP_SESSION" add a
"mate)" branch that starts mate-session (env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe
dbus-launch --exit-with-session mate-session & ...) instead of the default
xfce4-session; likewise update the stop/cleanup script case that currently looks
for xfce4-screensaver/xfce4-session to handle "mate" (use mate-session and the
proper mate process names to kill) so MATE users launch and stop mate sessions
correctly.

Comment thread install.sh
Comment on lines +2124 to +2130
case "${DESKTOP_SESSION:-xfce}" in
lxqt)
de_name="LXQt"
msg_config_key="MSG_CONFIG_LXQT_SCRIPTS"
;;
esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

de_name variable is set but never used (valid static analysis finding).

Line 2126 sets de_name="LXQt" but it's never referenced. The msg_config_key variable is what's actually used on line 2131. Remove de_name or use it.

🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 2126-2126: de_name appears unused. Verify use (or export if used externally).

(SC2034)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 2124 - 2130, The branch handling DESKTOP_SESSION ==
"lxqt" assigns de_name="LXQt" but de_name is never used; remove the unused
assignment or use it consistently. Edit the case block that matches lxqt to
either delete the de_name="LXQt" line or replace references to msg_config_key
elsewhere with de_name where appropriate (or set msg_config_key from de_name),
ensuring only the necessary variable (msg_config_key or de_name) remains and no
unused variables are left.

Comment thread mate.sh
Comment on lines +495 to +545
cat > "$PREFIX/bin/kill_termux_x11" << STOPEOF
#!/bin/bash

OHMYTERMUX_CONFIG="\$HOME/.config/OhMyTermux"
DESKTOP_SESSION="mate"
[ -f "\$OHMYTERMUX_CONFIG/desktop.conf" ] && source "\$OHMYTERMUX_CONFIG/desktop.conf"

if pgrep -f 'apt|apt-get|dpkg|nala' > /dev/null; then
zenity --info --text="A software is being installed. Please wait before stopping the session."
exit 1
fi

termux_x11_pid=\$(pgrep -f /system/bin/app_process.*com.termux.x11.Loader)
virgl_pid=\$(pgrep -f "virgl_test_server")

case "\$DESKTOP_SESSION" in
mate)
de_pid=\$(pgrep -f "mate-session")
wm_pid=\$(pgrep -f "marco")
de_name="MATE"
;;
lxqt)
de_pid=\$(pgrep -f "lxqt-session")
wm_pid=\$(pgrep -f "openbox")
de_name="LXQt"
;;
*)
de_pid=\$(pgrep -f "xfce4-session")
wm_pid=""
de_name="XFCE"
;;
esac

[ -n "\$termux_x11_pid" ] && kill -9 "\$termux_x11_pid" 2>/dev/null
[ -n "\$de_pid" ] && kill -9 "\$de_pid" 2>/dev/null
[ -n "\$wm_pid" ] && kill -9 "\$wm_pid" 2>/dev/null
[ -n "\$virgl_pid" ] && kill -9 "\$virgl_pid" 2>/dev/null

rm -f /tmp/.X1-lock 2>/dev/null
rm -f /tmp/.X11-unix/X1 2>/dev/null

if [ -n "\$termux_x11_pid" ] || [ -n "\$de_pid" ]; then
zenity --info --title="Session closed" \
--text="Termux-X11 and \$de_name session closed." 2>/dev/null || true
else
zenity --info --title="Session not found" \
--text="Termux-X11 or \$de_name session not found." 2>/dev/null || true
fi
STOPEOF

chmod +x "$PREFIX/bin/kill_termux_x11"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Stop script missing Termux app termination (same as lxqt.sh).

The generated kill_termux_x11 script ends after the zenity dialogs without the termux-info / kill "$pid" block that terminates the Termux app. This is inconsistent with the stop scripts in utils.sh and install.sh:install_desktop_scripts(). See the same issue flagged on lxqt.sh.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mate.sh` around lines 495 - 545, The stop script generated for
kill_termux_x11 lacks the Termux app termination block; update the here-doc that
creates "$PREFIX/bin/kill_termux_x11" to append the same Termux termination
logic used in lxqt.sh/utils.sh/install_desktop_scripts(): after the zenity
dialogs check termux_info/termux_x11_pid (variable termux_x11_pid) and call
termux-info/kill on the Termux app PID (e.g., kill "$pid" or kill -9
"$termux_x11_pid") if present, ensuring the Termux app process is terminated
just like in the other stop scripts.

Comment thread src/start
Comment on lines +3 to +6
# ---------------------------------------------------------------------------
# OhMyTermux - start
# Démarre Termux-X11 avec XFCE ou LXQt selon l'environnement installé
# ---------------------------------------------------------------------------

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check where src/start is referenced/deployed
rg -n 'src/start' --type sh -A 2 -B 2

Repository: devohmycode/OhMyTermux

Length of output: 48


🏁 Script executed:

#!/bin/bash
# Search for references to the start script in install and utility scripts
rg -n '\bstart\b' install.sh utils.sh 2>/dev/null | grep -E '(cp|mv|cat|install|src)' | head -20

Repository: devohmycode/OhMyTermux

Length of output: 660


🏁 Script executed:

#!/bin/bash
# List all files in src directory to understand structure
ls -la src/ 2>/dev/null || echo "src directory check failed"

Repository: devohmycode/OhMyTermux

Length of output: 1197


🏁 Script executed:

#!/bin/bash
# Check lxqt.sh for _update_start_script function
rg -n '_update_start_script' --type sh -A 30

Repository: devohmycode/OhMyTermux

Length of output: 3845


🏁 Script executed:

#!/bin/bash
# Check mate.sh for _update_start_script function  
rg -n '_update_start_script' --type sh -A 30 | grep -A 30 'mate'

Repository: devohmycode/OhMyTermux

Length of output: 3795


🏁 Script executed:

cat -n src/start

Repository: devohmycode/OhMyTermux

Length of output: 5616


🏁 Script executed:

# Check what install.sh does with src/start - does it use it?
rg -n 'src/' install.sh | head -30

Repository: devohmycode/OhMyTermux

Length of output: 1147


🏁 Script executed:

# Check when _update_start_script is called in lxqt.sh and mate.sh
rg -n 'call.*_update_start_script|_update_start_script' lxqt.sh mate.sh install.sh -B 5 -A 2

Repository: devohmycode/OhMyTermux

Length of output: 1560


🏁 Script executed:

sed -n '2130,2180p' install.sh

Repository: devohmycode/OhMyTermux

Length of output: 1579


🏁 Script executed:

# Check utils.sh around line 238 for start script generation
sed -n '235,365p' utils.sh

Repository: devohmycode/OhMyTermux

Length of output: 5001


src/start is missing MATE desktop environment support.

This template script only handles xfce and lxqt, but the PR adds MATE as a third desktop option. The script lacks:

  • pkill cleanup for mate-session and marco (lines 11–16)
  • MATE binary detection in the fallback (lines 44–54)
  • MATE launch case in the session handler (lines 98–122)

The issue is critical because src/start is deployed by utils.sh (line 238) and install.sh (line 2133) generates an inline version with the same gaps. Only lxqt.sh and mate.sh provide complete versions via _update_start_script(), which overwrites the script after installation. If that step is skipped or fails, users selecting MATE will have a non-functional start script.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/start` around lines 3 - 6, The start script lacks MATE support: add
cleanup pkill targets for "mate-session" and "marco" where other desktops are
cleaned up, extend the desktop-binary fallback detection to check for MATE
binaries (e.g., "mate-session" and "marco") alongside xfce/lxqt, and add a MATE
branch in the session handler to launch mate-session (mirroring how XFCE and
LXQt cases are handled); ensure the same symbols referenced in the PR
(_update_start_script(), mate-session, marco) are used so the installed/inline
start script behaves identically whether overwritten or not.

Comment thread src/start
elif command -v xfce4-session > /dev/null 2>&1; then
DESKTOP_SESSION="xfce"
else
echo "[start] Aucun environnement de bureau détecté (xfce4-session ou startlxqt)."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

User-facing messages are hardcoded in French.

All echo messages in this script are in French (e.g., "Aucun environnement de bureau détecté", "Lancement de LXQt...", "Environnement de bureau non reconnu"). Since the rest of the project uses an i18n system, these should either use i18n keys or at minimum be in English for consistency with the project's primary language. The same issue appears in the embedded start scripts within utils.sh (lines 241-354).

Also applies to: 100-100, 109-109, 118-119

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/start` at line 51, Replace the hardcoded French echo messages with the
project's i18n system (or at minimum English strings) so user-facing text is
consistent; locate the echo statements that print "Aucun environnement de bureau
détecté (xfce4-session ou startlxqt).", "Lancement de LXQt...", "Environnement
de bureau non reconnu" in the start script and the embedded start scripts in
utils.sh (the block around the start logic), and change them to call the i18n
helper (e.g., i18n.t("desktop.no_environment") or similar) or replace the
literal French text with equivalent English messages; ensure the same change is
applied to the other echoed lines referenced (around the other occurrences) and
keep existing logging/exit behavior intact.

Comment thread utils.sh
Comment on lines +236 to +354
# Start Termux-X11 with XFCE or LXQt depending on the installed DE
#------------------------------------------------------------------------------
cat <<'EOF' > start
#!/bin/bash

# Enable PulseAudio on the network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 > /dev/null 2>&1

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 & > /dev/null 2>&1
# ---------------------------------------------------------------------------
# OhMyTermux - start
# Démarre Termux-X11 avec XFCE ou LXQt selon l'environnement installé
# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------
# NETTOYAGE DU SERVEUR X EXISTANT
# ---------------------------------------------------------------------------
pkill -f "termux.x11" > /dev/null 2>&1
pkill -f "Xwayland" > /dev/null 2>&1
pkill -f "xfce4-session" > /dev/null 2>&1
pkill -f "lxqt-session" > /dev/null 2>&1
pkill -f "startlxqt" > /dev/null 2>&1
pkill -f "openbox" > /dev/null 2>&1
sleep 1

am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1
# Supprimer les verrous X11 résiduels
rm -f /tmp/.X1-lock > /dev/null 2>&1
rm -f /tmp/.X11-unix/X1 > /dev/null 2>&1

# ---------------------------------------------------------------------------
# DÉTECTER L'ENVIRONNEMENT DE BUREAU
# ---------------------------------------------------------------------------
DESKTOP_SESSION="unknown"
OHMYTERMUX_CONFIG="$HOME/.config/OhMyTermux"

# 1. Lire depuis desktop.conf (priorité haute - écrit par install.sh / lxqt.sh)
if [ -f "$OHMYTERMUX_CONFIG/desktop.conf" ]; then
source "$OHMYTERMUX_CONFIG/desktop.conf"
fi

MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android --angle-gl & > /dev/null 2>&1
# 2. Fallback : lire depuis theme_config.tmp (écrit par lxqt.sh)
if [ "$DESKTOP_SESSION" = "unknown" ] || [ -z "$DESKTOP_SESSION" ]; then
if [ -f "$OHMYTERMUX_CONFIG/theme_config.tmp" ]; then
DETECTED=$(grep '^DESKTOP_ENV=' "$OHMYTERMUX_CONFIG/theme_config.tmp" | cut -d'=' -f2 | tr -d '"')
[ -n "$DETECTED" ] && DESKTOP_SESSION="$DETECTED"
fi
fi

#GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.0 program
# 3. Fallback final : détecter par la présence des binaires
if [ "$DESKTOP_SESSION" = "unknown" ] || [ -z "$DESKTOP_SESSION" ]; then
if command -v startlxqt > /dev/null 2>&1 || command -v lxqt-session > /dev/null 2>&1; then
DESKTOP_SESSION="lxqt"
elif command -v xfce4-session > /dev/null 2>&1; then
DESKTOP_SESSION="xfce"
else
echo "[start] Aucun environnement de bureau détecté (xfce4-session ou startlxqt)."
exit 1
fi
fi

#MESA_LOADER_DRIVER_OVERRIDE=zink TU_DEBUG=noconform program
# ---------------------------------------------------------------------------
# PULSEAUDIO
# ---------------------------------------------------------------------------
pulseaudio --start \
--load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" \
--exit-idle-time=-1 > /dev/null 2>&1

env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session xfce4-session & > /dev/null 2>&1
export PULSE_SERVER=127.0.0.1

# Set the audio server
export PULSE_SERVER=127.0.0.1 > /dev/null 2>&1
# ---------------------------------------------------------------------------
# DÉMARRER TERMUX-X11
# ---------------------------------------------------------------------------
XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :1.0 &> /dev/null &
sleep 1

sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
kill "$process_id" > /dev/null 2>&1
# Ouvrir l'activité Termux-X11
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

# ---------------------------------------------------------------------------
# VIRGL (rendu GPU)
# ---------------------------------------------------------------------------
GPU_VENDOR="unknown"
if [ -f "$OHMYTERMUX_CONFIG/gpu_vendor" ]; then
GPU_VENDOR=$(cat "$OHMYTERMUX_CONFIG/gpu_vendor")
fi

if [ "$GPU_VENDOR" = "adreno" ]; then
MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 \
virgl_test_server_android --angle-gl &> /dev/null &
else
MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 \
virgl_test_server_android &> /dev/null &
fi
sleep 1

# ---------------------------------------------------------------------------
# DÉMARRER LA SESSION DE BUREAU
# ---------------------------------------------------------------------------
export DISPLAY=:1.0
export GALLIUM_DRIVER=virpipe

case "$DESKTOP_SESSION" in
lxqt)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe \
dbus-launch --exit-with-session startlxqt &> /dev/null &
sleep 5
process_id=$(ps -aux | grep '[x]screensaver' | awk '{print $2}')
[ -n "$process_id" ] && kill "$process_id" > /dev/null 2>&1
;;
xfce)
env DISPLAY=:1.0 GALLIUM_DRIVER=virpipe \
dbus-launch --exit-with-session xfce4-session &> /dev/null &
sleep 5
process_id=$(ps -aux | grep '[x]fce4-screensaver' | awk '{print $2}')
[ -n "$process_id" ] && kill "$process_id" > /dev/null 2>&1
;;
*)
echo "[start] Environnement de bureau non reconnu : $DESKTOP_SESSION"
echo " Valeurs acceptées : xfce, lxqt"
exit 1
;;
esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

echo "=== Install.sh: install_desktop, install_proot, install_utils call locations ==="
rg -n 'install_desktop\(|install_proot\(|install_utils\(' install.sh | head -30

echo -e "\n=== Install.sh: install_desktop_scripts call location ==="
rg -n 'install_desktop_scripts' install.sh | head -10

echo -e "\n=== Utils.sh: where start/stop scripts are written ==="
rg -n 'cat.*> start|cat.*> stop|mv start|mv stop' utils.sh

echo -e "\n=== Mate.sh: where start/stop scripts are written ==="
rg -n 'cat.*> start|cat.*> stop|mv start|mv stop' mate.sh

echo -e "\n=== Lxqt.sh: where start/stop scripts are written ==="
rg -n 'cat.*> start|cat.*> stop|mv start|mv stop' lxqt.sh

Repository: devohmycode/OhMyTermux

Length of output: 585


🏁 Script executed:

#!/bin/bash

echo "=== Install.sh main function body - check execution order ==="
sed -n '/^main()/,/^}/p' install.sh | head -100

Repository: devohmycode/OhMyTermux

Length of output: 127


🏁 Script executed:

#!/bin/bash

echo "=== Check if utils.sh is called from install_utils ==="
rg -A 20 'install_utils\(\)' install.sh | head -30

echo -e "\n=== Check if install_proot calls install_utils ==="
rg -A 30 'install_proot\(\)' install.sh | head -40

Repository: devohmycode/OhMyTermux

Length of output: 2110


🏁 Script executed:

#!/bin/bash

echo "=== Check main() execution order ==="
sed -n '/^main() {/,/^}/p' install.sh | grep -E '^\s+(install_|_)' | head -30

echo -e "\n=== Verify mate.sh and lxqt.sh for script generation ==="
echo "--- mate.sh content (check for start/stop script writing) ---"
wc -l mate.sh
echo "--- First 50 lines of mate.sh ---"
head -50 mate.sh

Repository: devohmycode/OhMyTermux

Length of output: 2029


🏁 Script executed:

#!/bin/bash

echo "=== Check if mate.sh writes start/stop scripts (broader search) ==="
rg -i 'start|stop|script' mate.sh | grep -i 'cat\|write\|echo.*>' | head -20

echo -e "\n=== Check lxqt.sh for script writing ==="
rg -i 'start|stop|script' lxqt.sh | grep -i 'cat\|write\|echo.*>' | head -20

echo -e "\n=== Check xfce.sh for script writing ==="
rg -i 'start|stop|script' xfce.sh | grep -i 'cat\|write\|echo.*>' | head -20

Repository: devohmycode/OhMyTermux

Length of output: 515


🏁 Script executed:

#!/bin/bash

echo "=== Where is main() and what's the execution order? ==="
grep -n '^main\|^install_desktop\|^install_utils\|^install_proot\|^install_desktop_scripts' install.sh | tail -20

echo -e "\n=== Check the actual main() calls ==="
sed -n '/^main() {/,/^}$/p' install.sh | grep -E 'install_desktop|install_utils|install_proot|install_desktop_scripts' | head -20

Repository: devohmycode/OhMyTermux

Length of output: 264


🏁 Script executed:

#!/bin/bash

echo "=== Find where main() is invoked and the call order ==="
tail -100 install.sh | head -50

echo -e "\n=== Look for the actual main invocation ==="
rg -n 'main\b' install.sh | tail -5

echo -e "\n=== Get lines around the main call ==="
rg -B 5 -A 15 '^main$' install.sh | head -40

Repository: devohmycode/OhMyTermux

Length of output: 2804


🏁 Script executed:

#!/bin/bash

echo "=== Full install_desktop flow in install.sh ==="
sed -n '1825,1900p' install.sh

echo -e "\n=== Full install_proot flow ==="
sed -n '2252,2310p' install.sh

echo -e "\n=== Full main() definition ==="
grep -n '^main' install.sh
rg -A 100 'if __name__|^main\s*\(' install.sh | head -120

Repository: devohmycode/OhMyTermux

Length of output: 5645


🏁 Script executed:

#!/bin/bash

echo "=== Look at the very end of install.sh for main invocation ==="
tail -50 install.sh

echo -e "\n=== Search for where install_desktop, install_proot, etc are called ==="
rg 'install_desktop\(|install_proot\(|install_utils\(|install_desktop_scripts\(' install.sh

Repository: devohmycode/OhMyTermux

Length of output: 1865


🏁 Script executed:

#!/bin/bash

echo "=== Verify if install_desktop_scripts is actually called anywhere ==="
rg 'install_desktop_scripts' install.sh

echo -e "\n=== Check what install_desktop_scripts does ==="
sed -n '2115,2200p' install.sh

echo -e "\n=== Verify mate.sh actually writes start script (get full function) ==="
rg -A 30 'cat > "\$PREFIX/bin/start"' mate.sh

Repository: devohmycode/OhMyTermux

Length of output: 4118


🏁 Script executed:

#!/bin/bash

echo "=== Check lxqt.sh for start script details ==="
rg -B 5 -A 30 'cat > "\$PREFIX/bin/start"' lxqt.sh | head -50

Repository: devohmycode/OhMyTermux

Length of output: 1535


🏁 Script executed:

#!/bin/bash

echo "=== Find the exact call to install_desktop_scripts ==="
rg -B 5 -A 5 '^\s+install_desktop_scripts' install.sh | head -40

echo -e "\n=== Check if it's called inside install_proot or elsewhere ==="
sed -n '2252,2310p' install.sh | grep -A 60 'install_proot'

Repository: devohmycode/OhMyTermux

Length of output: 3205


🏁 Script executed:

#!/bin/bash

echo "=== Compare: does install_desktop_scripts actually get called in main flow? ==="
echo "Looking for the main function execution block..."
rg -A 80 'type run_hook.*post_packages' install.sh | grep -E 'install_|^--' | head -20

Repository: devohmycode/OhMyTermux

Length of output: 483


🏁 Script executed:

#!/bin/bash

echo "=== Check utils.sh stop script for MATE support ==="
sed -n '358,430p' utils.sh

echo -e "\n=== Check if stop script has MATE case ==="
rg -A 40 'cat <<.*EOF.*> stop' utils.sh | grep -i 'mate\|marco'

echo -e "\n=== Compare install_desktop_scripts stop script ==="
sed -n '2160,2210p' install.sh | grep -A 30 'kill_termux_x11'

Repository: devohmycode/OhMyTermux

Length of output: 2976


Both utils.sh and install_desktop_scripts() in install.sh write incomplete start/stop scripts that lack MATE support and can overwrite correct versions from mate.sh.

The start script (lines 238-354) and stop script (lines 358-430) in utils.sh are missing:

  • pkill for mate-session and marco in start script
  • MATE binary detection (mate-session / marco)
  • MATE case in session launch block
  • mate_pid and marco_pid variables in stop script
  • MATE handling in kill logic

This creates an overwrite problem: if a user installs MATE, the mate.sh script writes complete start/stop scripts handling all three DEs, but then:

  1. If PRoot is chosen: install_proot() → install_utils() → utils.sh overwrites with these incomplete scripts
  2. If PRoot is not chosen: install_desktop_scripts() (also at line 2115 in install.sh) similarly overwrites with incomplete scripts (only handles XFCE and LXQt)

Both locations need MATE support added to their start/stop scripts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@utils.sh` around lines 236 - 354, The generated start/stop scripts in
utils.sh and install_desktop_scripts() lack MATE support and overwrite correct
mate.sh versions; update both places to add MATE handling by: (1) adding pkill
entries for "mate-session" and "marco" in the start script cleanup, (2) adding
MATE detection in the desktop detection fallback (check command -v
mate-session/marco and set DESKTOP_SESSION="mate"), (3) adding a mate case in
the session launch case block that launches mate-session (with same
DISPLAY/GALLIUM env + dbus-launch pattern) and kills any mate screensaver
processes, and (4) in the stop script add mate_pid and marco_pid variables and
include them in the kill/cleanup logic so stop properly terminates mate-session
and marco; apply these same edits inside install_desktop_scripts() so neither
path overwrites a complete MATE-capable start/stop script.

Comment thread xfce.sh
Comment on lines +37 to 47
# Always try to refresh i18n_loader.sh; fall back to cached version if download fails
_loader_tmp=$(mktemp 2>/dev/null || echo "$SCRIPT_DIR/lib/i18n_loader.sh.tmp")
if curl -fL -s -o "$_loader_tmp" "$_loader_url" 2>/dev/null && head -1 "$_loader_tmp" 2>/dev/null | grep -q "^#!/bin/bash"; then
mv "$_loader_tmp" "$SCRIPT_DIR/lib/i18n_loader.sh"
else
rm -f "$_loader_tmp" 2>/dev/null
if [ ! -f "$SCRIPT_DIR/lib/i18n_loader.sh" ]; then
echo "Warning: Could not download i18n_loader.sh and no cached version available" >&2
fi
fi
source "$SCRIPT_DIR/lib/i18n_loader.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

source on line 47 will crash if both download and cache are missing.

When the download fails and no cached i18n_loader.sh exists, the warning is printed (line 44) but execution continues to source a non-existent file, producing an unhandled error and likely aborting the script.

Proposed fix
     if [ ! -f "$SCRIPT_DIR/lib/i18n_loader.sh" ]; then
         echo "Warning: Could not download i18n_loader.sh and no cached version available" >&2
+        exit 1
     fi
 fi
 source "$SCRIPT_DIR/lib/i18n_loader.sh"

This same pattern is duplicated in proot.sh, utils.sh, lxqt.sh, mate.sh, and install.sh — all have the same defect.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Always try to refresh i18n_loader.sh; fall back to cached version if download fails
_loader_tmp=$(mktemp 2>/dev/null || echo "$SCRIPT_DIR/lib/i18n_loader.sh.tmp")
if curl -fL -s -o "$_loader_tmp" "$_loader_url" 2>/dev/null && head -1 "$_loader_tmp" 2>/dev/null | grep -q "^#!/bin/bash"; then
mv "$_loader_tmp" "$SCRIPT_DIR/lib/i18n_loader.sh"
else
rm -f "$_loader_tmp" 2>/dev/null
if [ ! -f "$SCRIPT_DIR/lib/i18n_loader.sh" ]; then
echo "Warning: Could not download i18n_loader.sh and no cached version available" >&2
fi
fi
source "$SCRIPT_DIR/lib/i18n_loader.sh"
# Always try to refresh i18n_loader.sh; fall back to cached version if download fails
_loader_tmp=$(mktemp 2>/dev/null || echo "$SCRIPT_DIR/lib/i18n_loader.sh.tmp")
if curl -fL -s -o "$_loader_tmp" "$_loader_url" 2>/dev/null && head -1 "$_loader_tmp" 2>/dev/null | grep -q "^#!/bin/bash"; then
mv "$_loader_tmp" "$SCRIPT_DIR/lib/i18n_loader.sh"
else
rm -f "$_loader_tmp" 2>/dev/null
if [ ! -f "$SCRIPT_DIR/lib/i18n_loader.sh" ]; then
echo "Warning: Could not download i18n_loader.sh and no cached version available" >&2
exit 1
fi
fi
source "$SCRIPT_DIR/lib/i18n_loader.sh"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@xfce.sh` around lines 37 - 47, The current block attempts to source
"$SCRIPT_DIR/lib/i18n_loader.sh" unconditionally (see the use of _loader_tmp,
_loader_url and the final source line), which will crash if the download failed
and no cached file exists; change the flow to only source the file when it
actually exists (e.g., test -f "$SCRIPT_DIR/lib/i18n_loader.sh") and otherwise
handle the error path by exiting non-zero or skipping functionality that depends
on the loader; apply the same guard/fix to the identical blocks in proot.sh,
utils.sh, lxqt.sh, mate.sh and install.sh so they do not attempt to source a
missing i18n_loader.sh.

@devohmycode
devohmycode merged commit b0f15d8 into main Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant