mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2026-05-07 19:28:00 +02:00
hyprexpo: remove workspace number feature from PR
This commit is contained in:
parent
e84a326bd3
commit
b3c656e934
4 changed files with 7 additions and 52 deletions
|
|
@ -28,9 +28,6 @@ gap_size | number | gap between desktops | `5`
|
|||
bg_col | color | color in gaps (between desktops) | `rgb(000000)`
|
||||
workspace_method | [center/first] [workspace] | position of the desktops | `center current`
|
||||
skip_empty | boolean | whether the grid displays workspaces sequentially by id using selector "r" (`false`) or skips empty workspaces using selector "m" (`true`) | `false`
|
||||
max_workspace | number | highest normal workspace to show when `skip_empty` is `false`; `0` disables the limit | `0`
|
||||
show_workspace_numbers | boolean | show numeric labels for workspaces | `false`
|
||||
workspace_number_color | color | color of workspace number labels | `rgb(ffffff)`
|
||||
gesture_distance | number | how far is the max for the gesture | `300`
|
||||
|
||||
### Keywords
|
||||
|
|
@ -61,8 +58,6 @@ hl.config({
|
|||
bg_col = "rgb(111111)",
|
||||
workspace_method = "center current",
|
||||
skip_empty = false,
|
||||
show_workspace_numbers = false,
|
||||
workspace_number_color = "rgb(ffffff)",
|
||||
gesture_distance = 300,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -324,9 +324,6 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
|||
addConfigValue(makeShared<Config::Values::CColorValue>("plugin:hyprexpo:bg_col", "background color", 0xFF111111));
|
||||
addConfigValue(makeShared<Config::Values::CStringValue>("plugin:hyprexpo:workspace_method", "workspace method", "center current"));
|
||||
addConfigValue(makeShared<Config::Values::CIntValue>("plugin:hyprexpo:skip_empty", "skip empty workspaces", 0));
|
||||
addConfigValue(makeShared<Config::Values::CIntValue>("plugin:hyprexpo:max_workspace", "maximum normal workspace shown, or 0 for unlimited", 0));
|
||||
addConfigValue(makeShared<Config::Values::CIntValue>("plugin:hyprexpo:show_workspace_numbers", "show workspace numbers", 0));
|
||||
addConfigValue(makeShared<Config::Values::CColorValue>("plugin:hyprexpo:workspace_number_color", "workspace number color", 0xFFFFFFFF));
|
||||
addConfigValue(makeShared<Config::Values::CIntValue>("plugin:hyprexpo:gesture_distance", "gesture distance", 200));
|
||||
|
||||
return {"hyprexpo", "A plugin for an overview", "Vaxry", "1.0"};
|
||||
|
|
|
|||
|
|
@ -66,15 +66,11 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
|
|||
static const CConfigValue<Config::INTEGER> PGAPS("plugin:hyprexpo:gap_size");
|
||||
static const CConfigValue<Config::INTEGER> PCOL("plugin:hyprexpo:bg_col");
|
||||
static const CConfigValue<Config::INTEGER> PSKIP("plugin:hyprexpo:skip_empty");
|
||||
static const CConfigValue<Config::INTEGER> PMAXWS("plugin:hyprexpo:max_workspace");
|
||||
static const CConfigValue<Config::INTEGER> PSHOWNUM("plugin:hyprexpo:show_workspace_numbers");
|
||||
static const CConfigValue<Config::INTEGER> PNUMCOL("plugin:hyprexpo:workspace_number_color");
|
||||
static const CConfigValue<Config::STRING> PMETHOD("plugin:hyprexpo:workspace_method");
|
||||
|
||||
SIDE_LENGTH = *PCOLUMNS;
|
||||
GAP_WIDTH = *PGAPS;
|
||||
BG_COLOR = CHyprColor(*PCOL);
|
||||
showWorkspaceNumbers = *PSHOWNUM;
|
||||
SIDE_LENGTH = *PCOLUMNS;
|
||||
GAP_WIDTH = *PGAPS;
|
||||
BG_COLOR = CHyprColor(*PCOL);
|
||||
|
||||
// process the method
|
||||
bool methodCenter = true;
|
||||
|
|
@ -92,20 +88,9 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
|
|||
images.resize(SIDE_LENGTH * SIDE_LENGTH);
|
||||
|
||||
// r includes empty workspaces; m skips over them
|
||||
const bool skipEmpty = *PSKIP;
|
||||
const int64_t maxWorkspace = *PMAXWS;
|
||||
std::string selector = skipEmpty ? "m" : "r";
|
||||
std::string selector = *PSKIP ? "m" : "r";
|
||||
|
||||
if (!skipEmpty && maxWorkspace > 0) {
|
||||
const int64_t tileCount = SIDE_LENGTH * SIDE_LENGTH;
|
||||
const int64_t maxStart = std::max<int64_t>(1, maxWorkspace - tileCount + 1);
|
||||
const int64_t startID = methodCenter ? std::clamp<int64_t>(methodStartID - tileCount / 2, 1, maxStart) : std::clamp<int64_t>(methodStartID, 1, maxStart);
|
||||
|
||||
for (size_t i = 0; i < images.size(); ++i) {
|
||||
const int64_t workspaceID = startID + i;
|
||||
images[i].workspaceID = workspaceID <= maxWorkspace ? workspaceID : WORKSPACE_INVALID;
|
||||
}
|
||||
} else if (methodCenter) {
|
||||
if (methodCenter) {
|
||||
int currentID = methodStartID;
|
||||
int firstID = currentID;
|
||||
|
||||
|
|
@ -173,16 +158,6 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
|
|||
Vector2D tileRenderSize = (pMonitor->m_size - Vector2D{GAP_WIDTH * pMonitor->m_scale, GAP_WIDTH * pMonitor->m_scale} * (SIDE_LENGTH - 1)) / SIDE_LENGTH;
|
||||
CBox monbox{0, 0, tileSize.x * 2, tileSize.y * 2};
|
||||
|
||||
if (showWorkspaceNumbers) {
|
||||
const CHyprColor numberColor = CHyprColor(*PNUMCOL);
|
||||
const int fontSizePx = std::max(12, (int)std::round(tileRenderSize.y * pMonitor->m_scale * 0.22));
|
||||
for (auto& image : images) {
|
||||
if (image.workspaceID == WORKSPACE_INVALID)
|
||||
continue;
|
||||
image.labelTex = g_pHyprRenderer->renderText(std::to_string(image.workspaceID), numberColor, fontSizePx, false, "Sans Bold", tileRenderSize.x * pMonitor->m_scale);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ENABLE_LOWRES)
|
||||
monbox = {{0, 0}, pMonitor->m_pixelSize};
|
||||
|
||||
|
|
@ -516,15 +491,6 @@ void COverview::fullRender() {
|
|||
CRegion damage{0, 0, INT16_MAX, INT16_MAX};
|
||||
auto& image = images[x + y * SIDE_LENGTH];
|
||||
Render::GL::g_pHyprOpenGL->renderTextureInternal(image.fb->getTexture(), texbox, {.damage = &damage, .a = 1.0});
|
||||
|
||||
if (showWorkspaceNumbers && image.workspaceID != WORKSPACE_INVALID && image.labelTex && image.labelTex->ok()) {
|
||||
const Vector2D labelSize = image.labelTex->m_size / pMonitor->m_scale;
|
||||
const float margin = std::max(4.0, tileRenderSize.y * 0.05);
|
||||
CBox labelBox = {x * tileRenderSize.x + x * GAPSIZE + margin, y * tileRenderSize.y + y * GAPSIZE + margin, labelSize.x, labelSize.y};
|
||||
labelBox.scale(pMonitor->m_scale).translate(pos->value());
|
||||
labelBox.round();
|
||||
Render::GL::g_pHyprOpenGL->renderTexture(image.labelTex, labelBox, {.a = 1.0});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "globals.hpp"
|
||||
#include <hyprland/src/desktop/DesktopTypes.hpp>
|
||||
#include <hyprland/src/render/Framebuffer.hpp>
|
||||
#include <hyprland/src/render/Texture.hpp>
|
||||
#include <hyprland/src/helpers/AnimatedVariable.hpp>
|
||||
#include <hyprland/src/event/EventBus.hpp>
|
||||
#include <vector>
|
||||
|
|
@ -48,7 +47,6 @@ class COverview {
|
|||
int64_t workspaceID = -1;
|
||||
PHLWORKSPACE pWorkspace;
|
||||
CBox box;
|
||||
SP<Render::ITexture> labelTex;
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
@ -82,9 +80,8 @@ class COverview {
|
|||
CHyprSignalListener touchMoveHook;
|
||||
CHyprSignalListener touchDownHook;
|
||||
|
||||
bool swipe = false;
|
||||
bool swipeWasCommenced = false;
|
||||
bool showWorkspaceNumbers = false;
|
||||
bool swipe = false;
|
||||
bool swipeWasCommenced = false;
|
||||
|
||||
friend class COverviewPassElement;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue