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

+97
View File
@@ -0,0 +1,97 @@
#!/usr/bin/env python3
"""Run with dbus-run-session, real Wayland and dbus-python/PyGObject."""
import json,os,subprocess,tempfile,time,shutil
from pathlib import Path
import dbus
ROOT=Path(__file__).resolve().parents[1]
BASE=['quickshell','ipc','--path',str(ROOT/'quickshell'),'call']
def ipc(target,method,*args):
r=subprocess.run(BASE+[target,method,*map(str,args)],capture_output=True,text=True)
return json.loads(r.stdout) if r.returncode==0 and r.stdout.strip() else None
def state():return ipc('media','status') or {}
def wait(check,label):
end=time.monotonic()+12
while time.monotonic()<end:
try:
if check():return
except (KeyError,TypeError,ValueError):pass
time.sleep(.1)
raise AssertionError(label+': '+str(state()))
def pref(key,value):assert ipc('shell','setPreference',key,' '+json.dumps(value)), str(ipc('shell','status'))
if ipc('shell','status'):raise SystemExit('Use an isolated source path; instance already running.')
log=ROOT/'.cache/media-runtime.log';log.parent.mkdir(exist_ok=True)
with tempfile.TemporaryDirectory(prefix='glassmxrph-media-') as tmp:
env=dict(os.environ,XDG_CONFIG_HOME=tmp+'/config',XDG_STATE_HOME=tmp+'/state',XDG_CACHE_HOME=tmp+'/cache',GLASSMXRPH_MEDIA_TESTING='1',QT_QPA_PLATFORMTHEME='',QT_NO_XDG_DESKTOP_PORTAL='1')
fail=Path(tmp)/'cava-failure';binpath=Path(tmp)/'bin';binpath.mkdir()
actual_cava=shutil.which('cava')
if not actual_cava:raise SystemExit('Cava must be available for this integration test.')
wrapper=binpath/'cava'
wrapper.write_text('#!/usr/bin/env python3\nimport os,sys,pathlib\nif pathlib.Path('+repr(str(fail))+').exists():\n print("Synthetic Cava failure",file=sys.stderr)\n sys.exit(127)\nos.execv('+repr(actual_cava)+',['+repr(actual_cava)+']+sys.argv[1:])\n');wrapper.chmod(0o755)
env['PATH']=str(binpath)+os.pathsep+env['PATH']
events=Path(tmp)/'events';children=[]
with log.open('w') as output:
shell=subprocess.Popen([str(ROOT/'scripts/glassmxrph'),'run'],env=env,stdout=output,stderr=subprocess.STDOUT)
try:
wait(lambda:ipc('shell','status')['ready'],'shell ready')
wait(lambda:state().get('title')=='Nothing playing','empty state')
assert ipc('media','toggle') is False
for name in ['fixtureOne','fixtureTwo']:
children.append(subprocess.Popen(['python3',str(ROOT/'tests/mpris_fixture.py'),name,str(events)],stdout=output,stderr=subprocess.STDOUT))
wait(lambda:len(state()['players'])==2,'discovery')
bus=dbus.SessionBus()
def update(name,data):dbus.Interface(bus.get_object('org.mpris.MediaPlayer2.'+name,'/org/mpris/MediaPlayer2'),'org.glassMxrph.Test').Update(json.dumps(data))
update('fixtureTwo',{'PlaybackStatus':'Playing'})
wait(lambda:state()['selected'].endswith('fixtureTwo'),'automatic playing player')
assert ipc('media','select','org.mpris.MediaPlayer2.fixtureOne')
wait(lambda:state()['selected'].endswith('fixtureOne'),'manual selection')
assert state()['length']==180 and state()['artist']=='Fixture artist'
assert ipc('media','toggle');assert ipc('media','next');assert ipc('media','previous');assert ipc('media','seek',45)
wait(lambda:state()['playing'] and state()['position']>=45,'play and seek seconds')
records=[json.loads(s) for s in events.read_text().splitlines()]
assert {'play','next','previous','seek'} <= {e['method'] for e in records}
assert next(e for e in records if e['method']=='seek')['position']==45000000
update('fixtureOne',{'CanSeek':False,'CanGoNext':False,'CanGoPrevious':False,'CanPause':False,'Title':'Updated song'})
wait(lambda:state()['title']=='Updated song' and not state()['seekable'],'metadata/capabilities')
assert ipc('media','next') is False and ipc('media','previous') is False and ipc('media','seek',10) is False
pref('media.preferredPlayer','org.mpris.MediaPlayer2.fixtureTwo')
wait(lambda:state()['selected'].endswith('fixtureTwo'),'preferred player')
pref('bar.modules',[{'id':'nowPlaying','position':'right','enabled':True}])
ipc('shell','openSettings','media');time.sleep(.5)
assert ipc('mediaTest','click','mediaToggle')
wait(lambda:not state()['playing'],'widget pause click')
assert ipc('mediaTest','click','mediaToggle')
wait(lambda:state()['playing'],'widget play click')
pref('media.showCava',True)
wait(lambda:ipc('cava','status')['running'],'Cava starts')
wait(lambda:ipc('cava','status')['frames']>2,'Cava frame shape')
assert ipc('mediaTest','screenshot',str(ROOT/'.cache/music-preview.png'))
time.sleep(.2)
update('fixtureTwo',{'PlaybackStatus':'Paused'})
wait(lambda:not ipc('cava','status')['running'],'Cava stops on pause')
update('fixtureTwo',{'PlaybackStatus':'Playing'})
wait(lambda:ipc('cava','status')['running'],'Cava resumes')
ipc('shell','close')
wait(lambda:not ipc('cava','status')['running'],'Cava stops without visible views')
ipc('shell','openSettings','media')
wait(lambda:ipc('cava','status')['running'],'Cava restarts with visible card')
pref('media.showCava',False)
wait(lambda:not ipc('cava','status')['running'],'Cava stops')
fail.touch();pref('media.showCava',True)
wait(lambda:bool(ipc('cava','status')['error']) and not ipc('cava','status')['running'],'Cava failure fallback')
time.sleep(.3);assert not ipc('cava','status')['running'],'Cava restarted after failure'
pref('media.showCava',False);fail.unlink();pref('media.showCava',True)
wait(lambda:ipc('cava','status')['running'] and not ipc('cava','status')['error'],'Cava recovery')
pref('media.showCava',False)
pref('media.showAlbumArt',False);pref('media.showProgress',False)
update('fixtureTwo',{'NoLength':True})
wait(lambda:state()['length']==0 and not state()['seekable'],'unknown length stream')
children[1].terminate();children[1].wait(timeout=5)
wait(lambda:len(state()['players'])==1 and state()['selected'].endswith('fixtureOne'),'disconnect fallback')
children[0].terminate();children[0].wait(timeout=5)
wait(lambda:len(state()['players'])==0 and state()['title']=='Nothing playing','last player removal')
finally:
for proc in children:
if proc.poll() is None:proc.terminate();proc.wait(timeout=5)
shell.terminate();shell.wait(timeout=5)
text=log.read_text();assert 'WARN' not in text and 'ERROR' not in text,text
print('PASS: empty state, two-player discovery/selection/fallback, metadata, capability guards, playback DBus actions, seek units, settings/bar, Cava lifecycle, clean runtime logs.')