dvdgiessen / dbus-app-launcher Goto Github PK
View Code? Open in Web Editor NEWA simple service that allows executing a program via D-Bus.
License: MIT License
A simple service that allows executing a program via D-Bus.
License: MIT License
I am experimenting with this and was wondering how to invoke a command with multiple arguments? I hope this fake shell session helps to illustrate my current issue.
# Works as expected
❯ ydotool mousemove -x 100 -y 100
❯ qdbus nl.dvdgiessen.dbusapplauncher /nl/dvdgiessen/DBusAppLauncher nl.dvdgiessen.dbusapplauncher.Exec.CmdArgs "ydotool" "mousemove" "x" "100" "y" "100"
Invalid number of parameters
❯ qdbus nl.dvdgiessen.dbusapplauncher /nl/dvdgiessen/DBusAppLauncher nl.dvdgiessen.dbusapplauncher.Exec.CmdArgs "ydotool" "mousemove -x 100 -y 100"
❯ journalctl -b | grep dbus
Apr 06 14:28:35 incitatus systemd[4137]: Started dbus-:[email protected].
Apr 06 14:29:20 incitatus dbus-app-launcher[1431494]: ydotool: Unknown command: mousemove -x 100 -y 100
Multiple args do not work and if I try to use multiple arguments as the final param, they get interpreted as a string and not individual args?
When I run this in my terminal, the notification shows up as expected:
❯ qdbus nl.dvdgiessen.dbusapplauncher /nl/dvdgiessen/DBusAppLauncher nl.dvdgiessen.dbusapplauncher.Exec.CmdArgs "notify-send" "test"
However, this call from a Kwin script does nothing:
callDBus(
"nl.dvdgiessen.dbusapplauncher",
"/nl/dvdgiessen/DBusAppLauncher",
"nl.dvdgiessen.dbusapplauncher.Exec",
"CmdArgs",
"/usr/bin/notify-send",
"test"
);
Note: the kwin script itself works and the call is made. For example, when I use it with Cmd
, /usr/bin/konsole
the konsole pops up. The logs (journalctl -b | grep dbus
) are completely empty.
To make it easier to execute a command line given as a string without first having to split the string in the calling application, we could add a method that parses a string into a command, arguments, and perhaps even environment variables, similar to how the shell would parse such a command line.
The shellwords package seems to be perfect for this.
This will also help work around the issue noted in #2, namely that there's no easy way to call a DBus method with a StringList argument in the KWin JS API.
I'm recommending the change in documention regarding how to use this to not use:
/usr/share/dbus-1/services/nl.dvdgiessen.dbusapplauncher.service
As this is a path intended for packaged system software's defaults, where:
/etc/dbus-1/services/
Is for System Administrators, and for actual users, where this matters the most in this specific situation:
~/.local/share/dbus-1/services/
Which can be created by the user and the same file placed which overrides any system defined service(s) of the same name in /etc or /usr/share directory paths.
Today after a system update dbus-app-launcher stopped working. manually running /usr/bin/dbus-app-launcher
returns this error:
/usr/bin/dbus-app-launcher: error while loading shared libraries: libHSextra-1.7.14-jQJF8WyS7TA7SEILRSf4e-ghc9.2.8.so: cannot open shared object file: No such file or directory
I installed dbus-app-launcher from the AUR in EndeavourOS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.