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.

0

4 Answers 4

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).

8
  • reverse action would be dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.hide();'
    – gtatr
    Mar 28, 2019 at 14:13
  • toggle works as well, with: dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.toggle();'
    – avila
    Nov 20, 2019 at 0:59
  • How about show applications ?
    – Fadly Dzil
    Dec 21, 2019 at 9:06
  • @FadlyDzil, this question is about the activities overview.
    – vanadium
    Dec 21, 2019 at 9:08
  • 1
    Not working anymore since GNOME 41, see my answer.
    – mmoya
    Nov 22, 2021 at 11:27
4

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
4
  • 1
    This one worked. The subsequent answer by vanadium has to be the correct answer because xdotool is not installed by default, and I suspect that dbus-send is installed by default. So I am forced into giving vanadium "the" answer mark. Thanks for your quick response though.
    – bgoodr
    Nov 25, 2018 at 18:13
  • That is also the "fundamental" solution, i.e. directly communicating with the proces through the command line. The xdotool trick would work well, but is a hack - simulating keystrokes. May, moreover, not work for users that use Wayland as their displayserver.
    – vanadium
    Nov 26, 2018 at 9:20
  • @vanadium that's why I called it the "proper" way, but like a lot of GNOME stuff, the proper way is rather obscure.
    – muru
    Nov 26, 2018 at 10:06
  • Underrated comment. It worked and it is also easier.
    – Allexj
    Sep 7, 2020 at 11:16
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();" 
    
2
  • Not yet applicable on this site currently - as Gnome 41 is not yet in Ubuntu, but valuable addition for spring 2021: upvoting!
    – vanadium
    Nov 22, 2021 at 11:57
  • This seems to work with GNOME 42 as well, but you have to edit the metadata.json to change the version number. May 15, 2022 at 21:37
4

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.

1
  • This answer works great for GNOME > 41 and doesn't need any additional extension to be installed. +1 ;) Mar 15, 2023 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .