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

+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env python3
"""System adapter boundaries. All commands and power capabilities are mocked."""
import importlib.util,json,subprocess,sys,tempfile,unittest
from pathlib import Path
from unittest.mock import patch
ROOT=Path(__file__).resolve().parents[1]
spec=importlib.util.spec_from_file_location('system_provider',ROOT/'quickshell/helpers/system.py')
system=importlib.util.module_from_spec(spec);spec.loader.exec_module(system)
OPTIONS=json.loads((ROOT/'quickshell/config/defaults.json').read_text())['system']
class Providers(unittest.TestCase):
def test_power_requires_confirmation_before_any_command(self):
with patch.object(system,'run') as run,patch.object(system,'power',return_value={'reboot':True,'shutdown':True,'logout':True}) as capability,patch.object(system,'snapshot',return_value={}):
for value in ['reboot','shutdown','logout']:
with self.assertRaisesRegex(ValueError,'confirmation'):system.action({'options':OPTIONS,'action':'power','value':value})
run.assert_not_called();capability.assert_not_called()
system.action({'options':OPTIONS,'action':'power','value':'reboot','confirmed':True})
self.assertEqual(run.call_args.args[0][-3:],['Reboot','b','true'])
with self.assertRaises(ValueError):system.action({'options':OPTIONS,'action':'power','value':'arbitrary','confirmed':True})
def test_validation_and_argv(self):
for value in [-1,101,float('nan'),True,'40']:
with self.assertRaises(ValueError):system.bounded(value,1,100)
self.assertEqual(system.command(['tool','$(echo never); quoted','{value}','{enabled}'],value=40,enabled=False),['tool','$(echo never); quoted','40','false'])
with self.assertRaises(ValueError):system.command('sh -c command')
with patch.object(system,'run',return_value='{"value":75,"available":"false"}'):
with self.assertRaises(ValueError):system.brightness({'statusCommand':['provider']})
with patch.object(system,'run',return_value='{"enabled":"false"}'):
with self.assertRaises(ValueError):system.night({'statusCommand':['provider']})
def test_custom_providers_readback(self):
opts=json.loads(json.dumps(OPTIONS));opts['brightness'].update(statusCommand=['status'],setCommand=['setter','--level','{value}'])
with patch.object(system,'run',return_value='{"value":73,"available":true}') as run,patch.object(system,'snapshot',return_value={'brightness':{'available':True,'value':73}}):
result=system.action({'options':opts,'action':'brightness','value':73})
run.assert_called_once_with(['setter','--level','73'])
self.assertEqual(result['state']['brightness']['value'],73)
def test_missing_providers_do_not_crash_snapshot(self):
with patch.object(system,'run',side_effect=FileNotFoundError('missing tool')),patch.object(system,'backlights',return_value=[]),patch.object(system.shutil,'which',return_value=None):
state=system.snapshot(OPTIONS)
self.assertFalse(state['brightness']['available']);self.assertFalse(state['nightLight']['available']);self.assertFalse(state['profiles']['available']);self.assertFalse(state['dnd']['available']);self.assertFalse(state['power']['shutdown'])
def test_unavailable_action_rejected(self):
with patch.object(system,'power',return_value={'suspend':False}),patch.object(system,'run') as run:
with self.assertRaises(ValueError):system.action({'options':OPTIONS,'action':'power','value':'suspend'})
run.assert_not_called()
def test_dnd_never_activates_notification_daemon(self):
with patch.object(system,'run',return_value='{"type":"b","data":[true]}') as run:
self.assertTrue(system.notifications()['enabled'])
args=run.call_args.args[0]
self.assertIn('--auto-start=no',args);self.assertEqual(args[-1],'GetDnd')
with patch.object(system,'notifications',return_value={'available':True}),patch.object(system,'snapshot',return_value={}),patch.object(system,'run') as run:
system.action({'options':OPTIONS,'action':'dnd','value':False})
self.assertIn('--auto-start=no',run.call_args.args[0]);self.assertEqual(run.call_args.args[0][-3:],['SetDnd','b','false'])
def test_cli_errors_are_json(self):
p=subprocess.run([sys.executable,str(ROOT/'quickshell/helpers/system.py'),'{"op":"unknown"}'],capture_output=True,text=True)
self.assertFalse(json.loads(p.stdout)['ok']);self.assertEqual(p.returncode,1);self.assertEqual(p.stderr,'')
if __name__=='__main__':unittest.main()