Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How do I open GTK Inspector?

Writer Mia Lopez

I am using GTK.3.15. When attempting to open GTK Inspector using the Ctrl+Shift+I or Ctrl+Shift+D, nothing happens. Does not matter what application or widget I am using. Nothing happens

and my understanding is that this option comes standard on GTK 3.15. Does anyone know how

to use this tool in GTK 3.15?

6

3 Answers

I got this from :

GtkInspector is the built-in interactive debugging support in GTK+. It was added in GTK+ 3.14, based on a copy of the well-estabished gtkparasite.

The debugger is disabled by default. To enable it run in a terminal:

gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true

And launch it pressing on the keyboard Control-Shift-I or Control-Shift-D.

If you don't want to use the shortcuts, you can also run it temporarily directly when running your app with:

GTK_DEBUG=interactive your-app

Looking further, I found Bug #1523929 which indicates that users can install libgtk-3-dev which then provides the schema. Note that installing libgtk-3-dev may bring in a lot of dependencies.

3

Method 1:


Enable the shortcut:

  1. Install dconf-editor with sudo apt-get install dconf-editor
  2. Navigate to org > gtk > settings > debug
  3. Set enable-inspector-keybinding to true
  4. Try the shortcut.

Method 2:


Run the program to debug with the GTK_DEBUG variable:

Instead of running the program to debug as usual (myprogram --argument) you only need to run it of this way (GTK_DEBUG=interactive myprogram --argument)

Also you can export that variable with export GTK_DEBUG=interactive and then run the program.

5

The wiki page for the Inspector seems to be out of date, because it's clearly steered a lot of people in a lot of wrong directions.

If you don't want to use the shortcuts, you can also open the Inspector directly when running your app with:

This is nonsense. You always have to use the shortcut, no matter what.

To launch the GTK Inspector, focus your GTK application and press Control-Shift-D. Alternatively, move your mouse cursor to your desired widget and press Control-Shift-I to specifically inspect the widget under the mouse cursor.

Again, nonsense. Ctrl+Shift+D does nothing. The only keybinding I've ever seen work is Ctrl+Shift+I, which is not an interactive picker, it just opens the Inspector. I suspect the "pick a widget"-style functionality is a relic from the pre-Wayland days.

To get to the inspector, you have to do all of these things:

  1. Install the gtk3-devel / libgtk-3-dev package

  2. Enable the dconf key /org/gtk/settings/debug/enable-inspector-keybinding / GSettings key org.gtk.Settings.Debug enable-inspector-keybinding (same thing) and optionally disable org.gtk.Settings.Debug inspector-warning.

    (Note that "keybinding" is singular, not plural. AFAICT that's accurate, there's only the one.)

  3. Run a program with GTK_DEBUG=1 in the environment.

    (The value "interactive" is not special, AFAICT, any value will work except perhaps 0.)

  4. When the application is open and focused, type Ctrl+Shift+I

The inspector window should open. Tested on both Wayland and X11. If any of the steps are missing, no dice. The inspector cannot be used without GTK_DEBUG, and even with GTK_DEBUG it will not open if the keybinding is not enabled.

Note also that org.gtk.gtk4.Settings.Debug has its own enable-inspector-keybinding key. But that one defaults to true, so this should work for GTK4 apps as well.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy