summaryrefslogtreecommitdiff
path: root/docs/libraries/notifd.md
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-09-14 11:59:09 +0200
committerGitHub <[email protected]>2024-09-14 11:59:09 +0200
commit45a3118f79970aebb561a31b050c2a63fc202c91 (patch)
tree5125d930cff745b93d579dc1d0e877af9ae405b4 /docs/libraries/notifd.md
parente9f9de6ba557de6a553f03de813af0fdbdbec047 (diff)
parent4d5c7a7b514c7f4f71b2950f051b64c3e3df3008 (diff)
Merge pull request #9 from tokyob0t/main
Added examples for python and lua to the docs :nerd_face:
Diffstat (limited to 'docs/libraries/notifd.md')
-rw-r--r--docs/libraries/notifd.md23
1 files changed, 19 insertions, 4 deletions
diff --git a/docs/libraries/notifd.md b/docs/libraries/notifd.md
index 2ba0b7b..7e02149 100644
--- a/docs/libraries/notifd.md
+++ b/docs/libraries/notifd.md
@@ -66,22 +66,37 @@ 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()
notifd.connect("notified", (_, id) => {
const n = notifd.get_notification(id)
- console.log(n.summary, n.body)
+ print(n.summary, n.body)
})
```
```py [<i class="devicon-python-plain"></i> Python]
-# Not yet documented
+from gi.repository import AstalNotifd as Notifd
+
+notifd = Notifd.get_default()
+
+def on_notified(_, id):
+ n = notifd.get_notification(id)
+ print(n.get_body(), n.get_body())
+
+notifd.connect("notified", on_notified)
```
```lua [<i class="devicon-lua-plain"></i> Lua]
--- Not yet documented
+local Notifd = require("lgi").require("AstalNotifd")
+
+local notifd = Notifd.get_default()
+
+notifd.on_notified = function(_, id)
+ local n = notifd.get_notification(id)
+ print(n.body, n.summary)
+end
```
```vala [<i class="devicon-vala-plain"></i> Vala]