Fix multi-window Android apps, move container startup to blendos-first-setup

This commit is contained in:
Rudra Saraswat 2023-05-03 00:58:07 +05:30
parent 451ffc2667
commit 82a068799f
2 changed files with 9 additions and 15 deletions

View file

@ -3,17 +3,12 @@
import os
import subprocess
def get_containers():
return subprocess.run(['podman', 'ps', '-a', '--no-trunc', '--sort=created', '--format',
'{{.Names}}'], stdout=subprocess.PIPE).stdout.decode('utf-8').strip().split('\n')
if os.path.isdir(os.path.expanduser('~/.local/bin/blend_bin')) and not os.path.isfile(os.path.expanduser('~/.local/bin/blend_bin/.associations')):
subprocess.call(['rm', '-rf', os.path.expanduser('~/.local/bin/blend_bin')], shell=False)
subprocess.call(['bash', '-c', 'rm -f "${HOME}/.local/share/applications/blend;"*'], shell=False)
subprocess.call(
['rm', '-rf', os.path.expanduser('~/.local/bin/blend_bin')], shell=False)
subprocess.call(
['bash', '-c', 'rm -f "${HOME}/.local/share/applications/blend;"*'], shell=False)
subprocess.call(['mkdir', '-p', os.path.expanduser('~/.local/bin/blend_bin/')])
subprocess.call(['touch', os.path.expanduser('~/.local/bin/blend_bin/.associations')], shell=False)
for c in get_containers():
c = c.strip()
subprocess.call(['podman', 'start', c])
subprocess.call(['touch', os.path.expanduser(
'~/.local/bin/blend_bin/.associations')], shell=False)

View file

@ -7,15 +7,14 @@ function init_waydroid() {
require('child_process').spawnSync('pkexec', ['systemctl', 'enable', '--now', 'waydroid-container'])
require('child_process').spawn('sh', ['-c', 'waydroid session start & disown'])
setTimeout(() => {
require('child_process').spawnSync('sh', ['-c', 'echo "persist.waydroid.multi_windows=true" | pkexec tee -a /var/lib/waydroid/waydroid_base.prop'])
require('child_process').spawnSync('pkexec', ['waydroid', 'shell', 'pm', 'disable', 'com.android.inputmethod.latin'])
require('child_process').spawnSync('sh', ['-c', 'echo "persist.waydroid.multi_windows=true" | pkexec tee -a /var/lib/waydroid/waydroid.cfg'])
if (require('child_process').spawnSync('sh', ['-c', 'LC_ALL=C glxinfo | grep "^OpenGL renderer string: "']).stdout.includes('NVIDIA') || require('child_process').spawnSync('cat', ['/proc/cpuinfo']).stdout.includes('hypervisor')) {
require('child_process').spawnSync('sh', ['-c', 'echo "ro.hardware.gralloc=default" | pkexec tee -a /var/lib/waydroid/waydroid.cfg'])
require('child_process').spawnSync('sh', ['-c', 'echo "ro.hardware.egl=swiftshader" | pkexec tee -a /var/lib/waydroid/waydroid.cfg'])
}
require('child_process').spawn('sh', ['-c', 'pkexec waydroid upgrade -o; waydroid session stop; waydroid session start'])
setTimeout(() => { postMessage('success') }, 1000)
}, 8000)
setTimeout(() => { postMessage('success') }, 2000)
}, 4000)
`
)
init_worker.onmessage = e => {