Hypr/src/bar/Bar.hpp
vaxerski c8c879f103 Added a cairo bar. READ THE COMMIT DESC.
I have had this crash my WM on boot once in a blue moon. This happens rarely and should NOT happen when the WM is already running.
If anyone has a solution, feel free to contribute.
If you want to be 100% safe, use bar_enabled=0 in the config.
2021-11-26 20:20:11 +01:00

43 lines
No EOL
1 KiB
C++

#pragma once
#include <unordered_map>
#include "../defines.hpp"
#include "../utilities/AnimationUtil.hpp"
struct SDrawingContext {
xcb_gcontext_t GContext;
xcb_font_t Font;
};
class CStatusBar {
public:
EXPOSED_MEMBER(WindowID, xcb_window_t, i);
EXPOSED_MEMBER(MonitorID, int, i);
EXPOSED_MEMBER(StatusCommand, std::string, sz); // TODO: make the bar better
void draw();
void setup(int MonitorID);
void destroy();
std::vector<int> openWorkspaces;
EXPOSED_MEMBER(CurrentWorkspace, int, i);
private:
Vector2D m_vecSize;
Vector2D m_vecPosition;
xcb_pixmap_t m_iPixmap;
// Cairo
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
void drawText(Vector2D, std::string, uint32_t);
int getTextWidth(std::string);
std::unordered_map<std::string, SDrawingContext> m_mContexts;
};