Hyprland/src/desktop/Workspace.hpp

96 lines
2.6 KiB
C++
Raw Normal View History

2022-03-20 15:55:47 +01:00
#pragma once
#include "../helpers/AnimatedVariable.hpp"
2023-08-07 13:35:19 +02:00
#include <string>
#include "../defines.hpp"
#include "DesktopTypes.hpp"
2024-06-23 15:43:53 +02:00
#include "../helpers/MiscFunctions.hpp"
2022-03-20 15:55:47 +01:00
enum eFullscreenMode : int8_t {
FULLSCREEN_INVALID = -1,
FULLSCREEN_FULL = 0,
FULLSCREEN_MAXIMIZED
};
2022-08-31 17:02:44 +02:00
class CWindow;
class CWorkspace {
public:
static PHLWORKSPACE create(int id, int monitorID, std::string name, bool special = false, bool isEmtpy = true);
// use create() don't use this
CWorkspace(int id, int monitorID, std::string name, bool special = false, bool isEmpty = true);
~CWorkspace();
2022-04-21 16:38:48 +02:00
// Workspaces ID-based have IDs > 0
// and workspaces name-based have IDs starting with -1337
int m_iID = -1;
std::string m_szName = "";
uint64_t m_iMonitorID = -1;
// Previous workspace ID and name is stored during a workspace change, allowing travel
2022-08-21 12:21:21 +02:00
// to the previous workspace.
SWorkspaceIDName m_sPrevWorkspace, m_sPrevWorkspacePerMonitor;
bool m_bHasFullscreenWindow = false;
eFullscreenMode m_efFullscreenMode = FULLSCREEN_FULL;
wl_array m_wlrCoordinateArr;
2022-05-12 11:27:31 +02:00
// for animations
CAnimatedVariable<Vector2D> m_vRenderOffset;
CAnimatedVariable<float> m_fAlpha;
bool m_bForceRendering = false;
2022-05-16 23:13:32 +02:00
2024-04-03 11:09:42 +02:00
// allows damage to propagate.
bool m_bVisible = false;
2022-05-31 14:01:00 +02:00
// "scratchpad"
bool m_bIsSpecialWorkspace = false;
2022-05-31 14:01:00 +02:00
2022-08-31 17:02:44 +02:00
// last window
PHLWINDOWREF m_pLastFocusedWindow;
2022-08-31 17:02:44 +02:00
2022-05-26 19:05:32 +02:00
// user-set
bool m_bDefaultFloating = false;
bool m_bDefaultPseudo = false;
2023-05-03 16:15:56 +02:00
// last monitor (used on reconnect)
std::string m_szLastMonitor = "";
2022-05-26 19:05:32 +02:00
bool m_bWasCreatedEmtpy = true;
bool m_bPersistent = false;
2024-04-05 20:32:05 +02:00
// Inert: destroyed and invalid. If this is true, release the ptr you have.
bool inert();
void startAnim(bool in, bool left, bool instant = false);
void setActive(bool on);
void moveToMonitor(const int&);
2022-09-01 11:46:36 +02:00
PHLWINDOW getLastFocusedWindow();
void rememberPrevWorkspace(const PHLWORKSPACE& prevWorkspace);
std::string getConfigName();
bool matchesStaticSelector(const std::string& selector);
void markInert();
SWorkspaceIDName getPrevWorkspaceIDName(bool perMonitor) const;
private:
void init(PHLWORKSPACE self);
SP<HOOK_CALLBACK_FN> m_pFocusedWindowHook;
bool m_bInert = true;
WP<CWorkspace> m_pSelf;
};
inline bool valid(const PHLWORKSPACE& ref) {
if (!ref)
return false;
return !ref->inert();
}