input: add warp_on_toggle_special (#9945)
This commit is contained in:
parent
0dc531c4a7
commit
d775686380
3 changed files with 26 additions and 0 deletions
|
|
@ -1474,6 +1474,13 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_CHOICE,
|
.type = CONFIG_OPTION_CHOICE,
|
||||||
.data = SConfigOptionDescription::SChoiceData{0, "Disabled,Enabled,Force"},
|
.data = SConfigOptionDescription::SChoiceData{0, "Disabled,Enabled,Force"},
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "cursor:warp_on_toggle_special",
|
||||||
|
.description = "Move the cursor to the last focused window when toggling a special workspace. Options: 0 (Disabled), 1 (Enabled), "
|
||||||
|
"2 (Force - ignores cursor:no_warps option)",
|
||||||
|
.type = CONFIG_OPTION_CHOICE,
|
||||||
|
.data = SConfigOptionDescription::SChoiceData{0, "Disabled,Enabled,Force"},
|
||||||
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "cursor:default_monitor",
|
.value = "cursor:default_monitor",
|
||||||
.description = "the name of a default monitor for the cursor to be set to on startup (see hyprctl monitors for names)",
|
.description = "the name of a default monitor for the cursor to be set to on startup (see hyprctl monitors for names)",
|
||||||
|
|
|
||||||
|
|
@ -682,6 +682,7 @@ CConfigManager::CConfigManager() {
|
||||||
registerConfigVar("cursor:no_warps", Hyprlang::INT{0});
|
registerConfigVar("cursor:no_warps", Hyprlang::INT{0});
|
||||||
registerConfigVar("cursor:persistent_warps", Hyprlang::INT{0});
|
registerConfigVar("cursor:persistent_warps", Hyprlang::INT{0});
|
||||||
registerConfigVar("cursor:warp_on_change_workspace", Hyprlang::INT{0});
|
registerConfigVar("cursor:warp_on_change_workspace", Hyprlang::INT{0});
|
||||||
|
registerConfigVar("cursor:warp_on_toggle_special", Hyprlang::INT{0});
|
||||||
registerConfigVar("cursor:default_monitor", {STRVAL_EMPTY});
|
registerConfigVar("cursor:default_monitor", {STRVAL_EMPTY});
|
||||||
registerConfigVar("cursor:zoom_factor", {1.f});
|
registerConfigVar("cursor:zoom_factor", {1.f});
|
||||||
registerConfigVar("cursor:zoom_rigid", Hyprlang::INT{0});
|
registerConfigVar("cursor:zoom_rigid", Hyprlang::INT{0});
|
||||||
|
|
|
||||||
|
|
@ -2097,10 +2097,16 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateRelativeCursorCoords();
|
||||||
|
|
||||||
|
PHLWORKSPACEREF focusedWorkspace;
|
||||||
|
|
||||||
if (requestedWorkspaceIsAlreadyOpen && specialOpenOnMonitor == workspaceID) {
|
if (requestedWorkspaceIsAlreadyOpen && specialOpenOnMonitor == workspaceID) {
|
||||||
// already open on this monitor
|
// already open on this monitor
|
||||||
Debug::log(LOG, "Toggling special workspace {} to closed", workspaceID);
|
Debug::log(LOG, "Toggling special workspace {} to closed", workspaceID);
|
||||||
PMONITOR->setSpecialWorkspace(nullptr);
|
PMONITOR->setSpecialWorkspace(nullptr);
|
||||||
|
|
||||||
|
focusedWorkspace = PMONITOR->activeWorkspace;
|
||||||
} else {
|
} else {
|
||||||
Debug::log(LOG, "Toggling special workspace {} to open", workspaceID);
|
Debug::log(LOG, "Toggling special workspace {} to open", workspaceID);
|
||||||
auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID);
|
auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID);
|
||||||
|
|
@ -2109,6 +2115,18 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
||||||
PSPECIALWORKSPACE = g_pCompositor->createNewWorkspace(workspaceID, PMONITOR->ID, workspaceName);
|
PSPECIALWORKSPACE = g_pCompositor->createNewWorkspace(workspaceID, PMONITOR->ID, workspaceName);
|
||||||
|
|
||||||
PMONITOR->setSpecialWorkspace(PSPECIALWORKSPACE);
|
PMONITOR->setSpecialWorkspace(PSPECIALWORKSPACE);
|
||||||
|
|
||||||
|
focusedWorkspace = PSPECIALWORKSPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const static auto PWARPONTOGGLESPECIAL = CConfigValue<Hyprlang::INT>("cursor:warp_on_toggle_special");
|
||||||
|
|
||||||
|
if (*PWARPONTOGGLESPECIAL > 0) {
|
||||||
|
auto PLAST = focusedWorkspace->getLastFocusedWindow();
|
||||||
|
auto HLSurface = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock());
|
||||||
|
|
||||||
|
if (PLAST && (!HLSurface || HLSurface->getWindow()))
|
||||||
|
PLAST->warpCursor(*PWARPONTOGGLESPECIAL == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue