YggdrasilWM  0.1.1
A tiny window manager coded in C++
Group.hpp
Go to the documentation of this file.
1 
29 #ifndef YGGDRASILWM_GROUP_H
30 #define YGGDRASILWM_GROUP_H
31 #include <unordered_map>
32 #include <string>
33 extern "C" {
34 #include <X11/Xlib.h>
35 }
37 class LayoutManager;
38 class Client;
39 class WindowManager;
40 class BaseX11Wrapper;
46 enum LayoutType {
48  MAX,
51  FLOAT
52 };
60 class Group : public std::enable_shared_from_this<Group>{
61 public:
72  explicit Group(const std::shared_ptr<ConfigDataGroup > &config,
73  std::shared_ptr<BaseX11Wrapper> x11Wrapper,
74  Display *display,
75  Window root);
80  ~Group();
87  void addClient(Window window, std::shared_ptr<Client> client);
93  void removeClient(Window window);
99  void removeClient(Client *client);
106  void moveClientToGroup(Window window, Group *group);
112  void setActive(bool active);
118  bool isActive() const;
124  void setName(std::string name);
130  std::string getName();
136  std::shared_ptr<Client> getClient(Window window);
141  std::unordered_map<Window, std::shared_ptr<Client>> getClients();
146  std::shared_ptr<LayoutManager> getLayoutManager();
152  void switchTo();
158  void switchFrom();
164  int getBorderSize() const;
170  int getGap() const;
176  unsigned long getInactiveColor() const;
182  unsigned long getActiveColor() const;
183  void resize (unsigned int sizeX, unsigned int sizeY, unsigned int posX, unsigned int posY);
184 
185 private:
186  std::string name_;
187  std::unordered_map<Window, std::shared_ptr<Client>> clients_;
188  std::shared_ptr<LayoutManager> layoutManager_;
190  int gap_;
191  unsigned long inactiveColor_;
192  unsigned long activeColor_;
194  bool active_{};
195  std::shared_ptr<BaseX11Wrapper> wrapper;
196 };
197 #endif //YGGDRASILWM_GROUP_H
ConfigDataGroup class header.
LayoutType
LayoutType enum This enum is used to define the different layout managers.
Definition: Group.hpp:46
@ MASTER_HORIZONTAL
Definition: Group.hpp:50
@ MASTER_VERTICAL
Definition: Group.hpp:49
@ TREE
Definition: Group.hpp:47
@ FLOAT
Definition: Group.hpp:51
@ MAX
Definition: Group.hpp:48
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
std::string name_
Definition: Group.hpp:186
std::string getName()
Get the name of the group.
Definition: Group.cpp:163
std::unordered_map< Window, std::shared_ptr< Client > > clients_
Definition: Group.hpp:187
int getGap() const
Get the gap of the group.
Definition: Group.cpp:168
std::shared_ptr< LayoutManager > getLayoutManager()
Get the layout manager of the group.
Definition: Group.cpp:166
void setName(std::string name)
Set the name of the group.
Definition: Group.cpp:159
void setActive(bool active)
Set the group as active.
Definition: Group.cpp:129
std::shared_ptr< LayoutManager > layoutManager_
Definition: Group.hpp:188
void moveClientToGroup(Window window, Group *group)
Move a client to another group.
Definition: Group.cpp:130
unsigned long getActiveColor() const
Get the active color of the group.
Definition: Group.cpp:170
int gap_
Definition: Group.hpp:190
void switchTo()
Switch to this group Set this group as active, switch the layout manager and map the clients.
Definition: Group.cpp:139
void resize(unsigned int sizeX, unsigned int sizeY, unsigned int posX, unsigned int posY)
Definition: Group.cpp:172
Group(const std::shared_ptr< ConfigDataGroup > &config, std::shared_ptr< BaseX11Wrapper > x11Wrapper, Display *display, Window root)
Group constructor.
Definition: Group.cpp:35
int getBorderSize() const
Get the border size of the group.
Definition: Group.cpp:167
unsigned long inactiveColor_
Definition: Group.hpp:191
bool active_
Definition: Group.hpp:194
std::shared_ptr< Client > getClient(Window window)
Get a client from the group.
Definition: Group.cpp:164
bool isActive() const
Check if the group is active.
Definition: Group.cpp:162
void addClient(Window window, std::shared_ptr< Client > client)
Add a client to the group.
Definition: Group.cpp:112
int borderSize_
Definition: Group.hpp:189
std::unordered_map< Window, std::shared_ptr< Client > > getClients()
Get the list of clients of the group.
Definition: Group.cpp:165
unsigned long activeColor_
Definition: Group.hpp:192
int barHeight_
Definition: Group.hpp:193
void switchFrom()
Switch from this group Set this group as inactive, switch the layout manager and unmap the clients.
Definition: Group.cpp:149
void removeClient(Window window)
Definitely remove a client from the group.
Definition: Group.cpp:116
unsigned long getInactiveColor() const
Get the inactive color of the group.
Definition: Group.cpp:169
std::shared_ptr< BaseX11Wrapper > wrapper
Definition: Group.hpp:195
~Group()
Group destructor.
Definition: Group.cpp:111
LayoutManager class Interface for the layout managers.
Definition: LayoutManager.hpp:42
WindowManager class This class is responsible for managing the windows.in an X11 session....
Definition: WindowManager.hpp:59