GSoC Idea: Tk Backend for the Wayland Display Protocol

Wayland Backend for Tk

Areas Tk
Good if student knows C, X11
Priority Low
Difficulty Hard
Benefits to the student Learning to read a large code base, and tease it apart
Benefits to Tcl ???
Mentor Mentor's name/link

Project Description

Initial Ideas

   I. Create a proof-of-concept for Tk running directly on the Wayland display protocol

   http://wayland.freedesktop.org/

References

  • See TkGS for an older attempt at reworking the underpinnings of Tk.
  • See this source code for how to actually get a working drawing surface with Wayland. Pay particular attention to the snippet including wl_egl_window_create and eglCreateWindowSurface

Comments & Discussion

PYK 2014-09-11: Would Tk perhaps get more mileage out of targeting SDL?

DKF 2014-09-11: Only if SDL has been ported to run on top of Wayland. (Googling indicates that experimental support is in SDL 2.0.2, but I don't know what that implies…)

chw 2017-01-11: The trunk of the fossil repository of http://www.androwish.org now provides Wayland support in undroidwish based on a modified version of SDL 2.0.5, which was tested successfully on the GNOME based Fedora 25 workstation. A self contained experimental undroidwish for x86_64 Linux with the Wayland and X11 drivers can be downloaded from http://www.ch-werner.de/AndroWish/undroidwish-wayland-linux64


dther - 2025-09-12 01:46:47

A missing Wayland back-end for Tk is the only real reason I don't want to leave X11. Xwayland is a fine solution, but has weird implementation greebles like the clipboard ceasing to exist once the last X application exits (see Clipboard on Wayland).

The issue preventing one from existing is that the Wayland protocol is just that, merely a protocol. Where X11 standardises much of what should be considered "basic desktop functions" like keyboard/mouse events, window decorations or sizing hints, Wayland leaves all of that to the discretion of the "compositor". In the context of Wayland fills the role of display compositor, window manager, IPC coordinator and default widget system plus styling hint database, all in one. Wayland promises a drawable surface and little more. I don't think it even promises that the surface maps linearly to 2D space, which affords creative uses like Simula's VR window manager.

Given that it's well proven that Tk on Wayland is at least possible thanks to Androwish and SDL, I wonder if the ideal "Tk backend" is something resembling a specialised xwayland server: a long-running process that provides Tk as a first-class widget system to more minimal compositors, much like how GTK could be considered a component of the GNOME desktop.


kevin_walzer - 2026-07-13 01:39:44

A full port of Tk to Wayland is under way in 2026 in the wayland branch. The port makes use of GLFW for windowing operations (GLFW has a mature Wayland back end) and NanoVG for 2-D drawing operations and font management. Clipboard integration is managed through the wl-clipboard toolset. Accessibility, system tray, and input methods are managed over D-Bus via the sd-bus library. As of July 2026 the port is in a pre-alpha stage and is not yet ready for testing, but steady progress is being made. The Tcl Core Team is targeting 9.2 for release of the Wayland port and will send out an invitation for testing and feedback when things are stable enough.