2023-04-12 01:33:00 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class Hy3Layout;
|
|
|
|
|
2023-07-19 03:53:23 -07:00
|
|
|
enum class GroupEphemeralityOption {
|
|
|
|
Ephemeral,
|
|
|
|
Standard,
|
|
|
|
ForceEphemeral,
|
|
|
|
};
|
|
|
|
|
2023-06-28 21:36:08 -07:00
|
|
|
#include <list>
|
2023-04-12 01:33:00 -07:00
|
|
|
|
2023-06-28 21:36:08 -07:00
|
|
|
#include <hyprland/src/layout/IHyprLayout.hpp>
|
|
|
|
|
|
|
|
#include "Hy3Node.hpp"
|
|
|
|
#include "TabGroup.hpp"
|
2023-06-28 18:11:48 -07:00
|
|
|
|
2023-04-13 14:12:48 -07:00
|
|
|
enum class ShiftDirection {
|
|
|
|
Left,
|
|
|
|
Up,
|
|
|
|
Down,
|
|
|
|
Right,
|
|
|
|
};
|
|
|
|
|
2023-06-11 22:19:43 -07:00
|
|
|
enum class FocusShift {
|
|
|
|
Top,
|
|
|
|
Bottom,
|
|
|
|
Raise,
|
|
|
|
Lower,
|
|
|
|
Tab,
|
|
|
|
TabNode,
|
|
|
|
};
|
|
|
|
|
2023-06-15 00:27:02 -07:00
|
|
|
enum class TabFocus {
|
|
|
|
MouseLocation,
|
|
|
|
Left,
|
|
|
|
Right,
|
2023-06-28 12:58:31 -07:00
|
|
|
Index,
|
2023-06-15 00:27:02 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class TabFocusMousePriority {
|
|
|
|
Ignore,
|
|
|
|
Prioritize,
|
|
|
|
Require,
|
|
|
|
};
|
|
|
|
|
2023-07-20 03:54:13 -07:00
|
|
|
enum class SetSwallowOption {
|
|
|
|
NoSwallow,
|
|
|
|
Swallow,
|
|
|
|
Toggle,
|
|
|
|
};
|
|
|
|
|
2023-04-12 01:33:00 -07:00
|
|
|
class Hy3Layout: public IHyprLayout {
|
|
|
|
public:
|
2023-07-20 03:54:13 -07:00
|
|
|
virtual void onWindowCreated(CWindow*);
|
2023-04-12 01:33:00 -07:00
|
|
|
virtual void onWindowCreatedTiling(CWindow*);
|
|
|
|
virtual void onWindowRemovedTiling(CWindow*);
|
2023-04-12 03:33:45 -07:00
|
|
|
virtual void onWindowFocusChange(CWindow*);
|
2023-04-12 01:33:00 -07:00
|
|
|
virtual bool isWindowTiled(CWindow*);
|
2023-06-28 16:24:10 -07:00
|
|
|
virtual void recalculateMonitor(const int& monitor_id);
|
2023-04-12 01:33:00 -07:00
|
|
|
virtual void recalculateWindow(CWindow*);
|
2023-07-13 12:54:47 -07:00
|
|
|
virtual void
|
|
|
|
resizeActiveWindow(const Vector2D& delta, eRectCorner corner, CWindow* pWindow = nullptr);
|
2023-06-28 16:24:10 -07:00
|
|
|
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool enable_fullscreen);
|
|
|
|
virtual std::any layoutMessage(SLayoutMessageHeader header, std::string content);
|
2023-04-12 01:33:00 -07:00
|
|
|
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
|
|
|
|
virtual void switchWindows(CWindow*, CWindow*);
|
|
|
|
virtual void alterSplitRatio(CWindow*, float, bool);
|
|
|
|
virtual std::string getLayoutName();
|
2023-04-16 23:53:22 -07:00
|
|
|
virtual CWindow* getNextWindowCandidate(CWindow*);
|
2023-06-28 16:24:10 -07:00
|
|
|
virtual void replaceWindowDataWith(CWindow* from, CWindow* to);
|
2023-07-19 04:05:23 -07:00
|
|
|
virtual void requestFocusForWindow(CWindow*);
|
2023-04-12 01:33:00 -07:00
|
|
|
|
|
|
|
virtual void onEnable();
|
|
|
|
virtual void onDisable();
|
|
|
|
|
2023-07-19 03:53:23 -07:00
|
|
|
void makeGroupOnWorkspace(int workspace, Hy3GroupLayout, GroupEphemeralityOption);
|
|
|
|
void makeOppositeGroupOnWorkspace(int workspace, GroupEphemeralityOption);
|
|
|
|
void makeGroupOn(Hy3Node*, Hy3GroupLayout, GroupEphemeralityOption);
|
|
|
|
void makeOppositeGroupOn(Hy3Node*, GroupEphemeralityOption);
|
2023-06-28 16:24:10 -07:00
|
|
|
void shiftWindow(int workspace, ShiftDirection, bool once);
|
|
|
|
void shiftFocus(int workspace, ShiftDirection, bool visible);
|
|
|
|
void changeFocus(int workspace, FocusShift);
|
|
|
|
void focusTab(int workspace, TabFocus target, TabFocusMousePriority, bool wrap_scroll, int index);
|
2023-07-20 03:54:13 -07:00
|
|
|
void setNodeSwallow(int workspace, SetSwallowOption);
|
2023-06-28 16:24:10 -07:00
|
|
|
void killFocusedNode(int workspace);
|
2023-04-26 00:57:24 -07:00
|
|
|
|
|
|
|
bool shouldRenderSelected(CWindow*);
|
2023-04-13 14:12:48 -07:00
|
|
|
|
2023-06-28 16:24:10 -07:00
|
|
|
Hy3Node* getWorkspaceRootGroup(const int& workspace);
|
2023-07-31 20:38:58 -07:00
|
|
|
Hy3Node* getWorkspaceFocusedNode(const int& workspace, bool ignore_group_focus = false);
|
2023-04-19 01:58:22 -07:00
|
|
|
|
2023-05-16 03:02:26 -07:00
|
|
|
static void renderHook(void*, std::any);
|
2023-06-09 01:19:13 -07:00
|
|
|
static void windowGroupUrgentHook(void*, std::any);
|
|
|
|
static void windowGroupUpdateRecursiveHook(void*, std::any);
|
2023-05-30 23:23:46 -07:00
|
|
|
static void tickHook(void*, std::any);
|
2023-05-16 03:02:26 -07:00
|
|
|
|
2023-04-12 01:33:00 -07:00
|
|
|
std::list<Hy3Node> nodes;
|
2023-05-28 23:19:35 -07:00
|
|
|
std::list<Hy3TabGroup> tab_groups;
|
2023-06-07 03:22:17 -07:00
|
|
|
|
2023-04-16 21:56:19 -07:00
|
|
|
private:
|
2023-04-12 01:33:00 -07:00
|
|
|
Hy3Node* getNodeFromWindow(CWindow*);
|
2023-06-28 16:24:10 -07:00
|
|
|
void applyNodeDataToWindow(Hy3Node*, bool no_animation = false);
|
2023-04-12 01:33:00 -07:00
|
|
|
|
2023-06-07 03:22:17 -07:00
|
|
|
// if shift is true, shift the window in the given direction, returning
|
|
|
|
// nullptr, if shift is false, return the window in the given direction or
|
|
|
|
// nullptr. if once is true, only one group will be broken out of / into
|
2023-06-28 16:24:10 -07:00
|
|
|
Hy3Node* shiftOrGetFocus(Hy3Node&, ShiftDirection, bool shift, bool once, bool visible);
|
2023-04-23 21:02:51 -07:00
|
|
|
|
2023-04-12 01:33:00 -07:00
|
|
|
friend struct Hy3Node;
|
|
|
|
};
|