mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2026-05-07 11:18:01 +02:00
hyprexpo: cap generated workspace numbers
This commit is contained in:
parent
667aec2720
commit
187d2784e9
3 changed files with 16 additions and 2 deletions
|
|
@ -28,6 +28,7 @@ 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`
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
|||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprexpo:bg_col", Hyprlang::INT{0xFF111111});
|
||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprexpo:workspace_method", Hyprlang::STRING{"center current"});
|
||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprexpo:skip_empty", Hyprlang::INT{0});
|
||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprexpo:max_workspace", Hyprlang::INT{0});
|
||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprexpo:show_workspace_numbers", Hyprlang::INT{0});
|
||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprexpo:workspace_number_color", Hyprlang::INT{0xFFFFFFFF});
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
|
|||
static auto* const* PGAPS = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:gap_size")->getDataStaticPtr();
|
||||
static auto* const* PCOL = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:bg_col")->getDataStaticPtr();
|
||||
static auto* const* PSKIP = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:skip_empty")->getDataStaticPtr();
|
||||
static auto* const* PMAXWS = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:max_workspace")->getDataStaticPtr();
|
||||
static auto* const* PSHOWNUM = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:show_workspace_numbers")->getDataStaticPtr();
|
||||
static auto* const* PNUMCOL = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:workspace_number_color")->getDataStaticPtr();
|
||||
static auto const* PMETHOD = (Hyprlang::STRING const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:workspace_method")->getDataStaticPtr();
|
||||
|
|
@ -142,9 +143,20 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
|
|||
images.resize(SIDE_LENGTH * SIDE_LENGTH);
|
||||
|
||||
// r includes empty workspaces; m skips over them
|
||||
std::string selector = **PSKIP ? "m" : "r";
|
||||
const bool skipEmpty = **PSKIP;
|
||||
const int64_t maxWorkspace = **PMAXWS;
|
||||
std::string selector = skipEmpty ? "m" : "r";
|
||||
|
||||
if (methodCenter) {
|
||||
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) {
|
||||
int currentID = methodStartID;
|
||||
int firstID = currentID;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue