From 4d5c7a7b514c7f4f71b2950f051b64c3e3df3008 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sat, 14 Sep 2024 09:55:29 +0000 Subject: docs: lib examples consistency --- docs/libraries/hyprland.md | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'docs/libraries/hyprland.md') diff --git a/docs/libraries/hyprland.md b/docs/libraries/hyprland.md index 8018773..faf9e50 100644 --- a/docs/libraries/hyprland.md +++ b/docs/libraries/hyprland.md @@ -62,34 +62,31 @@ astal-hyprland # starts monitoring :::code-group ```js [ JavaScript] -import Hyprland from "gi://AstalHyprland"; +import Hyprland from "gi://AstalHyprland" -const hyprland = Hyprland.get_default(); +const hyprland = Hyprland.get_default() -console.log(hyprland.get_clients().map((c) => c.title)); +for (const client of hyprland.get_clients()) { + print(client.title) +} ``` ```py [ Python] -import gi +from gi.repository import AstalHyprland as Hyprland -gi.require_version("AstalHyprland", "0.1") +hyprland = Hyprland.get_default() -from gi.repository import AstalHyprland - -hyprland = AstalHyprland.get_default() - -print("\n".join(c.get_title() for c in hyprland.get_clients())) +for client in hyprland.get_clients(): + print(client.get_title()) ``` ```lua [ Lua] -local lgi = require("lgi") - -local AstalHyprland = lgi.require("AstalHyprland", "0.1") +local Hyprland = require("lgi").require("AstalHyprland") -local hyprland = AstalHyprland.get_default() +local hyprland = Hyprland.get_default() for _, c in ipairs(hyprland.clients) do - print(c.title) + print(c.title) end ``` -- cgit v1.2.3