mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-05 06:31:57 -07:00
feat: dispatcher, add workspace renaming (#1336)
* feat: dispatcher, add workspace renaming Co-authored-by: vaxerski <vaxry@vaxry.net>
This commit is contained in:
@@ -10,6 +10,7 @@ CKeybindManager::CKeybindManager() {
|
||||
m_mDispatchers["closewindow"] = kill;
|
||||
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
||||
m_mDispatchers["workspace"] = changeworkspace;
|
||||
m_mDispatchers["renameworkspace"] = renameWorkspace;
|
||||
m_mDispatchers["fullscreen"] = fullscreenActive;
|
||||
m_mDispatchers["fakefullscreen"] = fakeFullscreenActive;
|
||||
m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
|
||||
@@ -1289,6 +1290,21 @@ void CKeybindManager::workspaceOpt(std::string args) {
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_pLastMonitor->ID);
|
||||
}
|
||||
|
||||
void CKeybindManager::renameWorkspace(std::string args) {
|
||||
try {
|
||||
const auto FIRSTSPACEPOS = args.find_first_of(' ');
|
||||
if (FIRSTSPACEPOS != std::string::npos) {
|
||||
int workspace = std::stoi(args.substr(0, FIRSTSPACEPOS));
|
||||
std::string name = args.substr(FIRSTSPACEPOS + 1);
|
||||
g_pCompositor->renameWorkspace(workspace, name);
|
||||
} else {
|
||||
g_pCompositor->renameWorkspace(std::stoi(args), "");
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"%s\": \"%s\"", args.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void CKeybindManager::exitHyprland(std::string argz) {
|
||||
g_pCompositor->cleanup();
|
||||
}
|
||||
|
Reference in New Issue
Block a user