omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

uwsm app-daemon spikes CPU and spawns zombie when launching Omarchy update via menu

Open Grawave opened this issue 1 year ago • 3 comments

System details

ThinkPad L13, i7-10510U, Cometlake-U UHD, Kernel 6.17.7-arch1-1, Omarchy 3.1.5

What's wrong?

When I select "Update" from omarchy menu, nothing seems to happen, but "top" reveals systemd and uswsm processes with ~50 % CPU usage.

  • journalctl (user) floods with repeated lines like: - received: app -- xdg-terminal-exec -e --working-directory=/home/ - received: app -- xdg-terminal-exec -e bash -c 'omarchy-show-logo; omarchy-update; omarchy- show-done'
    • ps shows python3 /usr/bin/uwsm aux app-daemon high CPU and many zombie uwsm-app children.

Grawave avatar Nov 05 '25 21:11 Grawave

I don't know if this will help but try re-running latest migration migrations/1762121828.sh did that and the same problem disappeared

Yug3ne avatar Nov 06 '25 06:11 Yug3ne

Same issue, Claude saved me.

Updated /usr/bin/xdg-terminal-exec to:

  1. Parse --app-id, --title, and --dir flags
  2. Convert them to terminal-specific flags: - Alacritty: --app-id → --class - Kitty: --app-id → --class - Ghostty: --app-id → --class - Konsole: Handle --title properly
  3. Use proper shell parameter expansion instead of eval to avoid argument parsing issues

Files That Need Updates

  1. /usr/bin/xdg-terminal-exec - Core fix (script provided at /tmp/xdg-terminal-exec-fixed3)
  2. ~/.config/hypr/bindings.conf - Change $TERMINAL to xdg-terminal-exec (related to issue #3200)

Root Causes Found

Issue #1: Terminal binding in bindings.conf

  • File: ~/.config/hypr/bindings.conf
  • Problem: Line had $terminal = uwsm app -- $TERMINAL
  • Fix: Changed to $terminal = uwsm app -- xdg-terminal-exec
  • Related to: GitHub issue #3200

Issue #2: xdg-terminal-exec doesn't handle required flags

  • File: /usr/bin/xdg-terminal-exec
  • Problem: Script doesn't parse --app-id and --title flags that Omarchy menu passes
  • Result: Unknown flags get passed directly to alacritty, causing silent failure
  • Alacritty expects: --class instead of --app-id

Original Script (Broken) Only parses --dir argument

  working_dir=""
  args=""
  while [ $# -gt 0 ]; do
      case "$1" in
          --dir=*)
              working_dir="${1#*=}"
              shift
              ;;
          --dir)
              working_dir="$2"
              shift 2
              ;;
          *)
              args="$args $1"  # Unknown flags get added to args
              shift
              ;;
      esac
  done

Alacritty section - passes unknown flags directly

elif command -v alacritty >/dev/null; then
    if [ -n "$working_dir" ]; then
        exec alacritty --working-directory "$working_dir" $args
    else
        exec alacritty $args  # --app-id goes here and breaks
    fi

Fixed Script

Parse ALL required arguments

working_dir=""
app_id=""
title=""

while [ $# -gt 0 ]; do
    case "$1" in
        --dir=*|--dir)
            # ... same as before ...
            ;;
        --app-id=*)
            app_id="${1#*=}"
            shift
            ;;
        --app-id)
            app_id="$2"
            shift 2
            ;;
        --title=*)
            title="${1#*=}"
            shift
            ;;
        --title)
            title="$2"
            shift 2
            ;;
        *)
            break  # Stop parsing, rest is the command
            ;;
    esac
done

Alacritty section - convert --app-id to --class

elif command -v alacritty >/dev/null; then
    set -- alacritty \
        ${working_dir:+--working-directory "$working_dir"} \
        ${app_id:+--class "$app_id"} \
        ${title:+--title "$title"} \
        "$@"
    exec "$@"

Key Changes

  1. Parse --app-id and --title flags (not just --dir)
  2. Convert --app-id to --class for alacritty compatibility
  3. Use break instead of appending unknown args, so command args are preserved
  4. Use parameter expansion (${app_id:+--class "$app_id"}) to only add flags when set

imdoingsomething avatar Nov 07 '25 20:11 imdoingsomething

Yeah, making the shim parse --dir and workdir args properly fixed this.

Grawave avatar Nov 08 '25 12:11 Grawave