Nepedia
Back to Discover
Advanced Reader
💻

GTK

technology Maturity 7-9 war conflict Next article →

This article covers sensitive topics: war_conflict. Parents can manage visibility in Parental Controls.

GTK is a free, open-source widget toolkit used to create graphical user interfaces (GUIs). A GUI is the visual layer that allows people to interact with software through icons, buttons, and menus.

The GTK toolkit
The GTK toolkit

While it is primarily used for Linux and the GNOME desktop environment, it is highly versatile. GTK is licensed under the GNU LGPL. This specific license allows both free software and proprietary software to utilize the toolkit. The GTK team maintains several versions. Currently, GTK 4 and GTK 3 are actively maintained. Older versions like GTK 2 are no longer supported. GTK 1 is maintained independently by the CinePaint project.

To understand how GTK works, one must look at its layered software architecture.

GTK+ software architecture
GTK+ software architecture

At the top level, the GTK library provides a set of graphical control elements known as widgets. As of version 3.22.16, the toolkit contains 186 active widgets and 36 deprecated widgets. GTK is an object-oriented toolkit written in the C programming language. It utilizes the GObject system, which is part of the GLib library, to handle its object-oriented structure. Below the widgets lies the GTK Scene Graph Kit, or GSK. GSK acts as the rendering and scene graph API. It sits between the high-level widgets and the actual rendering process.

GDK software architecture
GDK software architecture

GSK was merged into GTK version 3.90 in March 2017.

The rendering process relies on several specialized components to display images correctly. The GTK Drawing Kit, or GDK, acts as a wrapper around low-level functions. These functions are provided by the underlying windowing and graphics systems. To draw most graphical elements, GTK uses Vulkan or GL. The toolkit can also be configured to change the appearance of widgets. This is achieved through different display engines. These engines attempt to emulate the look of native widgets on the specific platform being used. This ensures that a GTK application looks natural whether it is running on a computer or a mobile device.

GTK is capable of running on many different operating systems through the use of backends. A backend is a way for the toolkit to communicate with a specific system's display server. For modern Unix-like systems, GTK uses Wayland or its predecessor, X11. For Microsoft Windows, it interfaces with the Windows API via the Win32 backend. On macOS, it uses the Quartz interface. There is also a backend called Broadway. This allows GTK applications to run in web browsers using HTML5 and WebSockets. However, Broadway and X11 were both deprecated in 2025. They are scheduled for removal in the upcoming GTK version 5.

Developers have several tools to make building these interfaces easier. One important tool is GtkBuilder. This allows designers to create user interfaces without writing complex code. Instead, the interface is described in an Extensible Markup Language (XML) file. This file can be written by hand or created with a GUI designer. The file is then loaded at runtime to create the objects automatically. This makes the interface design independent of the programming language. There are many GUI designers available, such as Cambalache, which supports GTK 4.

Other designers include Glade, Gazpacho, and Crow Designer.

History shows that GTK grew out of a need for better graphics tools. It was originally designed for the GIMP (GNU Image Manipulation Program). A developer named Peter Mattis began writing the toolkit to replace an older system called Motif. He successfully replaced Motif by the 0.60 release of GIMP. Later, the toolkit was rewritten to be object-oriented and renamed GTK+. The GNOME Foundation eventually took over its maintenance. In February 2019, the team dropped the "+" from the name during a Hackathon. Significant updates have defined its eras. GTK 2.0.0 was released in 2002. GTK 3.0.0 arrived in 2011, introducing CSS-like syntax for themes. GTK 4 was released in December 2020.

Despite its success, GTK has faced criticism regarding its development choices. A common complaint is the lack of backward compatibility during major updates. When the application programming interface (API) or theming changes, developers must often rewrite their code. In 2013, developer Benjamin Otte noted that these changes were driven by the need to innovate. This included supporting the Wayland protocol. However, some major projects have moved away from GTK to avoid these issues. The LXDE project moved to Qt and became LXQt. The Audacious music player and the Wireshark tool also switched to Qt. These developers cited concerns over API changes and cross-platform support.

Even with these challenges, GTK remains a pillar of modern computing. It powers many famous applications, including Mozilla Firefox, LibreOffice, and Inkscape.

GIMP 2.8 in Single Window Mode running on Ubuntu
GIMP 2.8 in Single Window Mode running on Ubuntu

It is also the foundation for several desktop environments. The GNOME desktop is built entirely on GTK. Other environments like Cinnamon, MATE, and Xfce also utilize the toolkit. Because it is used by so many different programs and systems, GTK is a vital part of the open-source ecosystem.

815 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (7)
File:The GTK toolkit.png
The GTK toolkit.png
File:GTK+ software architecture.svg
GTK+ software architecture.svg
File:GDK software architecture.svg
GDK software architecture.svg
File:Camabalache's interface.png
Camabalache's interface.png
File:Gtk-inspector.png
Gtk-inspector.png
File:Free and open-source-software display servers and UI toolkits.svg
Free and open-source-software display...
File:GIMP 2.8 in Single Window Mode running on Ubuntu.png
GIMP 2.8 in Single Window Mode running on...
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.