Commit Graph

9 Commits

Author SHA1 Message Date
Ole Jørgen Brønner
426d44bf11 app: mkCommandLineSpawner util expanding %d to workspace directory
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(?))
2019-10-18 19:21:45 +02:00
Tor Hedin Brønner
86d8b6275f app: Don't throw in spawnWindow, let trySpawnWindow throw
`spawnWindow` can be useful from `user.js`, so we make it always succeed, while
we while we introduce a throwing `trySpawnWindow` for internal use.
2019-10-18 19:21:45 +02:00
Tor Hedin Brønner
2c7bfae7d7 app: Fall back to original spawn when space.directory is unset
If the user haven't set a workspace directory we play it safe and call the
spawn the app with the non-kludged method.
2019-10-18 19:21:45 +02:00
Ole Jørgen Brønner
739c4350d7 app: Launch new windows from the workspace directory if set
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)
2019-10-18 19:21:45 +02:00
Ole Jørgen Brønner
528154db4e app: launchFromWorkspaceDir util 2019-10-18 19:21:45 +02:00
Tor Hedin Brønner
5b491d77a9 app: Look up custom window handlers in a dict
This makes it easier to add new handlers in `user.js`.
2018-06-15 10:19:29 +02:00
Ole Jørgen Brønner
33a365f326 Handle gnome-terminal specially in newWindow
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
2018-05-21 14:32:06 +02:00
Tor Hedin Brønner
42aedba3b6 Use var for all top level declarations to avoid warnings
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.
2018-04-30 00:03:08 +02:00
Tor Hedin Brønner
56708fee15 Super+n: Global new window binding
Add a new window action, bound to Super+n by default. This clashes with the
`focus-active-notification` so we kill it.

Schema change!
2018-01-10 10:00:03 +01:00