Add only_special for handling special workspaces
This commit is contained in:
@@ -61,6 +61,9 @@ plugin {
|
|||||||
|
|
||||||
#which keys to use for labeling windows
|
#which keys to use for labeling windows
|
||||||
motionkeys=abcdefghijklmnopqrstuvwxyz1234567890
|
motionkeys=abcdefghijklmnopqrstuvwxyz1234567890
|
||||||
|
|
||||||
|
#if a monitor has a focused special workspace, only put easymotion labels on the windows in the special workspace
|
||||||
|
only_special = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ struct SMotionActionDesc {
|
|||||||
float blurA = 1.0f;
|
float blurA = 1.0f;
|
||||||
std::string motionKeys = "abcdefghijklmnopqrstuvwxyz1234567890";
|
std::string motionKeys = "abcdefghijklmnopqrstuvwxyz1234567890";
|
||||||
std::string fullscreen_action = "none";
|
std::string fullscreen_action = "none";
|
||||||
|
int only_special = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline UP<SGlobalState> g_pGlobalState;
|
inline UP<SGlobalState> g_pGlobalState;
|
||||||
|
|||||||
18
main.cpp
18
main.cpp
@@ -1,5 +1,6 @@
|
|||||||
#include <hyprland/src/desktop/Workspace.hpp>
|
#include <hyprland/src/desktop/Workspace.hpp>
|
||||||
#include <hyprland/src/plugins/PluginAPI.hpp>
|
#include <hyprland/src/plugins/PluginAPI.hpp>
|
||||||
|
#include <string>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <any>
|
#include <any>
|
||||||
@@ -135,6 +136,7 @@ SDispatchResult easymotionDispatch(std::string args)
|
|||||||
static auto *const BLURA = (Hyprlang::FLOAT* const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:blurA")->getDataStaticPtr();
|
static auto *const BLURA = (Hyprlang::FLOAT* const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:blurA")->getDataStaticPtr();
|
||||||
static auto *const MOTIONKEYS = (Hyprlang::STRING const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:motionkeys")->getDataStaticPtr();
|
static auto *const MOTIONKEYS = (Hyprlang::STRING const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:motionkeys")->getDataStaticPtr();
|
||||||
static auto *const FSACTION = (Hyprlang::STRING const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:fullscreen_action")->getDataStaticPtr();
|
static auto *const FSACTION = (Hyprlang::STRING const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:fullscreen_action")->getDataStaticPtr();
|
||||||
|
static auto *const ONLYSPECIAL = (Hyprlang::INT* const *)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:only_special")->getDataStaticPtr();
|
||||||
|
|
||||||
|
|
||||||
CVarList emargs(args, 0, ',');
|
CVarList emargs(args, 0, ',');
|
||||||
@@ -157,6 +159,7 @@ SDispatchResult easymotionDispatch(std::string args)
|
|||||||
actionDesc.xray = **XRAY;
|
actionDesc.xray = **XRAY;
|
||||||
actionDesc.blurA = **BLURA;
|
actionDesc.blurA = **BLURA;
|
||||||
actionDesc.fullscreen_action = std::string(*FSACTION);
|
actionDesc.fullscreen_action = std::string(*FSACTION);
|
||||||
|
actionDesc.only_special = **ONLYSPECIAL;
|
||||||
|
|
||||||
|
|
||||||
for(size_t i = 0; i < emargs.size(); i++)
|
for(size_t i = 0; i < emargs.size(); i++)
|
||||||
@@ -190,8 +193,20 @@ SDispatchResult easymotionDispatch(std::string args)
|
|||||||
}
|
}
|
||||||
} else if (kv[0] == "motionkeys") {
|
} else if (kv[0] == "motionkeys") {
|
||||||
actionDesc.motionKeys = kv[1];
|
actionDesc.motionKeys = kv[1];
|
||||||
|
} else if (kv[0] == "blur") {
|
||||||
|
actionDesc.blur = configStringToInt(kv[1]).value_or(1);
|
||||||
|
} else if (kv[0] == "xray") {
|
||||||
|
actionDesc.xray = configStringToInt(kv[1]).value_or(1);
|
||||||
|
} else if (kv[0] == "blurA") {
|
||||||
|
try {
|
||||||
|
actionDesc.blurA = std::stof(kv[1]);
|
||||||
|
} catch (const std::invalid_argument& ia) {
|
||||||
|
actionDesc.blurA = 1.0f;
|
||||||
|
}
|
||||||
} else if (kv[0] == "fullscreen_action") {
|
} else if (kv[0] == "fullscreen_action") {
|
||||||
actionDesc.fullscreen_action = kv[1];
|
actionDesc.fullscreen_action = kv[1];
|
||||||
|
} else if (kv[0] == "only_special") {
|
||||||
|
actionDesc.only_special = configStringToInt(kv[1]).value_or(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +218,8 @@ SDispatchResult easymotionDispatch(std::string args)
|
|||||||
if (w->m_pWorkspace == m->activeWorkspace || m->activeSpecialWorkspace == w->m_pWorkspace) {
|
if (w->m_pWorkspace == m->activeWorkspace || m->activeSpecialWorkspace == w->m_pWorkspace) {
|
||||||
if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut)
|
if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
if (m->activeSpecialWorkspace && w->m_pWorkspace != m->activeSpecialWorkspace && actionDesc.only_special)
|
||||||
|
continue;
|
||||||
std::string lstr = actionDesc.motionKeys.substr(key_idx++, 1);
|
std::string lstr = actionDesc.motionKeys.substr(key_idx++, 1);
|
||||||
addLabelToWindow(w, &actionDesc, lstr);
|
addLabelToWindow(w, &actionDesc, lstr);
|
||||||
}
|
}
|
||||||
@@ -263,6 +280,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
|||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:easymotion:xray", Hyprlang::INT{0});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:easymotion:xray", Hyprlang::INT{0});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:easymotion:motionkeys", Hyprlang::STRING{"abcdefghijklmnopqrstuvwxyz1234567890"});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:easymotion:motionkeys", Hyprlang::STRING{"abcdefghijklmnopqrstuvwxyz1234567890"});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:easymotion:fullscreen_action", Hyprlang::STRING{"none"});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:easymotion:fullscreen_action", Hyprlang::STRING{"none"});
|
||||||
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:easymotion:only_special", Hyprlang::INT{1});
|
||||||
|
|
||||||
|
|
||||||
g_pGlobalState = makeUnique<SGlobalState>();
|
g_pGlobalState = makeUnique<SGlobalState>();
|
||||||
|
|||||||
Reference in New Issue
Block a user