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,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Synthetic MPRIS player; run only on the test's private session bus."""
|
||||
import json,sys
|
||||
from pathlib import Path
|
||||
import dbus,dbus.service
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
from gi.repository import GLib
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
bus=dbus.SessionBus();name=dbus.service.BusName('org.mpris.MediaPlayer2.'+sys.argv[1],bus)
|
||||
ROOT='org.mpris.MediaPlayer2';PLAYER=ROOT+'.Player';PROPS='org.freedesktop.DBus.Properties';TEST='org.glassMxrph.Test'
|
||||
events=Path(sys.argv[2])
|
||||
art=events.parent/'art.svg'
|
||||
art.write_text('<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256"><rect width="256" height="256" fill="#193844"/><circle cx="128" cy="128" r="85" fill="#477d86"/><circle cx="128" cy="128" r="36" fill="#193844"/><circle cx="128" cy="128" r="8" fill="#d4e4d9"/></svg>')
|
||||
def record(method,**args):
|
||||
with events.open('a') as f:f.write(json.dumps(dict(method=method,**args))+'\n')
|
||||
class Player(dbus.service.Object):
|
||||
def __init__(self):
|
||||
super().__init__(bus,'/org/mpris/MediaPlayer2')
|
||||
self.root={'Identity':sys.argv[1],'DesktopEntry':sys.argv[1],'CanQuit':False,'CanRaise':False,'HasTrackList':False,'SupportedUriSchemes':dbus.Array([],signature='s'),'SupportedMimeTypes':dbus.Array([],signature='s')}
|
||||
self.props={'PlaybackStatus':'Paused','LoopStatus':'None','Rate':1.0,'Shuffle':False,'Volume':0.5,'Position':dbus.Int64(12000000),'MinimumRate':1.0,'MaximumRate':1.0,'CanGoNext':True,'CanGoPrevious':True,'CanPlay':True,'CanPause':True,'CanSeek':True,'CanControl':True,'Metadata':self.metadata('Fixture song')}
|
||||
def metadata(self,title):return dbus.Dictionary({'mpris:trackid':dbus.ObjectPath('/track/one'),'mpris:length':dbus.Int64(180000000),'xesam:title':title,'xesam:artist':dbus.Array(['Fixture artist'],signature='s'),'xesam:album':'Fixture album','mpris:artUrl':art.as_uri()},signature='sv')
|
||||
@dbus.service.method(PROPS,in_signature='s',out_signature='a{sv}')
|
||||
def GetAll(self,interface):return self.root if interface==ROOT else self.props if interface==PLAYER else {}
|
||||
@dbus.service.method(PROPS,in_signature='ss',out_signature='v')
|
||||
def Get(self,interface,key):return self.GetAll(interface)[key]
|
||||
@dbus.service.method(PROPS,in_signature='ssv')
|
||||
def Set(self,interface,key,value):self.props[key]=value;self.PropertiesChanged(PLAYER,{key:value},[])
|
||||
@dbus.service.signal(PROPS,signature='sa{sv}as')
|
||||
def PropertiesChanged(self,interface,changed,invalidated):pass
|
||||
@dbus.service.signal(PLAYER,signature='x')
|
||||
def Seeked(self,position):pass
|
||||
@dbus.service.method(PLAYER)
|
||||
def PlayPause(self):
|
||||
record('toggle');self.props['PlaybackStatus']='Paused' if self.props['PlaybackStatus']=='Playing' else 'Playing';self.PropertiesChanged(PLAYER,{'PlaybackStatus':self.props['PlaybackStatus']},[])
|
||||
@dbus.service.method(PLAYER)
|
||||
def Play(self):
|
||||
record('play');self.props['PlaybackStatus']='Playing';self.PropertiesChanged(PLAYER,{'PlaybackStatus':'Playing'},[])
|
||||
@dbus.service.method(PLAYER)
|
||||
def Pause(self):
|
||||
record('pause');self.props['PlaybackStatus']='Paused';self.PropertiesChanged(PLAYER,{'PlaybackStatus':'Paused'},[])
|
||||
@dbus.service.method(PLAYER)
|
||||
def Next(self):record('next')
|
||||
@dbus.service.method(PLAYER)
|
||||
def Previous(self):record('previous')
|
||||
@dbus.service.method(PLAYER,in_signature='ox')
|
||||
def SetPosition(self,track,position):record('seek',track=str(track),position=int(position));self.props['Position']=position;self.Seeked(position)
|
||||
@dbus.service.method(PLAYER,in_signature='x')
|
||||
def Seek(self,offset):self.SetPosition('/track/one',self.props['Position']+offset)
|
||||
@dbus.service.method(TEST,in_signature='s')
|
||||
def Update(self,payload):
|
||||
changes=json.loads(payload)
|
||||
if 'Title' in changes:changes['Metadata']=self.metadata(changes.pop('Title'))
|
||||
if changes.pop('NoLength',False):
|
||||
changes['Metadata']=self.metadata('Live stream');del changes['Metadata']['mpris:length']
|
||||
self.props.update(changes);self.PropertiesChanged(PLAYER,changes,[])
|
||||
player=Player();GLib.MainLoop().run()
|
||||
Reference in new issue
Block a user