Skip to content

Commit

Permalink
Rounded Workspace Borders
Browse files Browse the repository at this point in the history
 -> Add WorkspaceBorderRadius / Rounded Borders
 -> Add Config::workspaceBorderRadius Option

Signed-off-by: jordan Johnston <johnstonljordan@gmail.com>
  • Loading branch information
nine7nine committed Jul 4, 2024
1 parent bdbb33d commit 4599168
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace Config {
extern bool hideTopLayers;
extern bool hideOverlayLayers;
extern bool drawActiveWorkspace;
extern int workspaceBorderRadius;
extern bool hideRealLayers;
extern bool affectStrut;

Expand Down
6 changes: 3 additions & 3 deletions src/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,17 @@ void CHyprspaceWidget::draw() {
// workspace background rect (NOT background layer) and border
if (ws == owner->activeWorkspace) {
if (Config::workspaceBorderSize >= 1 && Config::workspaceActiveBorder.a > 0) {
g_pHyprOpenGL->renderBorder(&curWorkspaceBox, CGradientValueData(Config::workspaceActiveBorder), 0, Config::workspaceBorderSize);
g_pHyprOpenGL->renderBorder(&curWorkspaceBox, CGradientValueData(Config::workspaceActiveBorder), round(Config::workspaceBorderRadius), 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
g_pHyprOpenGL->renderRectWithBlur(&curWorkspaceBox, Config::workspaceActiveBackground);
if (!Config::drawActiveWorkspace) {
curWorkspaceRectOffsetX += workspaceBoxW + (Config::workspaceMargin * owner->scale);
continue;
}
}
else {
if (Config::workspaceBorderSize >= 1 && Config::workspaceInactiveBorder.a > 0) {
g_pHyprOpenGL->renderBorder(&curWorkspaceBox, CGradientValueData(Config::workspaceInactiveBorder), 0, Config::workspaceBorderSize);
g_pHyprOpenGL->renderBorder(&curWorkspaceBox, CGradientValueData(Config::workspaceInactiveBorder), round(Config::workspaceBorderRadius), Config::workspaceBorderSize);
}
g_pHyprOpenGL->renderRectWithBlur(&curWorkspaceBox, Config::workspaceInactiveBackground);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ int Config::panelBorderWidth = 2;
int Config::workspaceMargin = 12;
int Config::reservedArea = 0;
int Config::workspaceBorderSize = 1;
int Config::workspaceBorderRadius = 2;
bool Config::adaptiveHeight = false; // TODO: implement
bool Config::centerAligned = true;
bool Config::onBottom = true; // TODO: implement
Expand Down Expand Up @@ -336,6 +337,7 @@ void reloadConfig() {
Config::workspaceMargin = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:workspaceMargin")->getValue());
Config::reservedArea = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:reservedArea")->getValue());
Config::workspaceBorderSize = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:workspaceBorderSize")->getValue());
Config::workspaceBorderRadius = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:workspaceBorderRadius")->getValue());
Config::adaptiveHeight = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:adaptiveHeight")->getValue());
Config::centerAligned = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:centerAligned")->getValue());
Config::onBottom = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "plugin:overview:onBottom")->getValue());
Expand Down Expand Up @@ -407,6 +409,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE inHandle) {
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:panelBorderWidth", Hyprlang::INT{2});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:workspaceMargin", Hyprlang::INT{12});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:workspaceBorderSize", Hyprlang::INT{1});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:workspaceBorderRadius", Hyprlang::INT{2});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:reservedArea", Hyprlang::INT{0});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:adaptiveHeight", Hyprlang::INT{0});
HyprlandAPI::addConfigValue(pHandle, "plugin:overview:centerAligned", Hyprlang::INT{1});
Expand Down

0 comments on commit 4599168

Please sign in to comment.