28 lines
952 B
Python
28 lines
952 B
Python
from .abstracts import AbstractDisplay
|
|
|
|
from . import gnome, plasma, wlroots
|
|
|
|
from enum import Enum, StrEnum
|
|
from typing import Optional, Type
|
|
|
|
class MetaMixin(str):
|
|
def __new__(cls, text: str, meta: AbstractDisplay):
|
|
obj = str.__new__(cls, text)
|
|
obj.text = text
|
|
obj.meta = meta
|
|
return obj
|
|
|
|
class DisplayManagerDriver(MetaMixin, Enum):
|
|
GNOME = ("GNOME (Mutter)", gnome.Display)
|
|
PLASMA = ("KDE Plasma 5/6 (KWin)", plasma.Display)
|
|
SWAY = ("Sway", wlroots.Display)
|
|
INFER = ("Inferring Wayland Compositor", None)
|
|
|
|
@classmethod
|
|
def get_display_list(cls):
|
|
return [display for display in cls if display.meta is not None]
|
|
|
|
class Error(StrEnum):
|
|
DISPLAY_TYPE_NOT_IMPL = "Requested manager type has not been implemented!"
|
|
DISPLAY_TYPE_UNKNOWN = "Requested manager type does not exist."
|
|
DISPLAY_INFER_TYPE_FAILURE = "Could not infer a compatible display manager from supported list." |