From c2308daf897055e056a0a51fbc445f7902c2f90b Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 14 Sep 2024 04:15:27 -0300 Subject: Added examples for python and lua --- docs/libraries/hyprland.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'docs/libraries/hyprland.md') diff --git a/docs/libraries/hyprland.md b/docs/libraries/hyprland.md index 0bc20c4..8018773 100644 --- a/docs/libraries/hyprland.md +++ b/docs/libraries/hyprland.md @@ -64,17 +64,33 @@ astal-hyprland # starts monitoring ```js [ JavaScript] import Hyprland from "gi://AstalHyprland"; -const hyprland = Hyprland.get_default() +const hyprland = Hyprland.get_default(); -console.log(hyprland.get_clients().map(c => c.title)) +console.log(hyprland.get_clients().map((c) => c.title)); ``` ```py [ Python] -# Not yet documented +import gi + +gi.require_version("AstalHyprland", "0.1") + +from gi.repository import AstalHyprland + +hyprland = AstalHyprland.get_default() + +print("\n".join(c.get_title() for c in hyprland.get_clients())) ``` ```lua [ Lua] --- Not yet documented +local lgi = require("lgi") + +local AstalHyprland = lgi.require("AstalHyprland", "0.1") + +local hyprland = AstalHyprland.get_default() + +for _, c in ipairs(hyprland.clients) do + print(c.title) +end ``` ```vala [ Vala] -- cgit v1.2.3