diff options
author | Aylur <[email protected]> | 2024-09-14 09:55:29 +0000 |
---|---|---|
committer | Aylur <[email protected]> | 2024-09-14 09:55:29 +0000 |
commit | 4d5c7a7b514c7f4f71b2950f051b64c3e3df3008 (patch) | |
tree | 5125d930cff745b93d579dc1d0e877af9ae405b4 /docs/libraries/notifd.md | |
parent | c2308daf897055e056a0a51fbc445f7902c2f90b (diff) |
docs: lib examples consistency
Diffstat (limited to 'docs/libraries/notifd.md')
-rw-r--r-- | docs/libraries/notifd.md | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/docs/libraries/notifd.md b/docs/libraries/notifd.md index eb074cd..7e02149 100644 --- a/docs/libraries/notifd.md +++ b/docs/libraries/notifd.md @@ -66,24 +66,20 @@ astal-notifd --help :::code-group ```js [<i class="devicon-javascript-plain"></i> JavaScript] -import Notifd from "gi://AstalNotifd"; +import Notifd from "gi://AstalNotifd" -const notifd = Notifd.get_default(); +const notifd = Notifd.get_default() notifd.connect("notified", (_, id) => { - const n = notifd.get_notification(id); - console.log(n.summary, n.body); -}); + const n = notifd.get_notification(id) + print(n.summary, n.body) +}) ``` ```py [<i class="devicon-python-plain"></i> Python] -import gi +from gi.repository import AstalNotifd as Notifd -gi.require_version("AstalNotifd", "0.1") - -from gi.repository import AstalNotifd - -notifd = AstalNotifd.get_default() +notifd = Notifd.get_default() def on_notified(_, id): n = notifd.get_notification(id) @@ -93,15 +89,13 @@ notifd.connect("notified", on_notified) ``` ```lua [<i class="devicon-lua-plain"></i> Lua] -local lgi = require("lgi") - -local AstalNotifd = lgi.require("AstalNotifd", "0.1") +local Notifd = require("lgi").require("AstalNotifd") -local notifd = AstalNotifd.get_default() +local notifd = Notifd.get_default() notifd.on_notified = function(_, id) - local n = notifd.get_notification(id) - print(n.body, n.summary) + local n = notifd.get_notification(id) + print(n.body, n.summary) end ``` |