#!/usr/bin/env python3 """Exercise the display API in a private compositor, never the active desktop.""" import json, os, socket, struct, subprocess, tempfile, time from pathlib import Path stage=Path(os.environ.get('WCM_TEST_STAGE','/var/tmp/wayfire-all-floating')) runtime=Path(tempfile.mkdtemp(prefix='window-scope-test-')) env=os.environ.copy() for key in ['WAYLAND_DISPLAY','DISPLAY','WAYFIRE_SOCKET','_WAYFIRE_SOCKET','WAYFIRE_CONFIG_FILE','WAYFIRE_DEFAULT_CONFIG_BACKEND']: env.pop(key,None) env.update(GIO_USE_VFS='local',GTK_USE_PORTAL='0',XDG_RUNTIME_DIR=str(runtime),WLR_BACKENDS='headless',WLR_HEADLESS_OUTPUTS='4',WLR_RENDERER='gles2', WLR_RENDER_DRM_DEVICE='/dev/dri/renderD128',WAYFIRE_PLUGIN_PATH=str(runtime)+':'+str(stage/'plugins'),WAYFIRE_PLUGIN_XML_PATH=str(stage/'metadata')) import shutil shutil.copy2(stage/'old-wm-actions.so', runtime/'libwm-actions.so') config=runtime/'wayfire.ini' config.write_text('''# Preserve this comment and unrelated settings. [core] plugins = ipc stipc ipc-rules output-control grid place move resize wm-actions simple-tile cube vswitch xwayland = false stitch_enabled = true stitch_outputs = HEADLESS-1 HEADLESS-2 HEADLESS-3 default_output = VIRTUAL-1 window_scope = physical window_scope_rules = [{"app_id":"scope-wide*","scope":"virtual"},{"app_id":"scope-pinned","scope":"HEADLESS-3"}] [simple-tile] key_toggle = KEY_ENTER tile_by_default = none float_on_top = false [wm-actions] keep_floating_above = false toggle_always_on_top = KEY_T [cube] rotate_left = KEY_LEFT rotate_right = KEY_RIGHT [autostart] autostart_wf_shell = false [grid] type = none zone_gap = 15 [output:HEADLESS-1] mode = 640x720@60 position = 0,0 [output:HEADLESS-2] mode = 640x720@60 position = 640,0 [output:HEADLESS-3] mode = 640x720@60 position = 1280,0 [output:HEADLESS-4] mode = 320x240@60 position = 1920,0 masked = true ''') log=(runtime/'wayfire.log').open('w') compositor_env=env.copy() if os.environ.get('WCM_TEST_ASAN'): compositor_env.update(LD_PRELOAD=os.environ['WCM_TEST_ASAN'],ASAN_OPTIONS='detect_leaks=0:abort_on_error=1',UBSAN_OPTIONS='halt_on_error=1:print_stacktrace=1') process=subprocess.Popen([os.environ.get('WCM_TEST_COMPOSITOR','/usr/bin/wayfire'),'-c',str(config)],env=compositor_env,stdout=log,stderr=log) def wait(fn,timeout=10): deadline=time.monotonic()+timeout while time.monotonic()