Invoking GNOME Activities overview from command line

Solution 1:

A command that causes the shell to switch to the overview is:

dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.show();'

Use Main.overview.hide(); to close the overview, or Main.overview.toggle(); to toggle between overview and normal view (with thanks to gatr and Marcelo Avila).

Solution 2:

There might be a proper command line way to interact with various GNOME Shell components (using DBus, I suppose), but a quick and dirty way is to simulate the keypress:

xdotool key super

Solution 3:

From GNOME 41 onwards you need an extension.

As of GNOME 41, the dbus method Eval() is now restricted with MetaContext:unsafe-mode property (see this commit). This extension provides unrestricted Eval() dbus method for running arbitrary code in the compositor.

(source)

So the solution is:

  1. Install the eval-gjs extension:

  2. Use --object-path /dev/ramottamado/EvalGjs and --method dev.ramottamado.EvalGjs.Eval, like:

     gdbus call \
       --session \
       --dest org.gnome.Shell \
       --object-path /dev/ramottamado/EvalGjs \
       --method dev.ramottamado.EvalGjs.Eval "Main.overview.show();"