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:
Ideas for further development
GtkInspector is already pretty useful, but it could be even better. Here are some ideas for things to work on, in no particular order. Your help is appreciated!
Show mainloop statistics: how many sources are attached, how often do they fire, how long they take ... Needs support in GLib 710723
- Add a more structured css editor. Look at any major web browser for ideas
- Show overridden styles
- Capture g_log output and show it - recursion danger here, if showing the log generates more logs
- Add logging (property changes, traced signal emissions, etc)
- Visual box model debugging: highlight margin, borders, etc
- Add a D-Bus api; being able to introspect the application and inject changes from an IDE is a powerful idea
- Isolate the inspector window from global state changes (style, text direction, visual debugging,...) if they come from the inspector itself. This has been improved by using a separate display connection for the inspector. Left to do are baselines, pixel cache and touch simulation.
- Show child types (ie. 'center', 'title', 'tab' etc). Needs GTK+ api
- Indicate modified properties in the UI, and add a way to reset them
Store the ui file/resource foshortcuts Controlr each object constructed by GtkBuilder, and have a 'jump to definition' link in the inspector
- Recorder: Record a widget and allow playing back the recording. Allows debugging animations.