28 #ifndef WINDOW_MANAGER_HPP
29 #define WINDOW_MANAGER_HPP
35 #include <unordered_map>
67 static void create(std::shared_ptr<BaseX11Wrapper> wrapper,
const std::string &displayStr = std::string());
101 std::unordered_map<Window, std::shared_ptr<Client>> &
getClients();
108 std::shared_ptr<Client>
getClient(Window window);
150 const std::vector<std::shared_ptr<Group>> &
getGroups()
const;
221 const std::shared_ptr<BaseX11Wrapper> &
getX11Wrapper()
const;
233 std::unordered_map<Window, std::shared_ptr<Client>>
clients_;
243 WindowManager(Display *display,
const std::shared_ptr<BaseX11Wrapper>& wrapper);
259 static int OnXError(Display *display, XErrorEvent *e);
267 static int onWmDetected([[maybe_unused]] Display *display, XErrorEvent *e);
This class is responsible for managing the client windows.
ConfigHandler class header.
void handleSIGHUP(int signal)
Definition: WindowManager.cpp:219
Definition: baseX11Wrapper.hpp:37
The Client class is responsible for managing the client windows. It creates a frame around the client...
Definition: Client.hpp:47
Groups are defined in the config file. Each group use a specific layout manager and manage it's list ...
Definition: Group.hpp:60
Definition: TSBarsData.hpp:32
WindowManager class This class is responsible for managing the windows.in an X11 session....
Definition: WindowManager.hpp:59
static void create(std::shared_ptr< BaseX11Wrapper > wrapper, const std::string &displayStr=std::string())
create a WindowManager object
Definition: WindowManager.cpp:45
void init()
Initialize the WindowManager set the event select mask on the root window creates clients for the exi...
Definition: WindowManager.cpp:76
Display * getDisplay() const
Get the Display object.
Definition: WindowManager.cpp:263
unsigned int getGeometryY() const
Get the Geometry Y.
Definition: WindowManager.cpp:282
unsigned long getClientCount()
Get the number of clients.
Definition: WindowManager.cpp:267
~WindowManager()
Destroy the WindowManager object i have yet to find a clean way to close the window manager.
Definition: WindowManager.cpp:71
const Atom WM_DELETE_WINDOW
Definition: WindowManager.hpp:229
static WindowManager * instance_
Definition: WindowManager.hpp:234
WindowManager(const WindowManager &)=delete
void createBars()
create the bars Bars are created from the config file and handled in a separate thread
Definition: WindowManager.cpp:140
Window activeWindow
Definition: WindowManager.hpp:236
void Run()
Run the window manager.
Definition: WindowManager.cpp:170
const Window root_
Definition: WindowManager.hpp:225
static bool wmDetected
Definition: WindowManager.hpp:224
unsigned int geometryY
Definition: WindowManager.hpp:231
std::unordered_map< Window, std::shared_ptr< Client > > & getClients()
Get the Clients map.
Definition: WindowManager.cpp:264
std::shared_ptr< Client > getClientRef(Window window)
Get a ref to the Client by window ptr does not look for frames and throws if not found.
Definition: WindowManager.cpp:265
const Atom WM_PROTOCOLS
Definition: WindowManager.hpp:228
std::shared_ptr< Client > getClient(Window window)
Get the Client by window ptr or frame ptr.
Definition: WindowManager.cpp:251
Window getRoot() const
Get the Root Window pointer.
Definition: WindowManager.cpp:266
void selectEventOnRoot() const
set the event mask on the root window and register as the window manager for the X session
Definition: WindowManager.cpp:96
void setFocus(Client *client)
Set the focus to a client.
Definition: WindowManager.cpp:208
void setActiveWindow(Window activeWindow)
set the Active Window
Definition: WindowManager.cpp:285
std::shared_ptr< Group > getActiveGroup() const
get the current Active Group
Definition: WindowManager.cpp:272
void getTopLevelWindows()
look for existing top level windows and create clients for them
Definition: WindowManager.cpp:105
static WindowManager * getInstance()
Get the WindowManager instance this is a singleton class this function returns the instance of the Wi...
Definition: WindowManager.cpp:244
void setActiveGroup(std::shared_ptr< Group > activeGroup)
Definition: WindowManager.cpp:268
std::shared_ptr< TSBarsData > tsData
Definition: WindowManager.hpp:235
static int onWmDetected([[maybe_unused]] Display *display, XErrorEvent *e)
When selecting events on the root window, we may get a BadAccess error if another window manager is r...
Definition: WindowManager.cpp:300
unsigned int geometryX
Definition: WindowManager.hpp:230
WindowManager & operator=(const WindowManager &)=delete
void testRun()
test function this function is used for testing purposes it is not used in the normal operation of th...
Definition: WindowManager.cpp:183
std::unordered_map< Window, std::shared_ptr< Client > > clients_
Definition: WindowManager.hpp:233
void insertClient(Window window)
Insert a client in the clients map.
Definition: WindowManager.cpp:195
std::weak_ptr< Group > active_group_
Definition: WindowManager.hpp:227
std::vector< std::shared_ptr< Group > > groups_
Definition: WindowManager.hpp:226
const std::shared_ptr< BaseX11Wrapper > & getX11Wrapper() const
get the X11 Wrapper object
Definition: WindowManager.cpp:284
Window getActiveWindow() const
Get the Active Window.
Definition: WindowManager.cpp:283
void Stop()
Stop the window manager.
Definition: WindowManager.cpp:225
bool running
Definition: WindowManager.hpp:232
std::shared_ptr< BaseX11Wrapper > x11Wrapper
Definition: WindowManager.hpp:237
static void Destroy()
Destroy the WindowManager instance this function destroys the WindowManager instance and sets the ins...
Definition: WindowManager.cpp:213
unsigned int getGeometryX() const
Get the Geometry X this function returns the width of the screen.
Definition: WindowManager.cpp:281
static int OnXError(Display *display, XErrorEvent *e)
X11 Error handler.
Definition: WindowManager.cpp:286
Display * display_
Definition: WindowManager.hpp:223
void addGroupsFromConfig()
add groups configured in the ConfigDataGroups to the groups vector
Definition: WindowManager.cpp:153
bool getRunning() const
Get the Running status.
Definition: WindowManager.cpp:280
const std::vector< std::shared_ptr< Group > > & getGroups() const
Get the Groups vector this function returns the groups vector the groups vector contains all the grou...
Definition: WindowManager.cpp:279