Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to disable overview panel blur #117

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Refer to the [Hyprland wiki](https://wiki.hyprland.org/Nix/Hyprland-on-Home-Mana
- `plugin:overview:workspaceActiveBorder`
- `plugin:overview:workspaceInactiveBorder`
- `plugin:overview:dragAlpha` overrides the alpha of window when dragged in overview (0 - 1, 0 = transparent, 1 = opaque)
- `plugin:overview:disableBlur`
#### Layout
- `plugin:overview:panelHeight`
- `plugin:overview:panelBorderWidth`
Expand Down
1 change: 1 addition & 0 deletions src/Globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace Config {
extern bool disableGestures;
extern bool reverseSwipe;

extern bool disableBlur;
extern float overrideAnimSpeed;
extern float dragAlpha;
}
Expand Down
29 changes: 25 additions & 4 deletions src/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ void CHyprspaceWidget::draw() {
widgetBox.y -= owner->vecPosition.y;

g_pHyprOpenGL->m_RenderData.clipBox = CBox({0, 0}, owner->vecTransformedSize);
g_pHyprOpenGL->renderRectWithBlur(&widgetBox, Config::panelBaseColor);

if (!Config::disableBlur) {
g_pHyprOpenGL->renderRectWithBlur(&widgetBox, Config::panelBaseColor);
}
else {
g_pHyprOpenGL->renderRect(&widgetBox, Config::panelBaseColor);
}

// Panel Border
if (Config::panelBorderWidth > 0) {
Expand Down Expand Up @@ -194,7 +200,12 @@ void CHyprspaceWidget::draw() {
if (Config::workspaceBorderSize >= 1 && Config::workspaceActiveBorder.a > 0) {
g_pHyprOpenGL->renderBorder(&curWorkspaceBox, CGradientValueData(Config::workspaceActiveBorder), 0, Config::workspaceBorderSize);
}
g_pHyprOpenGL->renderRectWithBlur(&curWorkspaceBox, Config::workspaceActiveBackground); // cant really round it until I find a proper way to clip windows to a rounded rect
if (!Config::disableBlur) {
g_pHyprOpenGL->renderRectWithBlur(&curWorkspaceBox, Config::workspaceActiveBackground); // cant really round it until I find a proper way to clip windows to a rounded rect
}
else {
g_pHyprOpenGL->renderRect(&curWorkspaceBox, Config::workspaceActiveBackground);
}
if (!Config::drawActiveWorkspace) {
curWorkspaceRectOffsetX += workspaceBoxW + (Config::workspaceMargin * owner->scale);
continue;
Expand All @@ -204,7 +215,12 @@ void CHyprspaceWidget::draw() {
if (Config::workspaceBorderSize >= 1 && Config::workspaceInactiveBorder.a > 0) {
g_pHyprOpenGL->renderBorder(&curWorkspaceBox, CGradientValueData(Config::workspaceInactiveBorder), 0, Config::workspaceBorderSize);
}
g_pHyprOpenGL->renderRectWithBlur(&curWorkspaceBox, Config::workspaceInactiveBackground);
if (!Config::disableBlur) {
g_pHyprOpenGL->renderRectWithBlur(&curWorkspaceBox, Config::workspaceInactiveBackground);
}
else {
g_pHyprOpenGL->renderRect(&curWorkspaceBox, Config::workspaceInactiveBackground);
}
}

// background and bottom layers
Expand All @@ -227,7 +243,12 @@ void CHyprspaceWidget::draw() {
if (owner->activeWorkspace == ws && Config::affectStrut) {
CBox miniPanelBox = {curWorkspaceRectOffsetX, curWorkspaceRectOffsetY, widgetBox.w * monitorSizeScaleFactor, widgetBox.h * monitorSizeScaleFactor};
if (Config::onBottom) miniPanelBox = {curWorkspaceRectOffsetX, curWorkspaceRectOffsetY + workspaceBoxH - widgetBox.h * monitorSizeScaleFactor, widgetBox.w * monitorSizeScaleFactor, widgetBox.h * monitorSizeScaleFactor};
g_pHyprOpenGL->renderRectWithBlur(&miniPanelBox, CColor(0, 0, 0, 0), 0, 1.f, false);
if (!Config::disableBlur) {
g_pHyprOpenGL->renderRectWithBlur(&miniPanelBox, CColor(0, 0, 0, 0), 0, 1.f, false);
}
else {
g_pHyprOpenGL->renderRect(&miniPanelBox, CColor(0, 0, 0, 0), 0);
}
}

if (ws != nullptr) {
Expand Down
5 changes: 5 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ bool Config::showSpecialWorkspace = false;
bool Config::disableGestures = false;
bool Config::reverseSwipe = false;

bool Config::disableBlur = false;

float Config::overrideAnimSpeed = 0;

float Config::dragAlpha = 0.2;
Expand Down Expand Up @@ -384,6 +386,8 @@ void reloadConfig() {
Config::disableGestures = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:disableGestures")->getValue());
Config::reverseSwipe = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:reverseSwipe")->getValue());

Config::disableBlur = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:disableBlur")->getValue());

Config::overrideAnimSpeed = std::any_cast<Hyprlang::FLOAT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:overrideAnimSpeed")->getValue());

for (auto& widget : g_overviewWidgets) {
Expand Down Expand Up @@ -456,6 +460,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE inHandle) {
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:disableGestures", Hyprlang::INT{0});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:reverseSwipe", Hyprlang::INT{0});

HyprlandAPI::addConfigValue(pHandle, "plugin:overview:disableBlur", Hyprlang::INT{0});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:overrideAnimSpeed", Hyprlang::FLOAT{0.0});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:dragAlpha", Hyprlang::FLOAT{0.2});

Expand Down