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:
commit
99e64a7713
433 files changed
+57792
No files matched your search
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Real settings/palette integration using disposable images and a recording wallpaper backend."""
|
||||
import json,os,struct,subprocess,tempfile,time,zlib,shutil
|
||||
from pathlib import Path
|
||||
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('settingsTest','snapshot') or {}
|
||||
def eventually(check,label,timeout=12):
|
||||
end=time.monotonic()+timeout
|
||||
while time.monotonic()<end:
|
||||
try:
|
||||
if check():return
|
||||
except (ValueError,KeyError,TypeError,AttributeError,FileNotFoundError,IndexError):pass
|
||||
time.sleep(.08)
|
||||
raise AssertionError(label+': '+str(ipc('theme','status'))+' '+str(ipc('wallpaper','status')))
|
||||
def pref(key,value):assert ipc('shell','setPreference',key,json.dumps(value)),key
|
||||
def png(path,rgb):
|
||||
def chunk(kind,data):return struct.pack('!I',len(data))+kind+data+struct.pack('!I',zlib.crc32(kind+data)&0xffffffff)
|
||||
path.write_bytes(b'\x89PNG\r\n\x1a\n'+chunk(b'IHDR',struct.pack('!2I5B',64,64,8,2,0,0,0))+chunk(b'IDAT',zlib.compress((b'\x00'+bytes(rgb)*64)*64))+chunk(b'IEND',b''))
|
||||
if ipc('shell','status'):raise SystemExit('Use an isolated source path; an instance is already running here.')
|
||||
matugen=shutil.which('matugen')
|
||||
if not matugen:raise SystemExit('Put Matugen 4.2.x on PATH for this integration test.')
|
||||
log=ROOT/'.cache/settings-runtime.log';log.parent.mkdir(exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix='glassmxrph-settings-') as tmp:
|
||||
temp=Path(tmp);images=temp/'images';images.mkdir()
|
||||
red=images/'red.png';blue=images/'blue name with spaces.png';png(red,(230,30,20));png(blue,(20,50,230))
|
||||
event=temp/'applied.json';helper=temp/'wallpaper.py';helper.write_text('import json,pathlib,sys\npathlib.Path(sys.argv[1]).write_text(json.dumps(sys.argv[2:]))\n')
|
||||
command=['python3',str(helper),str(event),'{path}','{monitor}']
|
||||
cfg=temp/'config/glassMxrph/config.json';cfg.parent.mkdir(parents=True)
|
||||
cfg.write_text(json.dumps({'schemaVersion':3,'dock':{'enabled':False},'wallpaper':{'backend':'custom','command':command,'directories':[str(images)]},'matugen':{'executable':matugen}}))
|
||||
env=dict(os.environ,XDG_CONFIG_HOME=tmp+'/config',XDG_STATE_HOME=tmp+'/state',XDG_CACHE_HOME=tmp+'/cache',GLASSMXRPH_SETTINGS_TESTING='1',QT_QPA_PLATFORMTHEME='',QT_NO_XDG_DESKTOP_PORTAL='1')
|
||||
with log.open('w') as output:
|
||||
proc=subprocess.Popen([str(ROOT/'scripts/glassmxrph'),'run'],env=env,stdout=output,stderr=subprocess.STDOUT)
|
||||
try:
|
||||
eventually(lambda:ipc('shell','status')['ready'],'ready')
|
||||
ipc('shell','openSettings','appearance');pref('appearance.accentSource','custom')
|
||||
eventually(lambda:ipc('settingsTest','color'),'visual colour picker')
|
||||
eventually(lambda:state()['data']['appearance']['customAccent']!='#a0a0a0','colour persisted')
|
||||
time.sleep(.55);assert ipc('settingsTest','screenshot',str(ROOT/'.cache/appearance-preview.png'))
|
||||
ipc('shell','openSettings','wallpaper')
|
||||
eventually(lambda:len(state()['images'])==2,'gallery images')
|
||||
time.sleep(.3);assert ipc('settingsTest','wallpaper',1)
|
||||
assert ipc('settingsTest','click','wallpaperApply')
|
||||
eventually(lambda:event.exists() and json.loads(event.read_text())[0]==str(red),'wallpaper apply argv')
|
||||
eventually(lambda:state()['wallpaper']==str(red),'current wallpaper')
|
||||
pref('appearance.accentSource','matugen')
|
||||
eventually(lambda:not state()['busy'] and ipc('theme','status')['available'],'initial generated palette')
|
||||
first=state()['palette'];eventually(lambda:state()['theme']==first,'live theme propagated')
|
||||
assert ipc('wallpaper','apply',str(blue))
|
||||
eventually(lambda:state()['wallpaper']==str(blue) and not state()['busy'] and state()['palette']!=first,'automatic regeneration')
|
||||
good=state()['palette']
|
||||
pref('matugen.regenerateOnWallpaperChange',False)
|
||||
assert ipc('wallpaper','apply',str(red));eventually(lambda:state()['wallpaper']==str(red),'second wallpaper')
|
||||
time.sleep(.4);assert state()['palette']==good,'Disabled regeneration changed palette'
|
||||
assert ipc('theme','regenerate')
|
||||
eventually(lambda:not state()['busy'] and state()['palette']==first,'manual regeneration')
|
||||
pref('matugen.executable','/missing/matugen')
|
||||
eventually(lambda:not state()['busy'] and bool(state()['error']),'missing executable error')
|
||||
assert state()['palette']==first,'Failed job destroyed palette'
|
||||
pref('matugen.executable',matugen)
|
||||
eventually(lambda:not state()['busy'] and not state()['error'],'recovery')
|
||||
pref('matugen.regenerateOnWallpaperChange',True)
|
||||
# Rapid changes must leave the newest image as the palette source.
|
||||
for path in [str(red),str(blue),str(red),str(blue)]:ipc('wallpaper','changed',json.loads(event.read_text())[1],path)
|
||||
eventually(lambda:not state()['busy'] and state()['palette']==good,'latest wallpaper wins')
|
||||
# Hold an older real Matugen generation in flight; it must never be published.
|
||||
marker=temp/'slow-started';slow=temp/'slow-matugen'
|
||||
slow.write_text('#!/usr/bin/env python3\nimport os,sys,time,pathlib\nif "--version" not in sys.argv:\n pathlib.Path('+repr(str(marker))+').write_text("started")\n time.sleep(.6)\nos.execv('+repr(matugen)+',['+repr(matugen)+']+sys.argv[1:])\n');slow.chmod(0o755)
|
||||
pref('matugen.regenerateOnWallpaperChange',False)
|
||||
ipc('wallpaper','changed',json.loads(event.read_text())[1],str(red))
|
||||
pref('matugen.executable',str(slow))
|
||||
eventually(lambda:marker.exists(),'older generation running')
|
||||
pref('matugen.regenerateOnWallpaperChange',True)
|
||||
ipc('wallpaper','changed',json.loads(event.read_text())[1],str(blue))
|
||||
end=time.monotonic()+10
|
||||
while state()['busy'] and time.monotonic()<end:
|
||||
assert state()['palette']==good,'Stale in-flight palette was published'
|
||||
time.sleep(.08)
|
||||
assert not state()['busy'] and state()['palette']==good
|
||||
pref('matugen.executable',matugen)
|
||||
eventually(lambda:not state()['busy'],'restore Matugen executable')
|
||||
ipc('shell','openSettings','bar');time.sleep(.3)
|
||||
assert ipc('settingsTest','dragModule','workspaces','left','settings')
|
||||
eventually(lambda:state()['data']['bar']['modules'][0]['id']=='workspaces','visual bar reorder')
|
||||
assert ipc('settingsTest','click','bar-enable-clock')
|
||||
eventually(lambda:not next(m for m in state()['data']['bar']['modules'] if m['id']=='clock')['enabled'],'visual bar toggle')
|
||||
assert ipc('settingsTest','screenshot',str(ROOT/'.cache/bar-editor-preview.png'))
|
||||
for page in ['media','dock','tray','launcher','appearance','wallpaper','displays','about']:
|
||||
ipc('shell','openSettings',page);time.sleep(.15)
|
||||
pref('media.scale',1.25);pref('media.showAlbum',False)
|
||||
eventually(lambda:json.loads(cfg.read_text())['media']['scale']==1.25,'media preferences saved')
|
||||
ipc('shell','close')
|
||||
finally:proc.terminate();proc.wait(timeout=5)
|
||||
text=log.read_text();assert 'WARN' not in text and 'ERROR' not in text,text
|
||||
print('PASS: visual colour picker, wallpaper gallery/apply, real Matugen file generation, automatic/manual live palettes, failure recovery, latest request wins, visual bar reorder/toggle, settings pages/media persistence, clean logs.')
|
||||
Reference in new issue
Block a user