From 1425b396b08f0e91d45bbd0f92b1309115c7c870 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sun, 19 May 2024 02:39:53 +0200 Subject: init 0.1.0 --- python/sample.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 python/sample.py (limited to 'python/sample.py') diff --git a/python/sample.py b/python/sample.py new file mode 100755 index 0000000..af09ce2 --- /dev/null +++ b/python/sample.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +import gi + +gi.require_version("Playerctl", "2.0") + +from gi.repository import Playerctl +from astal import App, Astal, Variable, Widget, bind + +player = Playerctl.Player.new("spotify") +v = Variable(player.get_title()).observe(player, "metadata", lambda *_: player.get_title()) + + +def Bar(monitor): + return Widget.Window( + anchor=Astal.WindowAnchor.BOTTOM | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.RIGHT, + monitor=monitor, + exclusivity=Astal.Exclusivity.EXCLUSIVE, + child=Widget.CenterBox( + start_widget=Widget.Label( + label="Welcome to Astal.py!", + ), + end_widget=Widget.Label(label=v()), + ), + ) + + +def start(): + Bar(0) + + +App.start(callback=start) -- cgit v1.2.3