summaryrefslogtreecommitdiff
path: root/python/astal/application.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/astal/application.py')
-rw-r--r--python/astal/application.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/python/astal/application.py b/python/astal/application.py
deleted file mode 100644
index b5d5c41..0000000
--- a/python/astal/application.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from collections.abc import Callable
-from gi.repository import Astal, Gio
-
-RequestHandler = Callable[[str, Callable[[str], None]], None]
-
-
-class _Application(Astal.Application):
- def __init__(self) -> None:
- super().__init__()
- self.request_handler: RequestHandler | None = None
-
- def do_request(self, msg: str, conn: Gio.SocketConnection) -> None:
- if self.request_handler:
- self.request_handler(
- msg,
- lambda response: Astal.write_sock(
- conn,
- str(response),
- lambda _, res: Astal.write_sock_finish(res),
- ),
- )
- else:
- super().do_request(msg, conn)
-
- def start(
- self,
- instance_name: str | None = None,
- gtk_theme: str | None = None,
- icon_theme: str | None = None,
- cursor_theme: str | None = None,
- css: str | None = None,
- hold: bool | None = True,
- request_handler: RequestHandler | None = None,
- callback: Callable | None = None,
- ) -> None:
- if request_handler:
- self.request_handler = request_handler
- if hold:
- self.hold()
- if instance_name:
- self.instance_name = instance_name
- if gtk_theme:
- self.gtk_theme = gtk_theme
- if icon_theme:
- self.icon_theme = icon_theme
- if cursor_theme:
- self.cursor_theme = icon_theme
- if css:
- self.apply_css(css, False)
- if not self.acquire_socket():
- print(f"Astal instance {self.instance_name} already running")
- return
-
- def on_activate(app):
- if callback:
- callback()
-
- self.connect("activate", on_activate)
- self.run()
-
-
-App = _Application()