mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-19 08:30:22 -07:00
workspaces: Add binds:hide_special_on_workspace_change (#9728)
This commit is contained in:
parent
fc7223edc0
commit
05eb0aa43d
@ -2117,6 +2117,8 @@ PHLMONITOR CCompositor::getMonitorFromString(const std::string& name) {
|
||||
}
|
||||
|
||||
void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMonitor, bool noWarpCursor) {
|
||||
static auto PHIDESPECIALONWORKSPACECHANGE = CConfigValue<Hyprlang::INT>("binds:hide_special_on_workspace_change");
|
||||
|
||||
if (!pWorkspace || !pMonitor)
|
||||
return;
|
||||
|
||||
@ -2199,6 +2201,9 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo
|
||||
pMonitor->activeWorkspace->startAnim(false, false);
|
||||
}
|
||||
|
||||
if (*PHIDESPECIALONWORKSPACECHANGE)
|
||||
pMonitor->setSpecialWorkspace(nullptr);
|
||||
|
||||
setActiveMonitor(pMonitor);
|
||||
pMonitor->activeWorkspace = pWorkspace;
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->ID);
|
||||
|
@ -1246,6 +1246,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "binds:hide_special_on_workspace_change",
|
||||
.description = "If enabled, changing the active workspace (including to itself) will hide the special workspace on the monitor where the newly active workspace resides.",
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "binds:allow_workspace_cycles",
|
||||
.description = "If enabled, workspaces don’t forget their previous workspace, so cycles can be created by switching to the first workspace in a sequence, then endlessly "
|
||||
|
@ -626,6 +626,7 @@ CConfigManager::CConfigManager() {
|
||||
registerConfigVar("binds:pass_mouse_when_bound", Hyprlang::INT{0});
|
||||
registerConfigVar("binds:scroll_event_delay", Hyprlang::INT{300});
|
||||
registerConfigVar("binds:workspace_back_and_forth", Hyprlang::INT{0});
|
||||
registerConfigVar("binds:hide_special_on_workspace_change", Hyprlang::INT{0});
|
||||
registerConfigVar("binds:allow_workspace_cycles", Hyprlang::INT{0});
|
||||
registerConfigVar("binds:workspace_center_on", Hyprlang::INT{1});
|
||||
registerConfigVar("binds:focus_preferred_method", Hyprlang::INT{0});
|
||||
|
@ -1215,9 +1215,10 @@ static SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSP
|
||||
SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
||||
// Workspace_back_and_forth being enabled means that an attempt to switch to
|
||||
// the current workspace will instead switch to the previous.
|
||||
static auto PBACKANDFORTH = CConfigValue<Hyprlang::INT>("binds:workspace_back_and_forth");
|
||||
static auto PALLOWWORKSPACECYCLES = CConfigValue<Hyprlang::INT>("binds:allow_workspace_cycles");
|
||||
static auto PWORKSPACECENTERON = CConfigValue<Hyprlang::INT>("binds:workspace_center_on");
|
||||
static auto PBACKANDFORTH = CConfigValue<Hyprlang::INT>("binds:workspace_back_and_forth");
|
||||
static auto PALLOWWORKSPACECYCLES = CConfigValue<Hyprlang::INT>("binds:allow_workspace_cycles");
|
||||
static auto PWORKSPACECENTERON = CConfigValue<Hyprlang::INT>("binds:workspace_center_on");
|
||||
static auto PHIDESPECIALONWORKSPACECHANGE = CConfigValue<Hyprlang::INT>("binds:hide_special_on_workspace_change");
|
||||
|
||||
const auto PMONITOR = g_pCompositor->m_pLastMonitor.lock();
|
||||
|
||||
@ -1239,8 +1240,12 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
||||
const SWorkspaceIDName PPREVWS = args.contains("_per_monitor") ? PMONITOR->getPrevWorkspaceIDName(PCURRENTWORKSPACE->m_iID) : PCURRENTWORKSPACE->getPrevWorkspaceIDName();
|
||||
|
||||
const bool BISWORKSPACECURRENT = workspaceToChangeTo == PCURRENTWORKSPACE->m_iID;
|
||||
if (BISWORKSPACECURRENT && (!(*PBACKANDFORTH || EXPLICITPREVIOUS) || PPREVWS.id == -1))
|
||||
if (BISWORKSPACECURRENT && (!(*PBACKANDFORTH || EXPLICITPREVIOUS) || PPREVWS.id == -1)) {
|
||||
if (*PHIDESPECIALONWORKSPACECHANGE)
|
||||
PMONITOR->setSpecialWorkspace(nullptr);
|
||||
|
||||
return {.success = false, .error = "Previous workspace doesn't exist"};
|
||||
}
|
||||
|
||||
g_pInputManager->unconstrainMouse();
|
||||
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
||||
@ -1275,6 +1280,8 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
||||
} else
|
||||
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
|
||||
|
||||
if (*PHIDESPECIALONWORKSPACECHANGE)
|
||||
PMONITORWORKSPACEOWNER->setSpecialWorkspace(nullptr);
|
||||
PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo, false, true);
|
||||
|
||||
if (PMONITOR != PMONITORWORKSPACEOWNER) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user