// Copyright (c) 2026 Storm Dragon // Authors: Storm Dragon, Angus Kola // SPDX-License-Identifier: GPL-3.0-or-later package xorg /* #include "window_title.h" */ import "C" import "unsafe" type ApplicationWindow struct { Application string PID int Wine bool } // ApplicationWindows runs on the native owner thread, like ReadTitle. func (reader *ForegroundReader) ApplicationWindows() []ApplicationWindow { if reader == nil { return nil } var count C.int native := C.cthulhu_list_application_windows(reader.display, &count) defer C.cthulhu_free_application_windows(native, count) var windows []ApplicationWindow for _, window := range unsafe.Slice(native, int(count)) { windows = append(windows, ApplicationWindow{C.GoString(window.application), int(window.pid), window.wine != 0}) } return windows }