Support batched reads in the glass test's recording hyprctl

The customization runtime test's fake hyprctl did not understand
`--batch`, so batched HyprGlass reads fell through to the real
compositor (writes were still recorded). It now answers batched
getoption requests from the record. The glass probe reports why
HyprGlass is unavailable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-10-07 22:59:52 +02:00
1 parent 0e43c47bbb
commit 83a0d155ba
2 files changed
+8 -3

No files matched your search

+1 -1
View File
@@ -76,7 +76,7 @@ def probe():
o=get_many(['default_preset','enabled','layers:enabled','layers:namespaces','layers:exclude_namespaces','layers:namespace_presets'])
return dict(available=True,preset=o['default_preset'],enabled=bool(o['enabled']),layers=bool(o['layers:enabled']),
namespaces=o['layers:namespaces'],exclusions=o['layers:exclude_namespaces'],overrides=o['layers:namespace_presets'])
except (OSError,ValueError,subprocess.TimeoutExpired):return dict(available=False)
except (OSError,ValueError,subprocess.TimeoutExpired) as error:return dict(available=False,reason=str(error)[:200])
def dispatch(req):
action=req.get('action')
+7 -2
View File
@@ -32,8 +32,13 @@ with tempfile.TemporaryDirectory(prefix='glassmxrph-customization-') as tmp:
import json,os,subprocess,sys
from pathlib import Path
args=sys.argv[1:];p=Path(os.environ['GLASS_TEST_RECORD']);d=json.loads(p.read_text())
if 'getoption' in args and args[-1].startswith('plugin:hyprglass:'):
k=args[-1].removeprefix('plugin:hyprglass:');v=d[k];print(json.dumps({'str' if isinstance(v,str) else 'float' if isinstance(v,float) else 'int':v,'set':True}))
def option(name):
k=name.removeprefix('plugin:hyprglass:');v=d[k]
return json.dumps({'option':name,'str' if isinstance(v,str) else 'float' if isinstance(v,float) else 'int':v,'set':True})
if '--batch' in args and all(c.strip().startswith('getoption plugin:hyprglass:') for c in args[-1].split(';')):
print('\\n\\n'.join(option(c.split()[1]) for c in args[-1].split(';')))
elif 'getoption' in args and args[-1].startswith('plugin:hyprglass:'):
print(option(args[-1]))
elif args[0]=='keyword' and args[1].startswith('plugin:hyprglass:'):
k=args[1].removeprefix('plugin:hyprglass:');v=args[2]
if not isinstance(d[k],str):v=float(v);v=int(v) if v.is_integer() else v