Giter Club home page Giter Club logo

Comments (4)

DvdGiessen avatar DvdGiessen commented on June 27, 2024

Similar to #1, I'm suspecting the problem might be that second argument to CmdArgs should be a list, but is given a string. So the call probably fails with a type error.

Can you try passing a JavaScript array, something like this:

callDBus(
  "nl.dvdgiessen.dbusapplauncher",
  "/nl/dvdgiessen/DBusAppLauncher",
  "nl.dvdgiessen.dbusapplauncher.Exec",
  "CmdArgs",
  "/usr/bin/notify-send",
  ["test"]
);

EDIT: And since callDBus is asynchrounous and the DBus service might even have to be autostarted first, you won't immediately get a type error thrown in the JavaScript code; since that function call has already returned before the type error even happens.

from dbus-app-launcher.

r0skar avatar r0skar commented on June 27, 2024

Unfortunately, using an array does not seem to make a difference. Nothing happens. The journal logs are empty and adding a catch is also never triggered (not sure if that is even supported in kwin) - same is true if i add a callback function as the final argument.

from dbus-app-launcher.

DvdGiessen avatar DvdGiessen commented on June 27, 2024

Hm, I was hoping that it would automatically convert it to a StringList correctly, but I think it's trying to transmit it as a VariantList instead.

After digging a little bit I found the KWin function doesn't do any special conversion, nor does the QJSValue code. So the JS array is converted to a QVariantList instead of the QStringList we would need: Because when the time comes to convert this to a DBus type it must be specifically a QStringList to get converted to the correct StringList type.

So it would seem there currently is no way to call a DBus function from KWin which requires a QStringList argument. For that to be possible someone would probably need to extend the KWin JS API with an explicit constructor for a QStringList. The toStringList() method seemingly can help with that, it will convert to a QStringList if all the variants within can be converted to QStrings.

from dbus-app-launcher.

DvdGiessen avatar DvdGiessen commented on June 27, 2024

Closing since this is not really a bug or something to fix in dbus-app-launcher but is a limiation in the KWin JS API that would need to be addressed there.

If the arguments you need to pass do not change, you could try to work around this by creating a simple script file that does not require any arguments and calling that from your KWin script.

I've also opened #3 as a feature request that could perhaps provide an alternative way to mitigate this KWin JS API limitation by adding a new method that would employ shell-like command line parsing.

from dbus-app-launcher.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.