Add glassMxrph shell sources

Initial commit of the Quickshell desktop suite: bar, dock, launcher,
settings, Control Center, dashboard, OSD, lock screen, desktop widgets,
plugin host with the vendored Noctalia/Omarchy compatibility layer,
helpers, packaging, tests and phase documentation.

Includes the optimization work so far: usage widgets and dashboard
gauges no longer animate continuously, desktop widgets pause while
covered, system controls stop flickering on background polls, dock app
matching uses an indexed catalog, and workspace ghosts are created only
for occupied slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-10-07 22:36:17 +02:00
commit 99e64a7713
433 files changed
+57792

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
#!/usr/bin/env python3
"""Read-only live metrics integration with isolated preferences; no hardware writes."""
import json
import os
from pathlib import Path
import subprocess
import tempfile
import time
ROOT=Path(__file__).resolve().parents[1]
SHELL=ROOT/'quickshell'
def ipc(target,method,*args):
p=subprocess.run(['quickshell','ipc','--path',str(SHELL),'call',target,method,*args],capture_output=True,text=True,timeout=5)
if p.returncode:return None
try:return json.loads(p.stdout)
except ValueError:return p.stdout.strip()
def wait(check,timeout=15):
end=time.monotonic()+timeout
while time.monotonic()<end:
if check():return
time.sleep(.15)
raise AssertionError('Runtime condition timed out')
def state():return ipc('metrics','status') or {}
def pref(key,value):
result=ipc('shell','setPreference',key,' '+json.dumps(value,separators=(",",":")))
assert result is True,(key,result,ipc('shell','status'))
if ipc('shell','status'):raise SystemExit('An existing instance is running; stop it before this isolated test.')
with tempfile.TemporaryDirectory(prefix='glassmxrph-metrics-') as tmp:
env=dict(os.environ,GLASSMXRPH_METRICS_TESTING='1',XDG_CONFIG_HOME=tmp+'/config',XDG_STATE_HOME=tmp+'/state')
log=Path(tmp)/'runtime.log'
with log.open('w') as out:
p=subprocess.Popen([str(ROOT/'scripts/glassmxrph'),'run'],env=env,stdout=out,stderr=subprocess.STDOUT)
try:
# Nothing on the desktop samples by default; the collector idles.
wait(lambda:state().get('consumers')==0 and not state().get('running'))
ipc('shell','openSettings','metrics')
wait(lambda:state().get('consumers')==1 and state().get('samples',0)>=2)
assert ipc('metricsTest','screenshot',str(ROOT/'.cache/metrics-preview.png')) is True
wait(lambda:(ROOT/'.cache/metrics-preview.png').exists())
s=state();assert not s['error'] and not s['stale'],s
assert 0<=s['snapshot']['cpu']['percent']<=100,s
assert s['snapshot']['ram']['total']>0,s
ipc('shell','close')
wait(lambda:state().get('consumers')==0 and not state().get('running'))
before=state()['samples'];time.sleep(2.2);assert state()['samples']==before
monitors=json.loads(subprocess.check_output(['hyprctl','-j','monitors']))
pref('bar.modules',[{'id':k,'enabled':True,'position':'right'} for k in ['cpu','gpu','ram','storage','cpuTemperature','gpuTemperature','networkThroughput']])
wait(lambda:state().get('consumers')==7*len(monitors) and state().get('samples',0)>before)
pref('bar.modules',[])
ipc('shell','openSettings','metrics')
wait(lambda:state().get('consumers')==1)
pref('metrics.interval',1)
pref('metrics.storagePaths',['/','/missing-glassmxrph-test'])
wait(lambda:len(state().get('snapshot',{}).get('storage',[]))==2)
assert not state()['snapshot']['storage'][1]['available']
pref('metrics.networkInterface','missing-glassmxrph-test')
wait(lambda:state().get('snapshot',{}).get('network',{}).get('selected')==['missing-glassmxrph-test'])
assert state()['snapshot']['network']['download'] is None
pref('controlCenter.modules',[{'id':'metrics','enabled':True}])
ipc('controlcenter','open')
wait(lambda:state().get('consumers')==1)
ipc('controlcenter','close')
wait(lambda:state().get('consumers')==0 and not state().get('running'))
# Desktop widgets sample only while their desktop is uncovered: no
# tiled or fullscreen window on the monitor's active workspace.
clients=json.loads(subprocess.check_output(['hyprctl','-j','clients']))
active={m['activeWorkspace']['id'] for m in monitors}
covered={c['monitor'] for c in clients if c['workspace']['id'] in active and (not c['floating'] or c['fullscreen'])}
widget=lambda m:{'version':1,'grid':False,'items':[{'id':'cpu-1','type':'cpu','variant':'','monitor':m['name'],'x':40,'y':40,'w':180,'h':130,'opacity':1}]}
hidden=[m for m in monitors if m['id'] in covered]
shown=[m for m in monitors if m['id'] not in covered]
if hidden:
pref('desktopWidgets',widget(hidden[0]))
time.sleep(3)
assert state().get('consumers')==0 and not state().get('running'),state()
if shown:
pref('desktopWidgets',widget(shown[0]))
wait(lambda:state().get('consumers')>=1 and state().get('running'))
config=Path(tmp)/'config/glassMxrph/config.json'
wait(lambda:config.exists() and json.loads(config.read_text())['metrics']['interval']==1)
finally:
p.terminate();p.wait(timeout=8)
(ROOT/'.cache/phase8-runtime.log').write_text(log.read_text())
text=log.read_text()
assert 'WARN' not in text and 'ERROR' not in text,text
print('PASS: live counters, shared bar/settings/Control Center consumers, idle shutdown/restart, source changes, unavailable sources, persistence and clean QML/DBus logs.')