desktop_icons_wem_check.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. # desktop_icons_wem_check.sh <vm> <we_manager dist/linux-unpacked> - the real app's overlay start on a Plasma VM with several outputs
  3. # (LINUXVM_OUTPUTS=3, kscreen_mirror.cpp makes Virtual-3 a copy of Virtual-2): one overlay per active screen, none for the
  4. # mirrored output nor for one switched off under Settings -> Display, and the engine's screens are the same list. The guest
  5. # needs gtk4-layer-shell, ~/lwe (prep_guest.sh) and the outputs enabled.
  6. HERE=$(cd "$(dirname "$0")" && pwd)
  7. vm=$1 app=$2
  8. sshv() { "$HERE/linuxvm.sh" ssh "$vm" "$@" </dev/null; }
  9. status=0
  10. pass() { echo "PASS $1"; }
  11. fail() { echo "FAIL $1"; status=1; }
  12. . "$HERE/wem_lib.sh"
  13. overlays() { sshv 'for p in $(pgrep -x python3); do tr "\0" " " < /proc/$p/cmdline; echo; done | sed -n "s/.*desktop-icons-overlay.py *\(.*\)/\1/p" | tr -d " " | sort | tr "\n" ";"'; }
  14. sshv 'mkdir -p ~/wem; pkill -f "[w]e-manager"; pkill -x python3; pkill -x linux-wallpaper; true'
  15. wem_wait_gone
  16. wem_install || exit 1
  17. wem_steam_lib 1111948150
  18. wem_engine_fallback
  19. sshv 'd=$(xdg-user-dir DESKTOP); mkdir -p $d; touch $d/notes.txt $d/data.csv'
  20. wem_run || exit 1
  21. HOME_STEAM=$(sshv 'echo $HOME')/.steam/steam/steamapps/workshop/content/431960
  22. screens=$(cdp 'window.electronAPI.lwe.listScreens()'); echo " screens: $screens"
  23. mirrored=$(cdp 'window.electronAPI.lwe.mirroredScreens ? window.electronAPI.lwe.mirroredScreens() : "n/a"'); echo " mirrored: $mirrored"
  24. cdp 'window.electronAPI.desktopIcons.setEnabled(true)' >/dev/null
  25. cdp "window.electronAPI.lwe.launch('$HOME_STEAM/1111948150', {screen: '*'})" >/dev/null; sleep 20
  26. got=$(overlays); echo " overlays: $got"
  27. for s in Virtual-1 Virtual-2; do case $got in *"$s;"*) pass "overlay for $s";; *) fail "no overlay for $s";; esac; done
  28. case $got in *Virtual-3*) fail "overlay for the mirrored Virtual-3";; *) pass "no overlay for the mirrored Virtual-3";; esac
  29. cdp "window.electronAPI.config.setDisabledScreens(['Virtual-2'])" >/dev/null
  30. cdp 'window.electronAPI.lwe.stop()' >/dev/null; sleep 5
  31. cdp "window.electronAPI.lwe.launch('$HOME_STEAM/1111948150', {screen: '*'})" >/dev/null; sleep 20
  32. got=$(overlays); echo " overlays with Virtual-2 switched off: $got"
  33. case $got in *Virtual-2*|*Virtual-3*) fail "overlay for a switched off or mirrored screen";; *) pass "only Virtual-1 keeps an overlay";; esac
  34. [ "$(sshv 'pgrep -xc python3')" -ge 1 ] && pass "overlay processes alive" || fail "overlay processes gone"
  35. status_out=$(cdp 'window.electronAPI.desktopIcons.getStatus()'); echo " status: $status_out"
  36. cdp "window.electronAPI.config.setDisabledScreens([])" >/dev/null
  37. cdp 'window.electronAPI.lwe.killAll()' >/dev/null
  38. sshv 'pkill -f "[w]e-manager"; pkill -x python3; true'
  39. exit $status