aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/helpers/Workspace.hpp
blob: 07b5694c86edacb42d8302b6da38e27487451194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once

#include "AnimatedVariable.hpp"
#include <string>
#include "../defines.hpp"

enum eFullscreenMode : uint8_t
{
    FULLSCREEN_FULL = 0,
    FULLSCREEN_MAXIMIZED
};

class CWindow;

class CWorkspace {
  public:
    CWorkspace(int monitorID, std::string name, bool special = false);
    ~CWorkspace();

    // 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 is stored during a workspace change, allowing travel
    // to the previous workspace.
    struct SPrevWorkspaceData {
        int         iID  = -1;
        std::string name = "";
    } m_sPrevWorkspace;

    bool            m_bHasFullscreenWindow = false;
    eFullscreenMode m_efFullscreenMode     = FULLSCREEN_FULL;

    wl_array        m_wlrCoordinateArr;

    // for animations
    CAnimatedVariable m_vRenderOffset;
    CAnimatedVariable m_fAlpha;
    bool              m_bForceRendering = false;

    // "scratchpad"
    bool m_bIsSpecialWorkspace = false;

    // last window
    CWindow* m_pLastFocusedWindow = nullptr;

    // user-set
    bool m_bDefaultFloating = false;
    bool m_bDefaultPseudo   = false;

    // don't destroy in sanity check
    bool m_bIndestructible = false;

    // last monitor (used on reconnect)
    std::string m_szLastMonitor = "";

    void        startAnim(bool in, bool left, bool instant = false);
    void        setActive(bool on);

    void        moveToMonitor(const int&);

    CWindow*    getLastFocusedWindow();
    void        rememberPrevWorkspace(const CWorkspace* prevWorkspace);

    std::string getConfigName();
};