Initial implementation of active window

TODO:
- Sometimes the active event arrives before the create, in which case the window is not activated.
- The window title event also looks unreliable in some cases, will need to investigate
This commit is contained in:
Pol Rivero
2025-05-01 20:22:18 +02:00
parent 59c270ec06
commit 72404a77f0
6 changed files with 57 additions and 5 deletions

View File

@ -31,9 +31,11 @@ struct WindowRepr {
std::string window_class;
std::string window_title;
std::string repr_rewrite;
bool isActive = false;
public:
bool empty() const { return address.empty(); }
void setActive(bool value) { isActive = value; }
};
class WindowCreationPayload {
@ -48,6 +50,7 @@ class WindowCreationPayload {
bool isEmpty(Workspaces& workspace_manager);
bool reprIsReady() const { return std::holds_alternative<Repr>(m_window); }
WindowRepr repr(Workspaces& workspace_manager);
void setActive(bool value) { m_isActive = value; }
std::string getWorkspaceName() const { return m_workspaceName; }
WindowAddress getAddress() const { return m_windowAddress; }
@ -64,6 +67,7 @@ class WindowCreationPayload {
WindowAddress m_windowAddress;
std::string m_workspaceName;
bool m_isActive = false;
int m_timeSpentUncreated = 0;
};