#Lua #dbus #lgi #gobjectintrospection
Я, Матье Бал.
Короче, что я сделал, чтобы заработало это говно?
Пообщался вновь с ИИ. Она дала идею выбросить йухан ваш vtable, ибо он не нужон.
А ещё и понадабавил парочку хуйни.
ссылка

Итог:

(luajjit:<pid>): Lgi-WARNING **: <HH:MM:SS.ms>: Error raised while calling 'lgi.cbk (function: 0x7fdb3946c940): GObject': /usr/share/lua/5.1/lgi/override/GLib-Variant.lua:97: bad argument #2 to '?' (string expected, got nil)
Помогло добавление фигурных скобок...

Завелось блять!!!

Но а что мне теперь делать с
vtable ?

#Lua #D-Bus #dbus #GTK #gobjectintrospection
@rur @rf

Ребят, нужна помощь с написанием кода.
Задача: Хочу написать на Lua простой скрипт, создающий D-Bus службу (В идеале org.kde.StatusNotifierWatcher) , к которой можно достучаться через dbus-send или gdbus. Пробовал через ИИ, который даже написал, но... Сталкиваюсь с нккоторыми ошибками, а именно:
1)

luajit: ./proxyserver.lua:62: bad argument #5 to 'bus_own_name' (GObject.Closure expected, got function) stack traceback: [C]: in function 'bus_own_name' ./proxyserver.lua:62: in function 'start' main.lua:25: in main chunk [C]: at 0x55b22012ed70Вызывается здесь: Gio.bus_own_name( Gio.BusType.SESSION, interface_name, Gio.BusNameOwnerFlags.NONE, on_bus_acquired, on_name_acquired, on_name_lostИз ошибки ясно, что bus_own_name ожидал GObject.Closure, а получил функцию(-и). Спросил у ИИ, стоит ли заворачивать в GObject функцию, на что получил отказ по причине "GObject умеет сам заворачивать, если делать автоматически" и прилагает Вариант 1 (ссылка) (который у меня ± в коде). Ладно, обернул сам...

Но теперь сталкиваюсь со второй ошибкой:
(luajit:30598): Lgi-WARNING **: 00:28:04.678: Error raised while calling 'lgi.cbk (function: 0x7f4efadd87c0): GObject': ./proxyserver.lua:51: bad argument #4 to 'register_object' (GObject.Closure expected, got userdata)
Вызывается здесь:
local on_bus_acquired = function(connection, name) connection:register_object('/org/example/MyObject', iface, vtable) end
Та же ошибка, но теперь получает не функцию, а userdata. На этот раз предлагает два варианта
(ссылка): Обернуть в GObject.Closure или преобразовать vtable в Gio.DBusInterfaceVTable (Что у меня это УЖЕ есть). Ладно, обернём в GObject.Closure ещё раз.

Ещё один запуск... Запустился без ошибок. Звучит неплохо, но а теперь самая мякотка...

Отправить сигнал:
dbus-send --session --print-reply \ --dest=org.example.MyInterface \ /org/example/MyObject \ org.example.MyInterface.SayHelloилиgdbus call --session \ --dest org.example.MyInterface \ --object-path /org/example/MyObject \ --method org.example.MyInterface.SayHello
И вот тут ловим ошибку:
(luajit:25911): Lgi-WARNING **: HH:MM:SS.ms : Error raised while calling 'lgi.cbk (function :0x7f5b60662de0): GObject': /usr/share/lua/5.1/lgi/override/GObject-Closure.lua:286: attempt to call upvalue 'target' (a userdata value) И вот тут я встал. Вроде всё запустилось, но сигнал принимает с ошибкой. ЧЯДНТ (Кроме того, что я использовал ИИ для решения этой задачи)?

На всякий случай:

OS: Artix Linux / Void Linux
Packages (Artix):
dbus-glib 0.114-1 dbus 1.16.2-1.1 lua-lgi 0.9.2-14 lua51-lgi 0.9.2-14 glib2 2.88.0-1 gobject-introspection 1.86.0-2
Packages (Void):
dbus 1.16.2_2 lua51-lgi 0.9.2_6 glib2 2.88.0_1 gobject-introspection 1.86.0_2

Dear @gnome community -- #umockdev is currently (mostly) written in #Vala . Despite being one of the nicest languages I ever used 💗, it feels like I should have a plan B. Is there any other sane language these days (i.e. *not* C) where one can export a #GObjectIntrospection API? #rustlang would be nice, but GI export got stuck in the middle 😢 Is it possible to do in Python, for example?

https://github.com/martinpitt/umockdev/

GitHub - martinpitt/umockdev: Mock hardware devices for creating unit tests and bug reporting

Mock hardware devices for creating unit tests and bug reporting - martinpitt/umockdev

GitHub

Write your own Wayland Desktop!
The "Astal" framework, which is written in Vala, makes it super-simple! (you can use it with any gobject-introspection language though)
https://aylur.github.io/astal/
Here a WIP project from our community. So far a custom status bar, quick settings, MPRIS, etc. Together with the Hyprland window manager. Built with #GTK4, #Blueprint, #Libadwaita and of course #Vala!
https://github.com/ARKye03/morghulis

#GTK #GObject #GObjectIntrospection #Wayland #Hyprland #Astal #freedesktop

Astal

Documentation website of the Astal project

@shriramk meanwhile C developers: What's the problem? ;)

#gobject #gnome #C #gobjectIntrospection #gtk #vala #vapi

We did a whole bunch of #Documentation and #GObjectIntrospection annotation cleanups for #phosh 0.39.0 so we're able to create #Rust bindings (https://gitlab.gnome.org/guidog/libphosh-rs) . But what could this be useful for? Who would want to use a #MobileShell as library?

#phrog 🐸 would! It's a #greetd compatible greeter by Sam Day written in #Rust: https://github.com/samcday/phrog . That way top-panel, quick settings, keypad, etc can basically look the same as in the logged in session.

#LinuxMobile

Guido Günther / libphosh-rs · GitLab

Welcome to GNOME GitLab

GitLab

No luck with the combo Guile + GTK (or GObject Introspection in general) in the Guix System 😞

Guile GI: https://lists.gnu.org/archive/html/guile-user/2023-11/msg00003.html

G-Golf on Guix: https://lists.gnu.org/archive/html/guile-user/2023-05/msg00024.html

I'll stick with Guile + web things for now.

#gnu #guix #guile #gtk #GObjectIntrospection

Re: status of guile-gnome and replacements?

🎉️ Added #GObjectIntrospection support for libflow

Not you can create flow graphs using large selection of programming languages including #python and #javascript

Code snippet: https://gist.github.com/SpikedPaladin/a755a73b04980b12efc64946a30b870d

https://github.com/SpikedPaladin/libflow
#Gtk #OpenSource

Python libflow example

Python libflow example. GitHub Gist: instantly share code, notes, and snippets.

Gist

It took me a day and there is still a lot to do, but I was able to get YOGA Image Optimizer running on #Windows! 😁️

(yeah I know, the icon theme is broken... But I will fix that 😅️)

#Python #GTK #GObjectIntrospection

This is in it's infancy but here's the first bits of #GObjectIntrospection for #Erlang using a c-node: