Use `tilix --working-directory %d` for tilix. Otherwise the daemon will have the
workspace dir as working directory. Subsequent new windows might inherit that
directory. (eg. in spaces that doesn't specify an explicit directory(?))
We override these methods so this will work from the typical launchers:
Shell.App.open_new_window
Shell.App.launch_action('new-window', ...)
Gio.DesktopAppInfo.launch
Gio.DesktopAppInfo.launch_action('new-window', ...)
NOTE: overridden `launch` can act somewhat strange with single process many
window apps if the process. If the process is launched with a specific directory
new windows might inherit this on non-overridden `new-window`. (seen in Tilix)
Invoking `app.open_new_window` on gnome-terminal does not inherit $PWD. We want
that so take matter into our own hands.
Note: vte.sh must be sourced in the terminal's shell.
Other approaches:
Write a custom .desktop file where "Exec" is a custom script (Note that it's
probably not possible to call the dbus action using dbus-send or qdbus due to
the argument structure)
I tried to use the dbus interface directly from js too, but it seems basically
impossible to call correctly..
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
Gio.DBus.session.call(
metaWindow.gtk_unique_bus_name,
metaWindow.gtk_window_object_path,
"org.gtk.Actions",
"Activate",
GLib.Variant.new_tuple([
new GLib.Variant("s", "new-terminal"),
GLib.Variant.new_array(null,
[new GLib.Variant('(ss)', ["window", "current"])]),
GLib.Variant.new_array(new GLib.VariantType("{sv}"), [])
]),
null, Gio.DBusCallFlags.NONE, -1, null,
(conn, result) => {}
);
Complains about wrong type - wants the first array to be "av", not "a(ss)", but
I don't know how to create a "opaque" variant..
Keywords: current directory
We're assessing all top level declarations from outside the original scope when
we're evaluating code. So everything should be `var`.
Classes are `let` bound so we should use var for `ClickOverlay` too, but there's
a bug in gnome-shell-mode making such statements not evaluate. We therefor wait
for that to be fixed.