Looking Glass

Looking Glass is GNOME Shell's integrated debugger and inspector tool. It aims to be the Firebug of GNOME Shell. It is not related to the older project Sun Looking Glass.

You currently run it by pressing Alt-F2, typing lg, then Return.

You can leave Looking Glass by pressing Esc in its Evaluator pane.

Looking Glass has four major panes (Evaluator, Windows, Errors, and Extensions) and one tool (the Picker).

Evaluator

This is an interactive JavaScript prompt. You can type arbitrary JavaScript at the prompt, and it will be evaluated. Try, in order:

1+1 

global.get_window_actors()

global.get_window_actors().forEach(function (w) { Tweener.addTween(w, { time: 3, transition: 'easeOutQuad', scale_x: 0.3, scale_y: 0.3 })})

global.get_window_actors().forEach(function (w) { w.set_scale(1, 1) })

global.get_window_actors()[0]

it.scale_x

Special evaluator features

This last bit, the it, deserves more explanation. One thing about the Evaluator that's different from say Python's default interactive prompt is that each computed value is saved by default, and can be referred back to. Typing r(number) will get you back the result with that number, and it is the last result.

The evaluator also has a history feature; you can press Up and Down to access previously used entries. The history is automatically saved to the dconf key /org/gnome/shell/looking-glass-history, and loaded when you restart the shell.

Slowing Down Animations

You can use Looking Glass to call the special function St.set_slow_down_factor(factor) where factor is a value greater than 1 to make all shell animations slower. This is particularly useful when implementing a new animation behavior.

Extensions

This is a list of all currently installed extensions. You can use the View Source link to quickly access the extension folder.

Errors

In 3.4 and earlier, there was an errors tab that showed you some errors and logging statements extensions, but not all of them: some JS errors were instead logged to stderr, which was usually transferred to your session log. If you weren't aware, you were blindly debugging.

In 3.6, all errors are now emitted to stderr, which should be available through your session log, if you are running gnome-shell from a session. The session log is available in ~/.cache/gdm/session.log on GDM 3.6, and ~/.xsession-errors with most other display managers.

The Picker

The picker allows you to visually select any object from the shell's scene. When you do, it's inserted as a result into the Evaluator pane.

Projects/GnomeShell/LookingGlass (last edited 2015-04-09 08:49:03 by MarcRechte)