From 8e44219b0ea108a4b33cbd1e5ea06dfb1c06f659 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sun, 8 Sep 2024 02:58:14 +0200 Subject: example: add python starter bar --- examples/py/starter-bar/app.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 examples/py/starter-bar/app.py (limited to 'examples/py/starter-bar/app.py') diff --git a/examples/py/starter-bar/app.py b/examples/py/starter-bar/app.py new file mode 100755 index 0000000..287d0f8 --- /dev/null +++ b/examples/py/starter-bar/app.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +import versions +from gi.repository import Astal, Gio +from widget.Bar import Bar +from pathlib import Path + +css = str(Path(__file__).parent.resolve() / "style.css") + + +class App(Astal.Application): + def __init__(self): + super().__init__() + self.acquire_socket() + self.run(None) + + def do_request(self, msg: str, conn: Gio.SocketConnection) -> None: + print(msg) + Astal.write_sock(conn, "hello") + + def do_activate(self) -> None: + self.hold() + self.apply_css(css, True) + for mon in self.get_monitors(): + self.add_window(Bar(mon)) + + +App() -- cgit v1.2.3