Controlling tiled/floating mode works

This commit is contained in:
2025-06-10 14:55:42 +02:00
parent b24c9bac2d
commit 9a4619b1ba
3 changed files with 63 additions and 0 deletions

View File

@@ -32,3 +32,30 @@ std::list<Client> HyprlandService::getClients() {
json j = json::parse(exec("/usr/bin/hyprctl clients -j"));
return j.get<std::list<Client>>();
};
std::list<Client> HyprlandService::getClientsOnActiveWorkspace() {
std::list<Client> clients = HyprlandService::getClients();
int activeWorkspaceID = HyprlandService::getCurrentWorkspace().id;
for (auto it = clients.begin(); it != clients.end(); ) {
if (it->workspace.id != activeWorkspaceID) {
it = clients.erase(it);
} else {
++it;
}
}
return clients;
};
void HyprlandService::setClientFloating(Client& c) {
exec("/usr/bin/hyprctl dispatch setfloating address:" + c.address);
};
void HyprlandService::setClientTiled(Client& c) {
exec("/usr/bin/hyprctl dispatch settiled address:" + c.address);
}
void HyprlandService::toggleClientFloating(Client& c) {
exec("/usr/bin/hyprctl dispatch togglefloating address:" + c.address);
};