aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/layout/MasterLayout.hpp
diff options
context:
space:
mode:
authorMaarten van Gompel <[email protected]>2022-12-10 22:59:16 +0100
committerGitHub <[email protected]>2022-12-10 21:59:16 +0000
commit6381b6474fb6973bfe83526e21bcee08e5e45ecc (patch)
treee43a0f87823fceaf7e459699798c7fe9c3dc0547 /src/layout/MasterLayout.hpp
parentc3f1dc3f526a7f94c37d72f8314bc4bce969f0d8 (diff)
downloadHyprland-6381b6474fb6973bfe83526e21bcee08e5e45ecc.tar.gz
Hyprland-6381b6474fb6973bfe83526e21bcee08e5e45ecc.zip
Implement orientation (placement of master area) for master layout (#1202)
* Implemented choosing placement of master area (#1059) This implement a per workspace 'orientation' that can be set to left, right, top or bottom. Reflecting placement of the master area. Left (default) and right are horizontal layouts, top and bottom produce vertical layouts. Orientation can be switched with: 'hyprctl dispatch layoutmsg orientationleft'
Diffstat (limited to 'src/layout/MasterLayout.hpp')
-rw-r--r--src/layout/MasterLayout.hpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/layout/MasterLayout.hpp b/src/layout/MasterLayout.hpp
index 3e1744df..b7761cef 100644
--- a/src/layout/MasterLayout.hpp
+++ b/src/layout/MasterLayout.hpp
@@ -1,11 +1,20 @@
#pragma once
#include "IHyprLayout.hpp"
+#include <vector>
#include <list>
#include <deque>
enum eFullscreenMode : uint8_t;
+//orientation determines which side of the screen the master area resides
+enum eOrientation : uint8_t {
+ ORIENTATION_LEFT = 0,
+ ORIENTATION_TOP,
+ ORIENTATION_RIGHT,
+ ORIENTATION_BOTTOM
+};
+
struct SMasterNodeData {
bool isMaster = false;
float percMaster = 0.5f;
@@ -24,6 +33,15 @@ struct SMasterNodeData {
}
};
+struct SMasterWorkspaceData {
+ int workspaceID = -1;
+ eOrientation orientation = ORIENTATION_LEFT;
+
+ bool operator==(const SMasterWorkspaceData& rhs) {
+ return workspaceID == rhs.workspaceID;
+ }
+};
+
class CHyprMasterLayout : public IHyprLayout {
public:
virtual void onWindowCreatedTiling(CWindow*);
@@ -44,7 +62,8 @@ public:
private:
- std::list<SMasterNodeData> m_lMasterNodesData;
+ std::list<SMasterNodeData> m_lMasterNodesData;
+ std::vector<SMasterWorkspaceData> m_lMasterWorkspacesData;
bool m_bForceWarps = false;
@@ -52,9 +71,11 @@ private:
void applyNodeDataToWindow(SMasterNodeData*);
SMasterNodeData* getNodeFromWindow(CWindow*);
SMasterNodeData* getMasterNodeOnWorkspace(const int&);
+ SMasterWorkspaceData* getMasterWorkspaceData(const int&);
void calculateWorkspace(const int&);
CWindow* getNextWindow(CWindow*, bool);
int getMastersOnWorkspace(const int&);
friend struct SMasterNodeData;
-}; \ No newline at end of file
+ friend struct SMasterWorkspaceData;
+};