DBusSession: Exist() is a new method that returns if a specific name is available on the bus.

[GB.DBUS]
* NEW: DBusSession: Exist() is a new method that returns if a specific name is available on the bus.
This commit is contained in:
Benoît Minisini 2023-05-12 11:17:37 +02:00
parent 545518406f
commit 0ed5403c0e
2 changed files with 8 additions and 1 deletions

View file

@ -58,3 +58,10 @@ Public Sub _get((Application) As String) As DBusApplication
End End
'' Check if a specific application name is used
Public Sub Exist((Application) As String) As Boolean
Try Return DBus["org.freedesktop.DBus"]["/", "org.freedesktop.DBus"].NameHasOwner(Application)
End

View file

@ -173,7 +173,7 @@ Public Sub Main()
hSignal = New DBusSignal(DBus.Session, "org.freedesktop.portal.Request", "/org/freedesktop/portal/desktop/request/" & Replace(Mid$(DBus.Session._Name, 2), ".", "_") & "/Gambas1972") As "ResponseSignal" hSignal = New DBusSignal(DBus.Session, "org.freedesktop.portal.Request", "/org/freedesktop/portal/desktop/request/" & Replace(Mid$(DBus.Session._Name, 2), ".", "_") & "/Gambas1972") As "ResponseSignal"
Print DBus["org.freedesktop.portal.Desktop"]["/org/freedesktop/portal/desktop", "org.freedesktop.portal.Screenshot"].Screenshot("", ["handle_token": "Gambas1972", "interactive": True]) Print DBus["org.freedesktop.portal.Desktop"]["/org/freedesktop/portal/desktop", "org.freedesktop.portal.Screenshot"].PickColor("", ["handle_token": "Gambas1972", "interactive": True])
End End