Files
mxandClaude Opus 5.5 84c2385cfa Fix plugin colours on Qt 6.12
Qt 6.12's QtQuick exports a Color singleton, which hides the Omarchy and
Noctalia kits' Commons.Color: every Color.foreground read undefined, so
plugin buttons, toggles and text fell back to black. The kits now import
QtQuick 6.8, which predates it, and the installer pins the same version
in plugin files that use Color (reinstall plugins to pick it up).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 23:59:38 +01:00

20 lines
1.1 KiB
Python

#!/usr/bin/env python3
import sys,tempfile,unittest
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'quickshell/helpers'))
import plugins
class Rewrites(unittest.TestCase):
def rewrite(self,text,eco='omarchy'):
with tempfile.TemporaryDirectory() as tmp:
path=Path(tmp)/'W.qml';path.write_text(text);plugins.rewrite_imports(Path(tmp),eco);return path.read_text()
def test_kit_imports_point_at_the_compatibility_layer(self):
self.assertIn('import qs.compat.omarchy.Ui\n',self.rewrite('import QtQuick\nimport qs.Ui\nItem {}\n'))
self.assertIn('import qs.compat.noctalia.Commons\n',self.rewrite('import qs.Commons\nItem {}\n','noctalia'))
def test_files_using_color_get_a_qtquick_without_its_color_singleton(self):
out=self.rewrite('import QtQuick\nimport qs.Commons\nText { color: Color.foreground }\n')
self.assertIn('import QtQuick 6.8\n',out)
self.assertIn('import QtQuick\n',self.rewrite('import QtQuick\nText { color: myColor.x }\n'))
self.assertIn('import QtQuick 2.15\n',self.rewrite('import QtQuick 2.15\nText { color: Color.x }\n'))
if __name__=='__main__':unittest.main()