如何从gnome shell扩展中调出命令行程序?
问题描述:
我已经编写了一个简单的Shell脚本来完成一项常见任务,并且我希望能够在单击按钮时立即运行它.我已经使用gnome-shell-extension-tool创建了Hello World示例,但是现在我需要知道如何在单击时简单地使其运行任意命令.没有要考虑的输入或输出;它只需要运行.
I have written a simple shell script to accomplish a common task, and I want to be able to run it whenever a button is clicked. I've used gnome-shell-extension-tool to create the Hello World example already, but now I need to know how to simply have it run an arbitrary command when clicked. There is no input or output to be concerned with; it just needs to run.
答
经过更多创造性的搜索之后,我找到了解决方法:
After some more creative googling, I've found the solution:
const Util = imports.misc.util;
Util.spawn(['/path/to/program', 'arg1', 'arg2'])