gtk4-builder-tool(1)

πŸ’– gtk4-builder-tool β€” the GtkBuilder File Utility πŸ’–

okay bestie, so this little icon is part of the GTK commands lineup, and honestly? it's the backstage pass to your GtkBuilder files. let's get into it πŸ’…


✨ SYNOPSIS ✨

gtk4-builder-tool <COMMAND> [OPTIONS...] <FILE>

gtk4-builder-tool validate [OPTIONS...] <FILE>
gtk4-builder-tool enumerate [OPTIONS...] <FILE>
gtk4-builder-tool simplify [OPTIONS...] <FILE>
gtk4-builder-tool preview [OPTIONS...] <FILE>
gtk4-builder-tool render [OPTIONS...] <FILE>
gtk4-builder-tool screenshot [OPTIONS...] <FILE>

like, you pick a COMMAND, toss in some [OPTIONS...], point it at your <FILE> and let it cook πŸ“


🌸 DESCRIPTION 🌸

gtk4-builder-tool is the girl who can do ✨various operations✨ on GtkBuilder UI definition files. that's the whole vibe. she runs errands on your UI files and she does not miss. 🫢


πŸ‘‘ COMMANDS πŸ‘‘

πŸŽ€ Validation

bestie the validate command is your vibe check πŸ’… it validates the given UI definition file and reports errors to stderr β€” so if something's messy, it will read you for filth. (lovingly. it's constructive.)

real talk tho, there are limitations to the validation that can be done for templates, because templates are closely tied to the class_init function they are used in. and if your UI file uses types from third-party libraries? it may help to add those libraries to the LD_PRELOAD environment variable. noted, queen. πŸ“
  • --deprecations β€” warn about uses of deprecated types in the UI definition file. she's giving you the heads up, not the silent treatment. ⭐

πŸ¦‹ Enumeration

the enumerate command prints all the named objects that are present in the UI definition file. like a roll call for your UI. everybody say present πŸ™‹β€β™€οΈ

  • --callbacks β€” print the names of callbacks as well. now those besties get named too πŸ’œ

πŸŽ€ Preview

the preview command displays the UI definition file. literally shows you the fit in the mirror πŸ’–

this command accepts options to specify the ID of the toplevel object and a CSS file to use.

  • --id=ID β€” the ID of the object to preview. if you don't specify it, gtk4-builder-tool will choose a suitable object on its own. she's got taste, trust her. ✨
  • --css=FILE β€” load style information from the given CSS file. serve the looks. πŸ’…

πŸ”₯ Render

the render command saves a rendering of the UI definition file as a png image or node file. the name of the file to write can be specified as a second FILE argument. yes bestie, two files. she's doing the most and we love that for her.

this command accepts options to specify the ID of the toplevel object and a CSS file to use.

  • --id=ID β€” the ID of the object to preview. if you don't specify it, gtk4-builder-tool will choose a suitable object on its own. (yes, same energy as above. she's consistent. iconic.) 🌈
  • --css=FILE β€” load style information from the given CSS file. glow up incoming. 🧚
  • --node β€” write a serialized node file instead of a png image. different format, same queen. πŸ‘‘
  • --force β€” overwrite an existing file. she said move, respectfully. πŸ’€

⭐ Screenshot

the screenshot command is an alias for render. that's it, that's the whole thing β€” same girl, different name tag. main character energy either way. πŸ˜­πŸ’–


πŸ“ Simplification

the simplify command simplifies the UI definition file by removing properties that are set to their default values and writes the resulting XML to the standard output, or back to the input file. declutter, cleanse, simplify, periodt. ✨

when the --3to4 option is specified, simplify interprets the input as a GTK 3 UI definition file and attempts to convert it to GTK 4 equivalents. it performs various conversions, such as renaming properties, translating child properties to layout properties, rewriting the setup for GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes. it's a whole transformation arc and honestly? she ate. πŸ”₯

⚠️ okay this is the serious part and I mean it: you should always test the modified UI definition files produced by gtk4-builder-tool before using them in production. no cap. do not skip this. πŸ™ˆ
and note in particular that the conversion done with --3to4 is meant as a starting point for a port from GTK 3 to GTK 4. it is expected that you will have to do manual fixups after the initial conversion. she's your assistant, not your replacement, bestie. πŸ’œ
  • --replace β€” write the content back to the UI definition file instead of using the standard output. in-place edits, brave of you. πŸ’…
  • --3to4 β€” transform a GTK 3 UI definition file to the equivalent GTK 4 definitions. glow-up machine. πŸ¦‹

and that's the whole page, babe πŸŽ€ this one ships with GTK and lives in the manual as gtk4-builder-tool(1) β€” go forth, validate your files, and slay πŸ’–βœ¨πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from
  • ubuntu stonking: libgtk-4-bin 4.24.1+ds-1 Β· LGPL-2.0-or-later AND LGPL-2.1-or-later AND sun-permissive AND lcs-telegraphics-permissive AND X11R5-permissive AND MIT AND BSD-3-clause-Google AND Apache-2.0 AND CC0-1.0 AND ZPL-2.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms