Make a function to get launched_uris from gio.desktopappinfo and meta.window
Feature summary
I want to get the path of opened file(s) via gnome extension. The problem I am trying to solve is https://unix.stackexchange.com/a/745519/206574 . So basically when i use the shortcut, it will open the file that is opened via a gui application, in the file explorer. For that I need to log window id, process id and opened file path(s). Getting window id and process id seems to be easy (as can be seen in https://github.com/ickyicky/window-calls/blob/main/extension.js). But there is no elegant way to get the opened file path(s).
I have asked a question in details in https://discourse.gnome.org/t/get-the-opened-file-path-and-application-via-extension/15352 . The info I want is already in the dbus:
signal time=1684395360.751890 sender=:1.93 -> destination=(null destination) serial=971 path=/org/gtk/gio/DesktopAppInfo; interface=org.gtk.gio.DesktopAppInfo; member=Launched
array of bytes "/home/ismail/.local/share/applications/com.github.johnfactotum.Foliate.desktop" + \0
string ""
int64 85979
array [
string "file:///media/ismail/SSDWorking/book-collection/_Books/Eleven%20Rings%20The%20Soul%20of%20Success%20(Phil%20Jackson,%20Hugh%20Delehanty)%20.epub"
]
array [
dict entry(
string "origin-desktop-file"
variant array of bytes "/home/ismail/.local/share/applications/nemo.desktop" + \0
)
dict entry(
string "origin-prgname"
variant array of bytes "nemo" + \0
)
dict entry(
string "origin-pid"
variant int64 4877
)
]
We can set the uris but can not get the uris. There is no easy way to get the data (I have not tried it yet but think that it can be done using signal_subscribe(sender, "org.gtk.gio.DesktopAppInfo", "Launched", "/org/gtk/gio/DesktopAppInfo", arg0, flags, callback)
).
How would you like it to work
I have found in https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/gdesktopappinfo.c#L3082-3087 that we are already using launched_uris
.
If you can kindly give us a method (hopefully in both https://gjs-docs.gnome.org/gio202.0/gio.desktopappinfo and https://gjs-docs.gnome.org/meta1212/meta.window) that will give use the opened file path(s), then it will be of great help.