summaryrefslogtreecommitdiff
path: root/examples/py/starter-bar/app.py
blob: 287d0f86d40163bc12159bd8230efc5286a2fe7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()