mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 21:27:20 +03:00
groupbar: add enabling groupbar and setting priority (#4299)
This commit is contained in:
parent
5f8e4068e5
commit
2ad2e1d5f5
@ -2629,6 +2629,7 @@ void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, CWorkspace* pWorks
|
|||||||
pWindow->moveToWorkspace(pWorkspace->m_iID);
|
pWindow->moveToWorkspace(pWorkspace->m_iID);
|
||||||
pWindow->updateToplevel();
|
pWindow->updateToplevel();
|
||||||
pWindow->updateDynamicRules();
|
pWindow->updateDynamicRules();
|
||||||
|
pWindow->uncacheWindowDecos();
|
||||||
|
|
||||||
if (!pWindow->m_bIsFloating) {
|
if (!pWindow->m_bIsFloating) {
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemovedTiling(pWindow);
|
g_pLayoutManager->getCurrentLayout()->onWindowRemovedTiling(pWindow);
|
||||||
|
@ -222,6 +222,12 @@ void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) {
|
|||||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWindow::uncacheWindowDecos() {
|
||||||
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
|
g_pDecorationPositioner->uncacheDecoration(wd.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoords, std::any data) {
|
bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoords, std::any data) {
|
||||||
if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords))
|
if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords))
|
||||||
return false;
|
return false;
|
||||||
|
@ -348,6 +348,7 @@ class CWindow {
|
|||||||
void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco);
|
void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco);
|
||||||
void updateWindowDecos();
|
void updateWindowDecos();
|
||||||
void removeWindowDeco(IHyprWindowDecoration* deco);
|
void removeWindowDeco(IHyprWindowDecoration* deco);
|
||||||
|
void uncacheWindowDecos();
|
||||||
bool checkInputOnDecos(const eInputType, const Vector2D&, std::any = {});
|
bool checkInputOnDecos(const eInputType, const Vector2D&, std::any = {});
|
||||||
pid_t getPID();
|
pid_t getPID();
|
||||||
IHyprWindowDecoration* getDecorationByType(eDecorationType);
|
IHyprWindowDecoration* getDecorationByType(eDecorationType);
|
||||||
|
@ -134,9 +134,11 @@ void CConfigManager::setDefaultVars() {
|
|||||||
configValues["group:insert_after_current"].intValue = 1;
|
configValues["group:insert_after_current"].intValue = 1;
|
||||||
configValues["group:focus_removed_window"].intValue = 1;
|
configValues["group:focus_removed_window"].intValue = 1;
|
||||||
|
|
||||||
|
configValues["group:groupbar:enabled"].intValue = 1;
|
||||||
configValues["group:groupbar:font_family"].strValue = "Sans";
|
configValues["group:groupbar:font_family"].strValue = "Sans";
|
||||||
configValues["group:groupbar:font_size"].intValue = 8;
|
configValues["group:groupbar:font_size"].intValue = 8;
|
||||||
configValues["group:groupbar:gradients"].intValue = 1;
|
configValues["group:groupbar:gradients"].intValue = 1;
|
||||||
|
configValues["group:groupbar:priority"].intValue = 3;
|
||||||
configValues["group:groupbar:render_titles"].intValue = 1;
|
configValues["group:groupbar:render_titles"].intValue = 1;
|
||||||
configValues["group:groupbar:scrolling"].intValue = 1;
|
configValues["group:groupbar:scrolling"].intValue = 1;
|
||||||
configValues["group:groupbar:text_color"].intValue = 0xffffffff;
|
configValues["group:groupbar:text_color"].intValue = 0xffffffff;
|
||||||
@ -1730,6 +1732,10 @@ void CConfigManager::loadConfigLoadVars() {
|
|||||||
ifs.close();
|
ifs.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
w->uncacheWindowDecos();
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
|
|
||||||
|
@ -15,8 +15,11 @@ constexpr int BAR_TEXT_PAD = 2;
|
|||||||
constexpr int BAR_HORIZONTAL_PADDING = 2;
|
constexpr int BAR_HORIZONTAL_PADDING = 2;
|
||||||
|
|
||||||
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
|
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
|
||||||
m_pWindow = pWindow;
|
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue;
|
||||||
if (m_tGradientActive.m_iTexID == 0)
|
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue;
|
||||||
|
m_pWindow = pWindow;
|
||||||
|
|
||||||
|
if (m_tGradientActive.m_iTexID == 0 && *PENABLED && *PGRADIENTS)
|
||||||
refreshGroupBarGradients();
|
refreshGroupBarGradients();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,13 +28,19 @@ CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {}
|
|||||||
SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
|
SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
|
||||||
static auto* const PRENDERTITLES = &g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles")->intValue;
|
static auto* const PRENDERTITLES = &g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles")->intValue;
|
||||||
static auto* const PTITLEFONTSIZE = &g_pConfigManager->getConfigValuePtr("group:groupbar:font_size")->intValue;
|
static auto* const PTITLEFONTSIZE = &g_pConfigManager->getConfigValuePtr("group:groupbar:font_size")->intValue;
|
||||||
|
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue;
|
||||||
|
|
||||||
SDecorationPositioningInfo info;
|
SDecorationPositioningInfo info;
|
||||||
info.policy = DECORATION_POSITION_STICKY;
|
info.policy = DECORATION_POSITION_STICKY;
|
||||||
info.edges = DECORATION_EDGE_TOP;
|
info.edges = DECORATION_EDGE_TOP;
|
||||||
info.priority = 3;
|
info.priority = g_pConfigManager->getConfigValuePtr("group:groupbar:priority")->intValue;
|
||||||
info.reserved = true;
|
info.reserved = true;
|
||||||
info.desiredExtents = {{0, BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (*PRENDERTITLES ? *PTITLEFONTSIZE : 0) + 2}, {0, 0}};
|
|
||||||
|
if (*PENABLED && m_pWindow->m_sSpecialRenderData.decorate)
|
||||||
|
info.desiredExtents = {{0, BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (*PRENDERTITLES ? *PTITLEFONTSIZE : 0) + 2}, {0, 0}};
|
||||||
|
else
|
||||||
|
info.desiredExtents = {{0, 0}, {0, 0}};
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +87,12 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
|
|||||||
// get how many bars we will draw
|
// get how many bars we will draw
|
||||||
int barsToDraw = m_dwGroupMembers.size();
|
int barsToDraw = m_dwGroupMembers.size();
|
||||||
|
|
||||||
|
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue;
|
||||||
static auto* const PRENDERTITLES = &g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles")->intValue;
|
static auto* const PRENDERTITLES = &g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles")->intValue;
|
||||||
static auto* const PTITLEFONTSIZE = &g_pConfigManager->getConfigValuePtr("group:groupbar:font_size")->intValue;
|
static auto* const PTITLEFONTSIZE = &g_pConfigManager->getConfigValuePtr("group:groupbar:font_size")->intValue;
|
||||||
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue;
|
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue;
|
||||||
|
|
||||||
if (!m_pWindow->m_sSpecialRenderData.decorate)
|
if (!*PENABLED || !m_pWindow->m_sSpecialRenderData.decorate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto ASSIGNEDBOX = assignedBoxGlobal();
|
const auto ASSIGNEDBOX = assignedBoxGlobal();
|
||||||
@ -280,6 +290,9 @@ void renderGradientTo(CTexture& tex, const CColor& grad) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void refreshGroupBarGradients() {
|
void refreshGroupBarGradients() {
|
||||||
|
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue;
|
||||||
|
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue;
|
||||||
|
|
||||||
static auto* const PGROUPCOLACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.active")->data;
|
static auto* const PGROUPCOLACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.active")->data;
|
||||||
static auto* const PGROUPCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive")->data;
|
static auto* const PGROUPCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive")->data;
|
||||||
static auto* const PGROUPCOLACTIVELOCKED = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_active")->data;
|
static auto* const PGROUPCOLACTIVELOCKED = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_active")->data;
|
||||||
@ -294,6 +307,9 @@ void refreshGroupBarGradients() {
|
|||||||
m_tGradientLockedInactive.destroyTexture();
|
m_tGradientLockedInactive.destroyTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!*PENABLED || !*PGRADIENTS)
|
||||||
|
return;
|
||||||
|
|
||||||
renderGradientTo(m_tGradientActive, ((CGradientValueData*)PGROUPCOLACTIVE->get())->m_vColors[0]);
|
renderGradientTo(m_tGradientActive, ((CGradientValueData*)PGROUPCOLACTIVE->get())->m_vColors[0]);
|
||||||
renderGradientTo(m_tGradientInactive, ((CGradientValueData*)PGROUPCOLINACTIVE->get())->m_vColors[0]);
|
renderGradientTo(m_tGradientInactive, ((CGradientValueData*)PGROUPCOLINACTIVE->get())->m_vColors[0]);
|
||||||
renderGradientTo(m_tGradientLockedActive, ((CGradientValueData*)PGROUPCOLACTIVELOCKED->get())->m_vColors[0]);
|
renderGradientTo(m_tGradientLockedActive, ((CGradientValueData*)PGROUPCOLACTIVELOCKED->get())->m_vColors[0]);
|
||||||
|
@ -370,4 +370,4 @@ CBox CDecorationPositioner::getWindowDecorationBox(IHyprWindowDecoration* deco)
|
|||||||
CBox box = DATA->lastReply.assignedGeometry;
|
CBox box = DATA->lastReply.assignedGeometry;
|
||||||
box.translate(getEdgeDefinedPoint(DATA->positioningInfo.edges, deco->m_pWindow));
|
box.translate(getEdgeDefinedPoint(DATA->positioningInfo.edges, deco->m_pWindow));
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user