Thingy
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from typing import override
|
||||
|
||||
from ..abstracts import AbstractDisplay
|
||||
from ..structs import Modeline, MonitorInfo
|
||||
@@ -12,6 +13,7 @@ from ._gnome_types import GNOMEDisplayConfig
|
||||
MODE_REGEX_PATTERN = re.compile(r"(\d+)x(\d+)@(\d+\.\d+)")
|
||||
|
||||
class Display(AbstractDisplay):
|
||||
@override
|
||||
def get_modes(self):
|
||||
mutter_display_state = GNOMEDisplayConfig()
|
||||
mutter_display_state.get_dbus_info()
|
||||
@@ -44,6 +46,7 @@ class Display(AbstractDisplay):
|
||||
|
||||
return result
|
||||
|
||||
@override
|
||||
def set_mode(self, modeline, requested_connector=None) -> None:
|
||||
subprocess.run(
|
||||
[
|
||||
@@ -58,6 +61,7 @@ class Display(AbstractDisplay):
|
||||
]
|
||||
)
|
||||
|
||||
@override
|
||||
def save_current_mode(self, location):
|
||||
gdctl_output = subprocess.run(
|
||||
["gdctl", "show"], capture_output=True, text=True, check=True
|
||||
@@ -67,6 +71,7 @@ class Display(AbstractDisplay):
|
||||
with open(location, "w") as file:
|
||||
file.write(f"{w}x{h}@{r}")
|
||||
|
||||
@override
|
||||
def read_saved_mode(self, location):
|
||||
with open(location, "r") as file:
|
||||
config_file_content = file.read()
|
||||
@@ -77,5 +82,6 @@ class Display(AbstractDisplay):
|
||||
return Modeline(width=int(w), height=int(h), refresh_rate=float(r))
|
||||
|
||||
@staticmethod
|
||||
@override
|
||||
def detect():
|
||||
return "gnome" in os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
import os
|
||||
from typing import override
|
||||
|
||||
from ..abstracts import AbstractDisplay
|
||||
from ..structs import MonitorInfo, Modeline
|
||||
|
||||
|
||||
class Display(AbstractDisplay):
|
||||
def get_modes(self):
|
||||
@override
|
||||
def get_modes(self) -> list[MonitorInfo]:
|
||||
pass
|
||||
|
||||
def set_mode(self, modeline: str):
|
||||
@override
|
||||
def set_mode(self, modeline: Modeline, requested_connector: str) -> None:
|
||||
pass
|
||||
|
||||
@override
|
||||
def read_saved_mode(self, location: str | Path) -> Modeline:
|
||||
pass
|
||||
|
||||
@override
|
||||
def save_current_mode(self, location: str | Path) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
@override
|
||||
def detect():
|
||||
return "plasma" in os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
import os
|
||||
from typing import override
|
||||
|
||||
from ..abstracts import AbstractDisplay
|
||||
from ..structs import MonitorInfo, Modeline
|
||||
|
||||
|
||||
class Display(AbstractDisplay):
|
||||
def get_modes(self):
|
||||
def get_modes(self) -> list[MonitorInfo]:
|
||||
pass
|
||||
|
||||
def set_mode(self, modeline: str):
|
||||
def set_mode(self, modeline: Modeline, requested_connector: str) -> None:
|
||||
pass
|
||||
|
||||
def read_saved_mode(self, location: str | Path) -> Modeline:
|
||||
pass
|
||||
|
||||
def save_current_mode(self, location: str | Path) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user