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

Method setNetWorkArea

wm/window_manager.go:1896–1938  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1894}
1895
1896func (wm *WindowManager) setNetWorkArea() {
1897 atomWorkArea, err := xproto.InternAtom(wm.conn, true, uint16(len("_NET_WORKAREA")), "_NET_WORKAREA").Reply()
1898 if err != nil {
1899 // handle error properly here
1900 return
1901 }
1902
1903 buf := new(bytes.Buffer)
1904
1905 spaceX, spaceY, spaceWidth, spaceHeight := wm.tilingspace.X, wm.tilingspace.Y, wm.tilingspace.Width, wm.tilingspace.Height
1906
1907 for _, wksp := range wm.workspaces {
1908 if !wksp.tiling {
1909 _ = binary.Write(buf, binary.LittleEndian, uint32(0))
1910 _ = binary.Write(buf, binary.LittleEndian, uint32(0))
1911 _ = binary.Write(buf, binary.LittleEndian, uint32(wm.width))
1912 _ = binary.Write(buf, binary.LittleEndian, uint32(wm.height))
1913 } else {
1914 _ = binary.Write(buf, binary.LittleEndian, uint32(spaceX))
1915 _ = binary.Write(buf, binary.LittleEndian, uint32(spaceY))
1916 _ = binary.Write(buf, binary.LittleEndian, uint32(spaceWidth))
1917 _ = binary.Write(buf, binary.LittleEndian, uint32(spaceHeight))
1918 }
1919 }
1920
1921 // Number of 32-bit CARDINAL values: 4 values per workspace
1922 numValues := uint32(4 * len(wm.workspaces))
1923
1924 err = xproto.ChangePropertyChecked(
1925 wm.conn,
1926 xproto.PropModeReplace,
1927 wm.root,
1928 atomWorkArea.Atom,
1929 xproto.AtomCardinal,
1930 32,
1931 numValues,
1932 buf.Bytes(),
1933 ).Check()
1934
1935 if err != nil {
1936 slog.Error("couldn't set the work area", "error:", err)
1937 }
1938}
1939
1940func (wm *WindowManager) setNetClientList() {
1941 atomClientList, _ := xproto.InternAtom(wm.conn, true, uint16(len("_NET_CLIENT_LIST")), "_NET_CLIENT_LIST").Reply()

Callers 2

disableTilingMethod · 0.95
enableTilingMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected