mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-03 21:51:55 -07:00
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'
This commit is contained in:
committed by
GitHub
parent
c3f1dc3f52
commit
6381b6474f
@@ -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;
|
||||
};
|
||||
friend struct SMasterWorkspaceData;
|
||||
};
|
||||
|
Reference in New Issue
Block a user