MCPcopy Create free account
hub / github.com/BobdaProgrammer/doWM / shouldIgnoreWindow

Function shouldIgnoreWindow

wm/window_manager.go:2088–2153  ·  view source on GitHub ↗
(conn *xgb.Conn, win xproto.Window)

Source from the content-addressed store, hash-verified

2086}
2087
2088func shouldIgnoreWindow(conn *xgb.Conn, win xproto.Window) bool {
2089 // some windows don't want to be registered by the WM so we check that
2090
2091 // Intern the _NET_WM_WINDOW_TYPE atom
2092 typeAtom, err := xproto.InternAtom(conn, false, uint16(len("_NET_WM_WINDOW_TYPE")), "_NET_WM_WINDOW_TYPE").Reply()
2093 if err != nil {
2094 slog.Error("Error getting _NET_WM_WINDOW_TYPE atom", "error", err)
2095 return false
2096 }
2097
2098 // Get the _NET_WM_WINDOW_TYPE property for the window
2099 actualType, err := xproto.GetProperty(conn, false, win, typeAtom.Atom, xproto.AtomAtom, 0, 1).Reply()
2100 if err != nil {
2101 slog.Error("Error getting _NET_WM_WINDOW_TYPE property", "error", err)
2102 return false
2103 }
2104
2105 if len(actualType.Value) == 0 {
2106 return false
2107 }
2108
2109 // Check if the window has the _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NOTIFICATION, or _NET_WM_WINDOW_TYPE_DOCK
2110 netWmSplash, err := xproto.InternAtom(conn, false, uint16(len("_NET_WM_WINDOW_TYPE_SPLASH")), "_NET_WM_WINDOW_TYPE_SPLASH").Reply()
2111 if err != nil {
2112 slog.Error("Error getting _NET_WM_WINDOW_TYPE_SPLASH atom", "error", err)
2113 return false
2114 }
2115 netWmPanel, err := xproto.InternAtom(conn, false, uint16(len("_NET_WM_WINDOW_TYPE_PANEL")), "_NET_WM_WINDOW_TYPE_PANEL").Reply()
2116 if err != nil {
2117 slog.Error("Error getting _NET_WM_WINDOW_TYPE_PANEL atom", "error", err)
2118 return false
2119 }
2120
2121 netWmTooltip, err := xproto.InternAtom(conn, false, uint16(len("_NET_WM_WINDOW_TYPE_TOOLTIP")), "_NET_WM_WINDOW_TYPE_TOOLTIP").Reply()
2122 if err != nil {
2123 slog.Error("Error getting _NET_WM_WINDOW_TYPE_PANEL atom", "error", err)
2124 return false
2125 }
2126
2127 netWmDialog, err := xproto.InternAtom(conn, false, uint16(len("_NET_WM_WINDOW_TYPE_DIALOG")), "_NET_WM_WINDOW_TYPE_DIALOG").Reply()
2128 if err != nil {
2129 slog.Error("Error getting _NET_WM_WINDOW_TYPE_DIALOG atom", "error", err)
2130 return false
2131 }
2132
2133 netWmNotification, err := xproto.InternAtom(conn, false, uint16(len("_NET_WM_WINDOW_TYPE_NOTIFICATION")), "_NET_WM_WINDOW_TYPE_NOTIFICATION").Reply()
2134 if err != nil {
2135 slog.Error("Error getting _NET_WM_WINDOW_TYPE_NOTIFICATION atom", "error", err)
2136 return false
2137 }
2138
2139 netWmDock, err := xproto.InternAtom(conn, false, uint16(len("_NET_WM_WINDOW_TYPE_DOCK")), "_NET_WM_WINDOW_TYPE_DOCK").Reply()
2140 if err != nil {
2141 slog.Error("Error getting _NET_WM_WINDOW_TYPE_DOCK atom", "error", err)
2142 return false
2143 }
2144
2145 // Check if the window type matches any of the "ignore" types

Callers 2

RunMethod · 0.85
OnMapRequestMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected