mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 13:51:19 +01:00
feat(e2e): sync the neutral core from kfde 13edc355
This commit is contained in:
1 parent
206fa1748a
commit
27ce93fe17
4 files changed
+15
-4
No files matched your search
@@ -128,10 +128,15 @@ class Platform(Protocol):
|
||||
|
||||
`exe` is the name of the program that opens it, without an extension (`e2e-exe` is
|
||||
`e2e-exe.exe` on Windows and `e2e-exe` on Linux), for a rule that matches by it. The
|
||||
platform makes a program of that name; a rule's `id` is the same on every platform.
|
||||
platform makes a program of that name, and `exe_id` spells the id of a rule for it.
|
||||
"""
|
||||
...
|
||||
|
||||
def exe_id(self, program: str) -> str:
|
||||
"""The `id` of a rule that matches the windows of the program `spawn(exe=program)` opens:
|
||||
the program's file name, which is `program` on Linux and `program.exe` on Windows."""
|
||||
...
|
||||
|
||||
def os_window(self, client: Client) -> OsWindow | None:
|
||||
"""What the operating system says about the window, or `None` if it has none."""
|
||||
...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Rules that match a window by the program that opened it decide where it goes, or that it is
|
||||
left alone. The program is `e2e-exe-sent.exe` on Windows and `e2e-exe-sent` on Linux, and the
|
||||
rule is the same.
|
||||
rule's id is `platform.exe_id(program)`.
|
||||
|
||||
The names differ from those of `rules_class`: `ignore-rule` drops a rule whose id an earlier
|
||||
rule has, whatever its kind."""
|
||||
@@ -17,8 +17,8 @@ def run(platform: Platform, checks: Checks) -> None:
|
||||
and with workspaces 0 and 1. The rules are cleared afterwards.
|
||||
"""
|
||||
platform.komorebic("ensure-workspaces", "0", "2")
|
||||
platform.komorebic("workspace-rule", "exe", "e2e-exe-sent", "0", "1")
|
||||
platform.komorebic("ignore-rule", "exe", "e2e-exe-left")
|
||||
platform.komorebic("workspace-rule", "exe", platform.exe_id("e2e-exe-sent"), "0", "1")
|
||||
platform.komorebic("ignore-rule", "exe", platform.exe_id("e2e-exe-left"))
|
||||
|
||||
sent = platform.spawn("by-exe-sent", exe="e2e-exe-sent")
|
||||
checks.check(
|
||||
|
||||
@@ -347,6 +347,9 @@ class FakePlatform:
|
||||
def screenshot(self, name: str) -> Image.Image:
|
||||
return Image.new("RGB", (4, 4))
|
||||
|
||||
def exe_id(self, program: str) -> str:
|
||||
return program
|
||||
|
||||
def os_window(self, client: Client) -> OsWindow | None:
|
||||
if client.title == self.maximized:
|
||||
return OsWindow(client.title, Rect(0, 0, 1920, 1080), focused=True)
|
||||
|
||||
@@ -69,6 +69,9 @@ class FakePlatform:
|
||||
def komorebic(self, *args: str) -> str:
|
||||
return ""
|
||||
|
||||
def exe_id(self, program: str) -> str:
|
||||
return program
|
||||
|
||||
def minimize(self, client: Client) -> None:
|
||||
pass
|
||||
|
||||
|
||||
Reference in new issue
Block a user