private static async Task PrintTree(X11Client client, uint window, int depth) { var windowNameAtom = await client.InternAtomAsync("_NET_WM_NAME", false).ConfigureAwait(false); var windowName = await client.GetStringPropertyAsync(window, windowNameAtom).ConfigureAwait(false); var geometry = await client.GetGeometryAsync(window).ConfigureAwait(false); for (var i = 0; i < depth; i++) { Console.Write(" "); } Console.WriteLine("0x{0:x} {1} {2}x{3}+{4}+{5} {6} {7}", window, windowName, geometry.Width, geometry.Height, geometry.X, geometry.Y, geometry.BorderWidth, geometry.Depth); var result = await client.QueryTreeAsync(window).ConfigureAwait(false); foreach (var child in result.Children) { await PrintTree(client, child, depth + 1).ConfigureAwait(false); } }
private static async Task <uint> FindWagahighWindow(X11Client client, uint root) { var windowNameAtom = await client.InternAtomAsync("_NET_WM_NAME", false).ConfigureAwait(false); foreach (var child in (await client.QueryTreeAsync(root).ConfigureAwait(false)).Children) { if ((await client.GetStringPropertyAsync(child, windowNameAtom).ConfigureAwait(false)) == "ワガママハイスペック") { return(child); } } throw new Exception(); }
private static async Task <uint?> FindWagahighWindow(X11Client x11Client, uint root) { var windowNameAtom = await x11Client.InternAtomAsync("_NET_WM_NAME", false).ConfigureAwait(false); foreach (var child in (await x11Client.QueryTreeAsync(root).ConfigureAwait(false)).Children) { var netWmName = await x11Client.GetStringPropertyAsync(child, windowNameAtom).ConfigureAwait(false); if (netWmName == "ワガママハイスペック") { return(child); } } return(null); }