16

Is there a way to invoke the Activities view of GNOME from the Linux command line? This is what the Super key invokes from GNOME. Once it is shown, I can interact with it as usual using the mouse.

I'm using Ubuntu 18.04 LTS.

The reason I'm asking: I'm viewing the desktop that I need to "send" the Super key into via a TeamViewer session. TeamViewer has a way to send Ctrl+Alt+Delete, but that of course is for Windows remotes, while this is pure Ubuntu-to-Ubuntu here. Even if TeamViewer was not involved, and I was using VNC, I would have the same problem.

bgoodr
  • 1,612

4 Answers4

22

A command for GNOME versions up to GNOME 40 (that is up to Ubuntu 21.04) 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).

vanadium
  • 97,564
5

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
muru
  • 207,228
5

The safe answer, which doesn't rely on the Eval() method for GNOME > 41 is:

dbus-send --session --dest=org.gnome.Shell --type=method_call /org/gnome/Shell org.freedesktop.DBus.Properties.Set string:org.gnome.Shell string:OverviewActive variant:boolean:true

To exit the Activities overview, replace variant:boolean:true with variant:boolean:false in the above command.

See https://github.com/hardpixel/dash-to-plank/issues/12#issuecomment-934820153 for reference.

Musinux
  • 156
4

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();" 
    
mmoya
  • 523