2023-01-13 15:13:56 +00:00
|
|
|
#pragma once
|
|
|
|
#include "Common.h"
|
|
|
|
#include "System.h"
|
2023-01-30 15:57:15 +00:00
|
|
|
#include "Config.h"
|
2023-01-13 15:13:56 +00:00
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2023-03-03 19:44:51 +00:00
|
|
|
#ifdef WITH_WORKSPACES
|
|
|
|
namespace Workspaces
|
2023-01-13 15:13:56 +00:00
|
|
|
{
|
2023-03-03 19:44:51 +00:00
|
|
|
void Init();
|
|
|
|
|
|
|
|
void PollStatus(uint32_t monitorID, uint32_t numWorkspaces);
|
|
|
|
|
|
|
|
System::WorkspaceStatus GetStatus(uint32_t workspaceId);
|
|
|
|
|
|
|
|
void Shutdown();
|
|
|
|
|
2023-03-10 23:24:50 +00:00
|
|
|
// TODO: Use ext_workspaces for this, if applicable
|
2023-01-13 15:13:56 +00:00
|
|
|
inline void Goto(uint32_t workspace)
|
|
|
|
{
|
2023-03-03 19:44:51 +00:00
|
|
|
if (RuntimeConfig::Get().hasWorkspaces == false)
|
2023-01-30 15:57:15 +00:00
|
|
|
{
|
2023-03-03 19:44:51 +00:00
|
|
|
LOG("Error: Called Go to workspace, but Workspaces isn't open!");
|
2023-01-30 15:57:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2023-06-14 22:23:02 +00:00
|
|
|
LOG("Switching workspace: hyprctl dispatch workspace " << workspace);
|
2023-01-13 15:13:56 +00:00
|
|
|
system(("hyprctl dispatch workspace " + std::to_string(workspace)).c_str());
|
|
|
|
}
|
2023-02-12 13:57:32 +00:00
|
|
|
|
|
|
|
// direction: + or -
|
|
|
|
inline void GotoNext(char direction)
|
|
|
|
{
|
|
|
|
char scrollOp = 'e';
|
|
|
|
if (Config::Get().workspaceScrollOnMonitor)
|
|
|
|
{
|
|
|
|
scrollOp = 'm';
|
|
|
|
}
|
|
|
|
std::string cmd = std::string("hyprctl dispatch workspace ") + scrollOp + direction + "1";
|
2023-06-14 22:23:02 +00:00
|
|
|
LOG("Switching workspace: " << cmd.c_str());
|
2023-02-12 13:57:32 +00:00
|
|
|
system(cmd.c_str());
|
|
|
|
}
|
2023-01-13 15:13:56 +00:00
|
|
|
}
|
|
|
|
#endif
|