12

I had asked another question which is related. I know that I can invoke lg (looking glass) via the gnome-shell "run application" window (by pressing Alt+F2). What I'd like to know is how to do this from a command line?

For example, if I wanted to pop up the looking glass from a shell script, how would I do it?

(my other question)

2

3 Answers 3

9

You can use the following command to launch looking glass from a terminal or keyboard shortcut:

gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.lookingGlass.toggle();'

When you get in DE, you can't use keyboard shortcut to run "looking glass", you have to use ALT+F2 to run it at first time.

4
  • This does nothing for me except return (false, 'TypeError: Main.lookingGlass is null') Is that expected?
    – Cerin
    Apr 7, 2021 at 23:42
  • On dbus version 1.12.20 and GNOME Shell 40.4 I can eval with this command: dbus-send --session --dest=org.gnome.Shell --print-reply --type=method_call /org/gnome/Shell org.gnome.Shell.Eval string:'Main.lookingGlass.toggle();'
    – fzbd
    Sep 6, 2021 at 13:17
  • As of gnome-shell 42.0, neither the gdbus call nor dbus-send approaches seem to be working. Both respond with (false, "") to all lookingglass commands.
    – cha
    Apr 10, 2022 at 18:59
  • 1
    This appears to be due to new restrictions on Eval, which require running in a special "unsafe mode".
    – cha
    Apr 10, 2022 at 19:23
2

Looking glass is built into gnome-shell and the command for looking glass is lg

Currently it can be run from gome shell by typing Alt+F2 and then typing lg in the dialog box.

I will see of I can find a better solution.

1
  • By command line, Op is talking about the terminal, not keyboard shortcuts in the Gnome UI. I'm also interested in this question because in some environments, you can't press the alt key, like in VNC, without triggering the same behavior in the host's Gnome desktop.
    – Cerin
    Apr 7, 2021 at 23:44
1

I don't have enough rep to comment; cha's comment explains that the dbus methods don't work out of the box anymore; dbus calls to gnome shell don't work under Ubuntu 22.04 has a non-ideal solution that works without restarting anything or loading plugins.

1
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Pilot6
    Aug 26, 2022 at 6:32

You must log in to answer this question.

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