(num int)
| 1719 | } |
| 1720 | |
| 1721 | func (wm *WindowManager) broadcastWorkspace(num int) { |
| 1722 | // EMWH thing for bars to show workspaces |
| 1723 | data := make([]byte, 4) |
| 1724 | binary.LittleEndian.PutUint32(data, uint32(num)) |
| 1725 | |
| 1726 | netCurrentDesktopAtom, err := xproto.InternAtom(wm.conn, false, uint16(len("_NET_CURRENT_DESKTOP")), "_NET_CURRENT_DESKTOP").Reply() |
| 1727 | |
| 1728 | if err != nil { |
| 1729 | slog.Error("intern _NET_CURRENT_DESKTOP", "error:", err) |
| 1730 | return |
| 1731 | } |
| 1732 | |
| 1733 | cardinalAtom, err := xproto.InternAtom(wm.conn, true, uint16(len("CARDINAL")), "CARDINAL").Reply() |
| 1734 | if err != nil { |
| 1735 | slog.Error("intern CARDINAL", "error:", err) |
| 1736 | return |
| 1737 | } |
| 1738 | fmt.Println(netCurrentDesktopAtom.Atom) |
| 1739 | fmt.Println(cardinalAtom.Atom) |
| 1740 | err = xproto.ChangePropertyChecked( |
| 1741 | wm.conn, |
| 1742 | xproto.PropModeReplace, |
| 1743 | wm.root, |
| 1744 | netCurrentDesktopAtom.Atom, // must not be 0 |
| 1745 | cardinalAtom.Atom, // must not be 0 |
| 1746 | 32, |
| 1747 | 1, |
| 1748 | data, |
| 1749 | ).Check() |
| 1750 | |
| 1751 | if err != nil { |
| 1752 | slog.Error("couldn't set _NET_CURRENT_DESKTOP", "error:", err) |
| 1753 | } |
| 1754 | |
| 1755 | wm.broadcastWorkspaceCount() |
| 1756 | } |
| 1757 | |
| 1758 | func (wm *WindowManager) switchWorkspace(workspace int) { |
| 1759 | if workspace > len(wm.workspaces) { |
no test coverage detected