francium francium - 2 months ago 25
Linux Question

i3 WM (tiling manager) create popup window

When I make a pygame window (I believe it uses SDL), it launches as a popup window, as I want, since then it doesn't affect the layout or visibility of elements. But if I launch a simple program using GTK and Cairo, it doesn't launch as a popup. Is there some specific env flag, signal, etc. that needs to be used to launch a window as a popup rather than a tiled window?

pygame hello world code

Pygame Hello World

cairo+gtk code, GTK Window section, past mid point of page
Cairo Hello World

Answer

To do this in GTK, you need to call

gtk_window_set_type_hint((GtkWindow*)windowname, GDK_WINDOW_TYPE_HINT_DIALOG);

https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-set-type-hint

i3 will take window hints, and if a window tells i3 it is a dialog window, it will make it float automatically.