How do I open GTK Inspector?
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?
63 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 trueAnd 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-appLooking 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.
Method 1:
Enable the shortcut:
- Install
dconf-editorwithsudo apt-get install dconf-editor - Navigate to
org>gtk>settings>debug - Set
enable-inspector-keybindingtotrue - 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.
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 pressControl-Shift-Ito 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:
Install the
gtk3-devel/libgtk-3-devpackageEnable the dconf key
/org/gtk/settings/debug/enable-inspector-keybinding/ GSettings keyorg.gtk.Settings.Debug enable-inspector-keybinding(same thing) and optionally disableorg.gtk.Settings.Debug inspector-warning.(Note that "keybinding" is singular, not plural. AFAICT that's accurate, there's only the one.)
Run a program with
GTK_DEBUG=1in the environment.(The value "
interactive" is not special, AFAICT, any value will work except perhaps0.)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.