Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyprland/workspaces: use Hyprland's workspace rules for persistency #2603

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions include/modules/hyprland/workspaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ class Workspace {
int id() const { return m_id; };
std::string name() const { return m_name; };
std::string output() const { return m_output; };
bool isActive() const { return m_active; };
bool isActive() const { return m_isActive; };
bool isSpecial() const { return m_isSpecial; };
bool isPersistent() const { return m_isPersistent; };
bool isVisible() const { return m_isVisible; };
bool isEmpty() const { return m_windows == 0; };
bool isUrgent() const { return m_isUrgent; };

bool handleClicked(GdkEventButton* bt) const;
void setActive(bool value = true) { m_active = value; };
void setActive(bool value = true) { m_isActive = value; };
void setPersistent(bool value = true) { m_isPersistent = value; };
void setUrgent(bool value = true) { m_isUrgent = value; };
void setVisible(bool value = true) { m_isVisible = value; };
Expand All @@ -99,7 +99,7 @@ class Workspace {
std::string m_name;
std::string m_output;
uint m_windows;
bool m_active = false;
bool m_isActive = false;
bool m_isSpecial = false;
bool m_isPersistent = false;
bool m_isUrgent = false;
Expand Down Expand Up @@ -135,8 +135,8 @@ class Workspaces : public AModule, public EventHandler {
void onEvent(const std::string& e) override;
void updateWindowCount();
void sortWorkspaces();
void createWorkspace(Json::Value const& workspace_data,
Json::Value const& clients_data = Json::Value::nullRef);
void createWorkspace(Json::Value const& workspaceData,
Json::Value const& clientsData = Json::Value::nullRef);
void removeWorkspace(std::string const& name);
void setUrgentWorkspace(std::string const& windowaddress);
void parseConfig(const Json::Value& config);
Expand All @@ -160,16 +160,24 @@ class Workspaces : public AModule, public EventHandler {

void onWindowTitleEvent(std::string const& payload);

void onConfigReloaded();

int windowRewritePriorityFunction(std::string const& window_rule);

void doUpdate();

void extendOrphans(int workspaceId, Json::Value const& clientsJson);
void registerOrphanWindow(WindowCreationPayload create_window_paylod);
void registerOrphanWindow(WindowCreationPayload create_window_payload);

void initializeWorkspaces();
void setCurrentMonitorId();
void loadPersistentWorkspacesFromConfig(Json::Value const& clientsJson);
void loadPersistentWorkspacesFromWorkspaceRules(const Json::Value& clientsJson);

bool m_allOutputs = false;
bool m_showSpecial = false;
bool m_activeOnly = false;
Json::Value m_persistentWorkspaceConfig;

// Map for windows stored in workspaces not present in the current bar.
// This happens when the user has multiple monitors (hence, multiple bars)
Expand All @@ -184,11 +192,6 @@ class Workspaces : public AModule, public EventHandler {
{"NUMBER", SortMethod::NUMBER},
{"DEFAULT", SortMethod::DEFAULT}};

void fillPersistentWorkspaces();
void createPersistentWorkspaces();
std::vector<std::string> m_persistentWorkspacesToCreate;
bool m_persistentCreated = false;

std::string m_format;

std::map<std::string, std::string> m_iconsMap;
Expand Down
Loading
Loading