pull: Added some good pull requests

This commit is contained in:
Kaley, Fischer 2023-12-02 12:52:00 +01:00
parent 4db9b1f37a
commit da91c54ef4
4 changed files with 21 additions and 4 deletions

View file

@ -181,6 +181,9 @@ plugin {
# offset from group split direction when only one window is in a group
group_inset = <int> # default: 10
# scale factor of windows on the special workspace
special_scale_factor = <float> # default: 0.8
# if a tab group will automatically be created for the first window spawned in a workspace
tab_first_window = <bool>

View file

@ -95,8 +95,11 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window, eDirection) {
Hy3Node* opening_into;
Hy3Node* opening_after = nullptr;
if (monitor->activeWorkspace != -1) {
auto* root = this->getWorkspaceRootGroup(monitor->activeWorkspace);
int specialWorkspaceID = monitor->specialWorkspaceID;
int workspace_id = specialWorkspaceID ? specialWorkspaceID : monitor->activeWorkspace;
if (workspace_id != -1) {
auto* root = this->getWorkspaceRootGroup(workspace_id);
if (root != nullptr) {
opening_after = root->getFocusedNode();
@ -1390,7 +1393,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
);
}
if (monitor == nullptr) {
if (!g_pCompositor->isWorkspaceSpecial(node->workspace_id) && monitor == nullptr) {
hy3_log(
ERR,
"node {:x}'s workspace has no associated monitor, cannot apply node data",
@ -1462,6 +1465,14 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
calcPos = calcPos + reserved_area.topLeft;
calcSize = calcSize - (reserved_area.topLeft - reserved_area.bottomRight);
if (g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID)) {
// adjust for special workspaces
static const auto* scalefactor
= &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:special_scale_factor")->floatValue;
calcPos = calcPos + (calcSize - calcSize * *scalefactor) / 2.f;
calcSize = calcSize * *scalefactor;
}
CBox wb = {calcPos, calcSize};
wb.round();

View file

@ -9,7 +9,9 @@
int workspace_for_action() {
if (g_pLayoutManager->getCurrentLayout() != g_Hy3Layout.get()) return -1;
int workspace_id = g_pCompositor->m_pLastMonitor->activeWorkspace;
int specialWorkspaceID = g_pCompositor->m_pLastMonitor->specialWorkspaceID;
int workspace_id
= specialWorkspaceID ? specialWorkspaceID : g_pCompositor->m_pLastMonitor->activeWorkspace;
if (workspace_id == -1) return -1;
auto* workspace = g_pCompositor->getWorkspaceByID(workspace_id);

View file

@ -21,6 +21,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
CONF("no_gaps_when_only", int, 0);
CONF("node_collapse_policy", int, 2);
CONF("group_inset", int, 10);
CONF("special_scale_factor", float, 0.8);
CONF("tab_first_window", int, 0);
// tabs