This commit is contained in:
t
2025-02-05 19:25:48 +01:00
parent cbe4355c3d
commit 810f54cb65
258 changed files with 4730 additions and 3 deletions
+41
View File
@@ -0,0 +1,41 @@
import datetime
from ignis.widgets import Widget
from ignis.app import IgnisApp
from ignis.utils import Utils
from ignis.variable import Variable
from .indicator import status_icons
app = IgnisApp.get_default()
current_time = Variable(
value=Utils.Poll(1000, lambda x: datetime.datetime.now().strftime("%H:%M:%S")).bind(
"output"
)
)
def clock(monitor):
window: Widget.Window = app.get_window("ignis_CONTROL_CENTER") # type: ignore
def on_click(x):
if window.monitor == monitor:
window.visible = not window.visible
else:
window.set_monitor(monitor)
window.visible = True
return Widget.Button(
child=Widget.Box(
child=[
status_icons(),
Widget.Label(
label=current_time.bind("value"),
),
]
),
css_classes=window.bind(
"visible",
lambda value: ["clock", "unset", "active"] if value else ["clock", "unset"],
),
on_click=on_click,
)