MCPcopy Create free account
hub / github.com/NyarchLinux/DesktopPuppet / KDEInterface

Class KDEInterface

src/wminterfaces/kdeinterface.py:6–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4from .wminterface import WMInterface
5
6class KDEInterface (WMInterface):
7 def __init__(self) -> None:
8 super().__init__()
9 self.x = 0
10 self.y = 0
11
12 def get_cursor_position(self) -> tuple[int, int]:
13 script = "kdotool getmouselocation"
14 mouse_pos = subprocess.check_output(["bash","-c", script])
15 string = mouse_pos.decode("utf-8")
16 match = re.search(r'x:(\d+)\s+y:(\d+)', string)
17 if match is None:
18 return 0,0
19 x = int(match.group(1))
20 y = int(match.group(2))
21 pos = self._get_relative_coords(x, y)
22 return pos
23
24 def get_active_monitor_resolution(self) -> tuple[int, int]:
25 return 1920, 1000
26
27 def _get_relative_coords(self, x:int, y:int) -> tuple[int, int]:
28 return x-self.x,y-self.y

Callers 1

get_wm_interfaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected