debug: move to hyprutils' logger (#12673)
This commit is contained in:
parent
f88deb928a
commit
6175ecd4c4
147 changed files with 1696 additions and 1709 deletions
|
|
@ -13,7 +13,7 @@
|
|||
#include "Compositor.hpp"
|
||||
#include "TokenManager.hpp"
|
||||
#include "eventLoop/EventLoopManager.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "debug/log/Logger.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../managers/animation/DesktopAnimationManager.hpp"
|
||||
|
|
@ -163,7 +163,7 @@ CKeybindManager::CKeybindManager() {
|
|||
|
||||
const auto DISPATCHER = g_pKeybindManager->m_dispatchers.find(m_lastLongPressKeybind->handler);
|
||||
|
||||
Debug::log(LOG, "Long press timeout passed, calling dispatcher.");
|
||||
Log::logger->log(Log::DEBUG, "Long press timeout passed, calling dispatcher.");
|
||||
DISPATCHER->second(m_lastLongPressKeybind->arg);
|
||||
},
|
||||
nullptr);
|
||||
|
|
@ -181,7 +181,7 @@ CKeybindManager::CKeybindManager() {
|
|||
for (const auto& k : m_activeKeybinds) {
|
||||
const auto DISPATCHER = g_pKeybindManager->m_dispatchers.find(k->handler);
|
||||
|
||||
Debug::log(LOG, "Keybind repeat triggered, calling dispatcher.");
|
||||
Log::logger->log(Log::DEBUG, "Keybind repeat triggered, calling dispatcher.");
|
||||
DISPATCHER->second(k->arg);
|
||||
}
|
||||
|
||||
|
|
@ -307,8 +307,8 @@ void CKeybindManager::updateXKBTranslationState() {
|
|||
", layout: " + LAYOUT + " )",
|
||||
CHyprColor(1.0, 50.0 / 255.0, 50.0 / 255.0, 1.0));
|
||||
|
||||
Debug::log(ERR, "[XKBTranslationState] Keyboard layout {} with variant {} (rules: {}, model: {}, options: {}) couldn't have been loaded.", rules.layout, rules.variant,
|
||||
rules.rules, rules.model, rules.options);
|
||||
Log::logger->log(Log::ERR, "[XKBTranslationState] Keyboard layout {} with variant {} (rules: {}, model: {}, options: {}) couldn't have been loaded.", rules.layout,
|
||||
rules.variant, rules.rules, rules.model, rules.options);
|
||||
memset(&rules, 0, sizeof(rules));
|
||||
|
||||
PKEYMAP = xkb_keymap_new_from_names2(PCONTEXT, &rules, XKB_KEYMAP_FORMAT_TEXT_V2, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
|
|
@ -349,7 +349,7 @@ bool CKeybindManager::tryMoveFocusToMonitor(PHLMONITOR monitor) {
|
|||
if (!LASTMONITOR)
|
||||
return false;
|
||||
if (LASTMONITOR == monitor) {
|
||||
Debug::log(LOG, "Tried to move to active monitor");
|
||||
Log::logger->log(Log::DEBUG, "Tried to move to active monitor");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
|||
return true;
|
||||
|
||||
if (!m_xkbTranslationState) {
|
||||
Debug::log(ERR, "BUG THIS: m_pXKBTranslationState nullptr!");
|
||||
Log::logger->log(Log::ERR, "BUG THIS: m_pXKBTranslationState nullptr!");
|
||||
updateXKBTranslationState();
|
||||
|
||||
if (!m_xkbTranslationState)
|
||||
|
|
@ -497,7 +497,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
|||
}
|
||||
}
|
||||
if (!foundInPressedKeys) {
|
||||
Debug::log(ERR, "BUG THIS: key not found in m_dPressedKeys");
|
||||
Log::logger->log(Log::ERR, "BUG THIS: key not found in m_dPressedKeys");
|
||||
// fallback with wrong `KEY.modmaskAtPressTime`, this can be buggy
|
||||
suppressEvent = !handleKeybinds(MODS, KEY, false, pKeyboard).passEvent;
|
||||
}
|
||||
|
|
@ -582,7 +582,7 @@ bool CKeybindManager::onMouseEvent(const IPointer::SButtonEvent& e) {
|
|||
}
|
||||
}
|
||||
if (!foundInPressedKeys) {
|
||||
Debug::log(ERR, "BUG THIS: key not found in m_dPressedKeys (2)");
|
||||
Log::logger->log(Log::ERR, "BUG THIS: key not found in m_dPressedKeys (2)");
|
||||
// fallback with wrong `KEY.modmaskAtPressTime`, this can be buggy
|
||||
suppressEvent = !handleKeybinds(MODS, KEY, false, nullptr).passEvent;
|
||||
}
|
||||
|
|
@ -768,10 +768,10 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
|||
|
||||
// Should never happen, as we check in the ConfigManager, but oh well
|
||||
if (DISPATCHER == m_dispatchers.end()) {
|
||||
Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k->handler);
|
||||
Log::logger->log(Log::ERR, "Invalid handler in a keybind! (handler {} does not exist)", k->handler);
|
||||
} else {
|
||||
// call the dispatcher
|
||||
Debug::log(LOG, "Keybind triggered, calling dispatcher ({}, {}, {}, {})", modmask, key.keyName, key.keysym, DISPATCHER->first);
|
||||
Log::logger->log(Log::DEBUG, "Keybind triggered, calling dispatcher ({}, {}, {}, {})", modmask, key.keyName, key.keysym, DISPATCHER->first);
|
||||
|
||||
m_passPressed = sc<int>(pressed);
|
||||
|
||||
|
|
@ -809,7 +809,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
|||
res.passEvent |= !found;
|
||||
|
||||
if (!found && !*PDISABLEINHIBIT && PROTO::shortcutsInhibit->isInhibited()) {
|
||||
Debug::log(LOG, "Keybind handling is disabled due to an inhibitor");
|
||||
Log::logger->log(Log::DEBUG, "Keybind handling is disabled due to an inhibitor");
|
||||
|
||||
res.success = false;
|
||||
if (res.error.empty())
|
||||
|
|
@ -876,7 +876,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
|
|||
if (!CURRENT_TTY.has_value() || *CURRENT_TTY == TTY)
|
||||
return true;
|
||||
|
||||
Debug::log(LOG, "Switching from VT {} to VT {}", *CURRENT_TTY, TTY);
|
||||
Log::logger->log(Log::DEBUG, "Switching from VT {} to VT {}", *CURRENT_TTY, TTY);
|
||||
|
||||
g_pCompositor->m_aqBackend->session->switchVT(TTY);
|
||||
}
|
||||
|
|
@ -928,7 +928,7 @@ uint64_t CKeybindManager::spawnWithRules(std::string args, PHLWORKSPACE pInitial
|
|||
|
||||
Desktop::Rule::ruleEngine()->registerRule(std::move(rule));
|
||||
|
||||
Debug::log(LOG, "Applied rule arguments for exec.");
|
||||
Log::logger->log(Log::DEBUG, "Applied rule arguments for exec.");
|
||||
}
|
||||
|
||||
const uint64_t PROC = spawnRawProc(args, pInitialWorkspace, execToken);
|
||||
|
|
@ -942,13 +942,13 @@ SDispatchResult CKeybindManager::spawnRaw(std::string args) {
|
|||
}
|
||||
|
||||
uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWorkspace, const std::string& execRuleToken) {
|
||||
Debug::log(LOG, "Executing {}", args);
|
||||
Log::logger->log(Log::DEBUG, "Executing {}", args);
|
||||
|
||||
const auto HLENV = getHyprlandLaunchEnv(pInitialWorkspace);
|
||||
|
||||
pid_t child = fork();
|
||||
if (child < 0) {
|
||||
Debug::log(LOG, "Fail to fork");
|
||||
Log::logger->log(Log::DEBUG, "Fail to fork");
|
||||
return 0;
|
||||
}
|
||||
if (child == 0) {
|
||||
|
|
@ -980,7 +980,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
|
|||
}
|
||||
// run in parent
|
||||
|
||||
Debug::log(LOG, "Process Created with pid {}", child);
|
||||
Log::logger->log(Log::DEBUG, "Process Created with pid {}", child);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
|
@ -989,7 +989,7 @@ SDispatchResult CKeybindManager::killActive(std::string args) {
|
|||
const auto PWINDOW = Desktop::focusState()->window();
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "killActive: no window found");
|
||||
Log::logger->log(Log::ERR, "killActive: no window found");
|
||||
return {.success = false, .error = "killActive: no window found"};
|
||||
}
|
||||
|
||||
|
|
@ -1011,7 +1011,7 @@ SDispatchResult CKeybindManager::closeWindow(std::string args) {
|
|||
const auto PWINDOW = g_pCompositor->getWindowByRegex(args);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "closeWindow: no window found");
|
||||
Log::logger->log(Log::ERR, "closeWindow: no window found");
|
||||
return {.success = false, .error = "closeWindow: no window found"};
|
||||
}
|
||||
|
||||
|
|
@ -1027,7 +1027,7 @@ SDispatchResult CKeybindManager::killWindow(std::string args) {
|
|||
const auto PWINDOW = g_pCompositor->getWindowByRegex(args);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "killWindow: no window found");
|
||||
Log::logger->log(Log::ERR, "killWindow: no window found");
|
||||
return {.success = false, .error = "killWindow: no window found"};
|
||||
}
|
||||
|
||||
|
|
@ -1043,12 +1043,12 @@ SDispatchResult CKeybindManager::signalActive(std::string args) {
|
|||
try {
|
||||
const auto SIGNALNUM = std::stoi(args);
|
||||
if (SIGNALNUM < 1 || SIGNALNUM > 31) {
|
||||
Debug::log(ERR, "signalActive: invalid signal number {}", SIGNALNUM);
|
||||
Log::logger->log(Log::ERR, "signalActive: invalid signal number {}", SIGNALNUM);
|
||||
return {.success = false, .error = std::format("signalActive: invalid signal number {}", SIGNALNUM)};
|
||||
}
|
||||
kill(Desktop::focusState()->window()->getPID(), SIGNALNUM);
|
||||
} catch (const std::exception& e) {
|
||||
Debug::log(ERR, "signalActive: invalid signal format \"{}\"", args);
|
||||
Log::logger->log(Log::ERR, "signalActive: invalid signal format \"{}\"", args);
|
||||
return {.success = false, .error = std::format("signalActive: invalid signal format \"{}\"", args)};
|
||||
}
|
||||
|
||||
|
|
@ -1064,7 +1064,7 @@ SDispatchResult CKeybindManager::signalWindow(std::string args) {
|
|||
const auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "signalWindow: no window");
|
||||
Log::logger->log(Log::ERR, "signalWindow: no window");
|
||||
return {.success = false, .error = "signalWindow: no window"};
|
||||
}
|
||||
|
||||
|
|
@ -1074,12 +1074,12 @@ SDispatchResult CKeybindManager::signalWindow(std::string args) {
|
|||
try {
|
||||
const auto SIGNALNUM = std::stoi(SIGNAL);
|
||||
if (SIGNALNUM < 1 || SIGNALNUM > 31) {
|
||||
Debug::log(ERR, "signalWindow: invalid signal number {}", SIGNALNUM);
|
||||
Log::logger->log(Log::ERR, "signalWindow: invalid signal number {}", SIGNALNUM);
|
||||
return {.success = false, .error = std::format("signalWindow: invalid signal number {}", SIGNALNUM)};
|
||||
}
|
||||
kill(PWINDOW->getPID(), SIGNALNUM);
|
||||
} catch (const std::exception& e) {
|
||||
Debug::log(ERR, "signalWindow: invalid signal format \"{}\"", SIGNAL);
|
||||
Log::logger->log(Log::ERR, "signalWindow: invalid signal format \"{}\"", SIGNAL);
|
||||
return {.success = false, .error = std::format("signalWindow: invalid signal format \"{}\"", SIGNAL)};
|
||||
}
|
||||
|
||||
|
|
@ -1190,7 +1190,7 @@ static SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSP
|
|||
const SWorkspaceIDName PPREVWS = PER_MON ? PMONITOR->getPrevWorkspaceIDName(PCURRENTWORKSPACE->m_id) : PCURRENTWORKSPACE->getPrevWorkspaceIDName();
|
||||
// Do nothing if there's no previous workspace, otherwise switch to it.
|
||||
if (PPREVWS.id == -1 || PPREVWS.id == PCURRENTWORKSPACE->m_id) {
|
||||
Debug::log(LOG, "No previous workspace to change to");
|
||||
Log::logger->log(Log::DEBUG, "No previous workspace to change to");
|
||||
return {.id = WORKSPACE_NOT_CHANGED};
|
||||
}
|
||||
|
||||
|
|
@ -1219,7 +1219,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
|||
|
||||
const auto& [workspaceToChangeTo, workspaceName, isAutoID] = getWorkspaceToChangeFromArgs(args, PCURRENTWORKSPACE, PMONITOR);
|
||||
if (workspaceToChangeTo == WORKSPACE_INVALID) {
|
||||
Debug::log(ERR, "Error in changeworkspace, invalid value");
|
||||
Log::logger->log(Log::ERR, "Error in changeworkspace, invalid value");
|
||||
return {.success = false, .error = "Error in changeworkspace, invalid value"};
|
||||
}
|
||||
|
||||
|
|
@ -1383,12 +1383,12 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||
|
||||
const auto& [WORKSPACEID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args);
|
||||
if (WORKSPACEID == WORKSPACE_INVALID) {
|
||||
Debug::log(LOG, "Invalid workspace in moveActiveToWorkspace");
|
||||
Log::logger->log(Log::DEBUG, "Invalid workspace in moveActiveToWorkspace");
|
||||
return {.success = false, .error = "Invalid workspace in moveActiveToWorkspace"};
|
||||
}
|
||||
|
||||
if (WORKSPACEID == PWINDOW->workspaceID()) {
|
||||
Debug::log(LOG, "Not moving to workspace because it didn't change.");
|
||||
Log::logger->log(Log::DEBUG, "Not moving to workspace because it didn't change.");
|
||||
return {.success = false, .error = "Not moving to workspace because it didn't change."};
|
||||
}
|
||||
|
||||
|
|
@ -1444,7 +1444,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
|||
|
||||
const auto& [WORKSPACEID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args);
|
||||
if (WORKSPACEID == WORKSPACE_INVALID) {
|
||||
Debug::log(ERR, "Error in moveActiveToWorkspaceSilent, invalid value");
|
||||
Log::logger->log(Log::ERR, "Error in moveActiveToWorkspaceSilent, invalid value");
|
||||
return {.success = false, .error = "Error in moveActiveToWorkspaceSilent, invalid value"};
|
||||
}
|
||||
|
||||
|
|
@ -1482,7 +1482,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
|||
char arg = args[0];
|
||||
|
||||
if (!isDirection(args)) {
|
||||
Debug::log(ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
Log::logger->log(Log::ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
return {.success = false, .error = std::format("Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
|
||||
}
|
||||
|
||||
|
|
@ -1518,7 +1518,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
|||
return {};
|
||||
}
|
||||
|
||||
Debug::log(LOG, "No window found in direction {}, looking for a monitor", arg);
|
||||
Log::logger->log(Log::DEBUG, "No window found in direction {}, looking for a monitor", arg);
|
||||
|
||||
if (*PMONITORFALLBACK && tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg)))
|
||||
return {};
|
||||
|
|
@ -1527,7 +1527,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
|||
if (*PNOFALLBACK)
|
||||
return {.success = false, .error = std::format("Nothing to focus to in direction {}", arg)};
|
||||
|
||||
Debug::log(LOG, "No monitor found in direction {}, getting the inverse edge", arg);
|
||||
Log::logger->log(Log::DEBUG, "No monitor found in direction {}, getting the inverse edge", arg);
|
||||
|
||||
const auto PMONITOR = PLASTWINDOW->m_monitor.lock();
|
||||
|
||||
|
|
@ -1612,11 +1612,11 @@ SDispatchResult CKeybindManager::swapActive(std::string args) {
|
|||
PWINDOWTOCHANGETO = g_pCompositor->getWindowByRegex(args);
|
||||
|
||||
if (!PWINDOWTOCHANGETO || PWINDOWTOCHANGETO == PLASTWINDOW) {
|
||||
Debug::log(ERR, "Can't swap with {}, invalid window", args);
|
||||
Log::logger->log(Log::ERR, "Can't swap with {}, invalid window", args);
|
||||
return {.success = false, .error = std::format("Can't swap with {}, invalid window", args)};
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Swapping active window with {}", args);
|
||||
Log::logger->log(Log::DEBUG, "Swapping active window with {}", args);
|
||||
|
||||
updateRelativeCursorCoords();
|
||||
g_pLayoutManager->getCurrentLayout()->switchWindows(PLASTWINDOW, PWINDOWTOCHANGETO);
|
||||
|
|
@ -1644,7 +1644,7 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
|
|||
}
|
||||
|
||||
if (!isDirection(args)) {
|
||||
Debug::log(ERR, "Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
Log::logger->log(Log::ERR, "Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
return {.success = false, .error = std::format("Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
|
||||
}
|
||||
|
||||
|
|
@ -1807,7 +1807,7 @@ SDispatchResult CKeybindManager::alterSplitRatio(std::string args) {
|
|||
splitResult = getPlusMinusKeywordResult(args, 0);
|
||||
|
||||
if (!splitResult.has_value()) {
|
||||
Debug::log(ERR, "Splitratio invalid in alterSplitRatio!");
|
||||
Log::logger->log(Log::ERR, "Splitratio invalid in alterSplitRatio!");
|
||||
return {.success = false, .error = "Splitratio invalid in alterSplitRatio!"};
|
||||
}
|
||||
|
||||
|
|
@ -1830,14 +1830,14 @@ SDispatchResult CKeybindManager::focusMonitor(std::string arg) {
|
|||
|
||||
SDispatchResult CKeybindManager::moveCursorToCorner(std::string arg) {
|
||||
if (!isNumber(arg)) {
|
||||
Debug::log(ERR, "moveCursorToCorner, arg has to be a number.");
|
||||
Log::logger->log(Log::ERR, "moveCursorToCorner, arg has to be a number.");
|
||||
return {.success = false, .error = "moveCursorToCorner, arg has to be a number."};
|
||||
}
|
||||
|
||||
const auto CORNER = std::stoi(arg);
|
||||
|
||||
if (CORNER < 0 || CORNER > 3) {
|
||||
Debug::log(ERR, "moveCursorToCorner, corner not 0 - 3.");
|
||||
Log::logger->log(Log::ERR, "moveCursorToCorner, corner not 0 - 3.");
|
||||
return {.success = false, .error = "moveCursorToCorner, corner not 0 - 3."};
|
||||
}
|
||||
|
||||
|
|
@ -1875,7 +1875,7 @@ SDispatchResult CKeybindManager::moveCursor(std::string args) {
|
|||
|
||||
size_t i = args.find_first_of(' ');
|
||||
if (i == std::string::npos) {
|
||||
Debug::log(ERR, "moveCursor, takes 2 arguments.");
|
||||
Log::logger->log(Log::ERR, "moveCursor, takes 2 arguments.");
|
||||
return {.success = false, .error = "moveCursor, takes 2 arguments"};
|
||||
}
|
||||
|
||||
|
|
@ -1883,11 +1883,11 @@ SDispatchResult CKeybindManager::moveCursor(std::string args) {
|
|||
y_str = args.substr(i + 1);
|
||||
|
||||
if (!isNumber(x_str)) {
|
||||
Debug::log(ERR, "moveCursor, x argument has to be a number.");
|
||||
Log::logger->log(Log::ERR, "moveCursor, x argument has to be a number.");
|
||||
return {.success = false, .error = "moveCursor, x argument has to be a number."};
|
||||
}
|
||||
if (!isNumber(y_str)) {
|
||||
Debug::log(ERR, "moveCursor, y argument has to be a number.");
|
||||
Log::logger->log(Log::ERR, "moveCursor, y argument has to be a number.");
|
||||
return {.success = false, .error = "moveCursor, y argument has to be a number."};
|
||||
}
|
||||
|
||||
|
|
@ -1945,7 +1945,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Debug::log(ERR, "Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args);
|
||||
Log::logger->log(Log::ERR, "Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args);
|
||||
return {.success = false, .error = std::format("Invalid arg in workspaceOpt, opt \"{}\" doesn't exist.", args)};
|
||||
}
|
||||
|
||||
|
|
@ -1970,7 +1970,7 @@ SDispatchResult CKeybindManager::renameWorkspace(std::string args) {
|
|||
else
|
||||
return {.success = false, .error = "No such workspace"};
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what());
|
||||
Log::logger->log(Log::ERR, R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what());
|
||||
return {.success = false, .error = std::format(R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what())};
|
||||
}
|
||||
|
||||
|
|
@ -1991,14 +1991,14 @@ SDispatchResult CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args)
|
|||
PHLMONITOR PMONITOR = g_pCompositor->getMonitorFromString(args);
|
||||
|
||||
if (!PMONITOR) {
|
||||
Debug::log(ERR, "Ignoring moveCurrentWorkspaceToMonitor: monitor doesn't exist");
|
||||
Log::logger->log(Log::ERR, "Ignoring moveCurrentWorkspaceToMonitor: monitor doesn't exist");
|
||||
return {.success = false, .error = "Ignoring moveCurrentWorkspaceToMonitor: monitor doesn't exist"};
|
||||
}
|
||||
|
||||
// get the current workspace
|
||||
const auto PCURRENTWORKSPACE = Desktop::focusState()->monitor()->m_activeWorkspace;
|
||||
if (!PCURRENTWORKSPACE) {
|
||||
Debug::log(ERR, "moveCurrentWorkspaceToMonitor invalid workspace!");
|
||||
Log::logger->log(Log::ERR, "moveCurrentWorkspaceToMonitor invalid workspace!");
|
||||
return {.success = false, .error = "moveCurrentWorkspaceToMonitor invalid workspace!"};
|
||||
}
|
||||
|
||||
|
|
@ -2017,21 +2017,21 @@ SDispatchResult CKeybindManager::moveWorkspaceToMonitor(std::string args) {
|
|||
const auto PMONITOR = g_pCompositor->getMonitorFromString(monitor);
|
||||
|
||||
if (!PMONITOR) {
|
||||
Debug::log(ERR, "Ignoring moveWorkspaceToMonitor: monitor doesn't exist");
|
||||
Log::logger->log(Log::ERR, "Ignoring moveWorkspaceToMonitor: monitor doesn't exist");
|
||||
return {.success = false, .error = "Ignoring moveWorkspaceToMonitor: monitor doesn't exist"};
|
||||
}
|
||||
|
||||
const auto WORKSPACEID = getWorkspaceIDNameFromString(workspace).id;
|
||||
|
||||
if (WORKSPACEID == WORKSPACE_INVALID) {
|
||||
Debug::log(ERR, "moveWorkspaceToMonitor invalid workspace!");
|
||||
Log::logger->log(Log::ERR, "moveWorkspaceToMonitor invalid workspace!");
|
||||
return {.success = false, .error = "moveWorkspaceToMonitor invalid workspace!"};
|
||||
}
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
|
||||
|
||||
if (!PWORKSPACE) {
|
||||
Debug::log(ERR, "moveWorkspaceToMonitor workspace doesn't exist!");
|
||||
Log::logger->log(Log::ERR, "moveWorkspaceToMonitor workspace doesn't exist!");
|
||||
return {.success = false, .error = "moveWorkspaceToMonitor workspace doesn't exist!"};
|
||||
}
|
||||
|
||||
|
|
@ -2043,14 +2043,14 @@ SDispatchResult CKeybindManager::moveWorkspaceToMonitor(std::string args) {
|
|||
SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args) {
|
||||
auto [workspaceID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args);
|
||||
if (workspaceID == WORKSPACE_INVALID) {
|
||||
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor invalid workspace!");
|
||||
Log::logger->log(Log::ERR, "focusWorkspaceOnCurrentMonitor invalid workspace!");
|
||||
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor invalid workspace!"};
|
||||
}
|
||||
|
||||
const auto PCURRMONITOR = Desktop::focusState()->monitor();
|
||||
|
||||
if (!PCURRMONITOR) {
|
||||
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor monitor doesn't exist!");
|
||||
Log::logger->log(Log::ERR, "focusWorkspaceOnCurrentMonitor monitor doesn't exist!");
|
||||
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor monitor doesn't exist!"};
|
||||
}
|
||||
|
||||
|
|
@ -2078,7 +2078,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args
|
|||
if (pWorkspace->m_monitor != PCURRMONITOR) {
|
||||
const auto POLDMONITOR = pWorkspace->m_monitor.lock();
|
||||
if (!POLDMONITOR) { // wat
|
||||
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!");
|
||||
Log::logger->log(Log::ERR, "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!");
|
||||
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!"};
|
||||
}
|
||||
if (POLDMONITOR->activeWorkspaceID() == workspaceID) {
|
||||
|
|
@ -2097,7 +2097,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args
|
|||
SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
||||
const auto& [workspaceID, workspaceName, isAutoID] = getWorkspaceIDNameFromString("special:" + args);
|
||||
if (workspaceID == WORKSPACE_INVALID || !g_pCompositor->isWorkspaceSpecial(workspaceID)) {
|
||||
Debug::log(ERR, "Invalid workspace passed to special");
|
||||
Log::logger->log(Log::ERR, "Invalid workspace passed to special");
|
||||
return {.success = false, .error = "Invalid workspace passed to special"};
|
||||
}
|
||||
|
||||
|
|
@ -2118,12 +2118,12 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
|||
|
||||
if (requestedWorkspaceIsAlreadyOpen && specialOpenOnMonitor == workspaceID) {
|
||||
// already open on this monitor
|
||||
Debug::log(LOG, "Toggling special workspace {} to closed", workspaceID);
|
||||
Log::logger->log(Log::DEBUG, "Toggling special workspace {} to closed", workspaceID);
|
||||
PMONITOR->setSpecialWorkspace(nullptr);
|
||||
|
||||
focusedWorkspace = PMONITOR->m_activeWorkspace;
|
||||
} else {
|
||||
Debug::log(LOG, "Toggling special workspace {} to open", workspaceID);
|
||||
Log::logger->log(Log::DEBUG, "Toggling special workspace {} to open", workspaceID);
|
||||
auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID);
|
||||
|
||||
if (!PSPECIALWORKSPACE)
|
||||
|
|
@ -2213,7 +2213,7 @@ SDispatchResult CKeybindManager::moveWindow(std::string args) {
|
|||
const auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "moveWindow: no window");
|
||||
Log::logger->log(Log::ERR, "moveWindow: no window");
|
||||
return {.success = false, .error = "moveWindow: no window"};
|
||||
}
|
||||
|
||||
|
|
@ -2235,7 +2235,7 @@ SDispatchResult CKeybindManager::resizeWindow(std::string args) {
|
|||
const auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "resizeWindow: no window");
|
||||
Log::logger->log(Log::ERR, "resizeWindow: no window");
|
||||
return {.success = false, .error = "resizeWindow: no window"};
|
||||
}
|
||||
|
||||
|
|
@ -2293,11 +2293,11 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "No such window found"};
|
||||
|
||||
Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_title);
|
||||
Log::logger->log(Log::DEBUG, "Focusing to window name: {}", PWINDOW->m_title);
|
||||
|
||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
||||
if (!PWORKSPACE) {
|
||||
Debug::log(ERR, "BUG THIS: null workspace in focusWindow");
|
||||
Log::logger->log(Log::ERR, "BUG THIS: null workspace in focusWindow");
|
||||
return {.success = false, .error = "BUG THIS: null workspace in focusWindow"};
|
||||
}
|
||||
|
||||
|
|
@ -2305,7 +2305,7 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
|
|||
|
||||
if (Desktop::focusState()->monitor() && Desktop::focusState()->monitor()->m_activeWorkspace != PWINDOW->m_workspace &&
|
||||
Desktop::focusState()->monitor()->m_activeSpecialWorkspace != PWINDOW->m_workspace) {
|
||||
Debug::log(LOG, "Fake executing workspace to move focus");
|
||||
Log::logger->log(Log::DEBUG, "Fake executing workspace to move focus");
|
||||
changeworkspace(PWORKSPACE->getConfigName());
|
||||
}
|
||||
|
||||
|
|
@ -2359,7 +2359,7 @@ SDispatchResult CKeybindManager::toggleSwallow(std::string args) {
|
|||
SDispatchResult CKeybindManager::setSubmap(std::string submap) {
|
||||
if (submap == "reset" || submap.empty()) {
|
||||
m_currentSelectedSubmap.name = "";
|
||||
Debug::log(LOG, "Reset active submap to the default one.");
|
||||
Log::logger->log(Log::DEBUG, "Reset active submap to the default one.");
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"submap", ""});
|
||||
EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap.name);
|
||||
return {};
|
||||
|
|
@ -2368,14 +2368,14 @@ SDispatchResult CKeybindManager::setSubmap(std::string submap) {
|
|||
for (const auto& k : g_pKeybindManager->m_keybinds) {
|
||||
if (k->submap.name == submap) {
|
||||
m_currentSelectedSubmap.name = submap;
|
||||
Debug::log(LOG, "Changed keybind submap to {}", submap);
|
||||
Log::logger->log(Log::DEBUG, "Changed keybind submap to {}", submap);
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap});
|
||||
EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap.name);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Debug::log(ERR, "Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap);
|
||||
Log::logger->log(Log::ERR, "Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap);
|
||||
return {.success = false, .error = std::format("Cannot set submap {}, submap doesn't exist (wasn't registered!)", submap)};
|
||||
}
|
||||
|
||||
|
|
@ -2385,12 +2385,12 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
const auto PWINDOW = g_pCompositor->getWindowByRegex(regexp);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "pass: window not found");
|
||||
Log::logger->log(Log::ERR, "pass: window not found");
|
||||
return {.success = false, .error = "pass: window not found"};
|
||||
}
|
||||
|
||||
if (!g_pSeatManager->m_keyboard) {
|
||||
Debug::log(ERR, "No kb in pass?");
|
||||
Log::logger->log(Log::ERR, "No kb in pass?");
|
||||
return {.success = false, .error = "No kb in pass?"};
|
||||
}
|
||||
|
||||
|
|
@ -2459,7 +2459,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
// args=<NEW_MODKEYS><NEW_KEY>[,WINDOW_RULES]
|
||||
const auto ARGS = CVarList(args, 3);
|
||||
if (ARGS.size() != 3) {
|
||||
Debug::log(ERR, "sendshortcut: invalid args");
|
||||
Log::logger->log(Log::ERR, "sendshortcut: invalid args");
|
||||
return {.success = false, .error = "sendshortcut: invalid args"};
|
||||
}
|
||||
|
||||
|
|
@ -2477,7 +2477,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
keycode = std::stoi(KEY.substr(6));
|
||||
isMouse = true;
|
||||
if (keycode < 272) {
|
||||
Debug::log(ERR, "sendshortcut: invalid mouse button");
|
||||
Log::logger->log(Log::ERR, "sendshortcut: invalid mouse button");
|
||||
return {.success = false, .error = "sendshortcut: invalid mouse button"};
|
||||
}
|
||||
} else {
|
||||
|
|
@ -2492,7 +2492,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
const auto KB = g_pSeatManager->m_keyboard;
|
||||
|
||||
if (!KB) {
|
||||
Debug::log(ERR, "sendshortcut: no kb");
|
||||
Log::logger->log(Log::ERR, "sendshortcut: no kb");
|
||||
return {.success = false, .error = "sendshortcut: no kb"};
|
||||
}
|
||||
|
||||
|
|
@ -2516,7 +2516,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
|
||||
if (!keycode) {
|
||||
Debug::log(ERR, "sendshortcut: key not found");
|
||||
Log::logger->log(Log::ERR, "sendshortcut: key not found");
|
||||
return {.success = false, .error = "sendshortcut: key not found"};
|
||||
}
|
||||
|
||||
|
|
@ -2525,7 +2525,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
|
||||
if (!keycode) {
|
||||
Debug::log(ERR, "sendshortcut: invalid key");
|
||||
Log::logger->log(Log::ERR, "sendshortcut: invalid key");
|
||||
return {.success = false, .error = "sendshortcut: invalid key"};
|
||||
}
|
||||
|
||||
|
|
@ -2539,12 +2539,12 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
PWINDOW = g_pCompositor->getWindowByRegex(regexp);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "sendshortcut: window not found");
|
||||
Log::logger->log(Log::ERR, "sendshortcut: window not found");
|
||||
return {.success = false, .error = "sendshortcut: window not found"};
|
||||
}
|
||||
|
||||
if (!g_pSeatManager->m_keyboard) {
|
||||
Debug::log(ERR, "No kb in sendshortcut?");
|
||||
Log::logger->log(Log::ERR, "No kb in sendshortcut?");
|
||||
return {.success = false, .error = "No kb in sendshortcut?"};
|
||||
}
|
||||
|
||||
|
|
@ -2704,7 +2704,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
|
|||
PWINDOW = Desktop::focusState()->window();
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "pin: window not found");
|
||||
Log::logger->log(Log::ERR, "pin: window not found");
|
||||
return {.success = false, .error = "pin: window not found"};
|
||||
}
|
||||
|
||||
|
|
@ -2716,7 +2716,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
|
|||
const auto PMONITOR = PWINDOW->m_monitor.lock();
|
||||
|
||||
if (!PMONITOR) {
|
||||
Debug::log(ERR, "pin: monitor not found");
|
||||
Log::logger->log(Log::ERR, "pin: monitor not found");
|
||||
return {.success = false, .error = "pin: window not found"};
|
||||
}
|
||||
|
||||
|
|
@ -2803,7 +2803,7 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) {
|
|||
PWINDOW = Desktop::focusState()->window();
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "alterZOrder: no window");
|
||||
Log::logger->log(Log::ERR, "alterZOrder: no window");
|
||||
return {.success = false, .error = "alterZOrder: no window"};
|
||||
}
|
||||
|
||||
|
|
@ -2812,7 +2812,7 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) {
|
|||
else if (POSITION == "bottom")
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, false);
|
||||
else {
|
||||
Debug::log(ERR, "alterZOrder: bad position: {}", POSITION);
|
||||
Log::logger->log(Log::ERR, "alterZOrder: bad position: {}", POSITION);
|
||||
return {.success = false, .error = "alterZOrder: bad position: {}"};
|
||||
}
|
||||
|
||||
|
|
@ -2933,7 +2933,7 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) {
|
|||
return {};
|
||||
|
||||
if (!isDirection(args)) {
|
||||
Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
Log::logger->log(Log::ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
return {.success = false, .error = std::format("Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
|
||||
}
|
||||
|
||||
|
|
@ -2986,7 +2986,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
|
|||
static auto PIGNOREGROUPLOCK = CConfigValue<Hyprlang::INT>("binds:ignore_group_lock");
|
||||
|
||||
if (!isDirection(args)) {
|
||||
Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
Log::logger->log(Log::ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||
return {.success = false, .error = std::format("Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
|
||||
}
|
||||
|
||||
|
|
@ -3138,7 +3138,7 @@ static void parsePropTrivial(Desktop::Types::COverridableVar<T>& prop, const std
|
|||
prop = Desktop::Types::COverridableVar<T>(std::stof(s), Desktop::Types::PRIORITY_SET_PROP);
|
||||
} else if constexpr (std::is_same_v<T, std::string>)
|
||||
prop = Desktop::Types::COverridableVar<T>(s, Desktop::Types::PRIORITY_SET_PROP);
|
||||
} catch (...) { Debug::log(ERR, "Hyprctl: parsePropTrivial: failed to parse setprop for {}", s); }
|
||||
} catch (...) { Log::logger->log(Log::ERR, "Hyprctl: parsePropTrivial: failed to parse setprop for {}", s); }
|
||||
}
|
||||
|
||||
SDispatchResult CKeybindManager::setProp(std::string args) {
|
||||
|
|
@ -3302,7 +3302,7 @@ SDispatchResult CKeybindManager::forceIdle(std::string args) {
|
|||
std::optional<float> duration = getPlusMinusKeywordResult(args, 0);
|
||||
|
||||
if (!duration.has_value()) {
|
||||
Debug::log(ERR, "Duration invalid in forceIdle!");
|
||||
Log::logger->log(Log::ERR, "Duration invalid in forceIdle!");
|
||||
return {.success = false, .error = "Duration invalid in forceIdle!"};
|
||||
}
|
||||
|
||||
|
|
@ -3315,14 +3315,14 @@ SDispatchResult CKeybindManager::sendkeystate(std::string args) {
|
|||
// args=<NEW_MODKEYS><NEW_KEY><STATE>[,WINDOW_RULES]
|
||||
const auto ARGS = CVarList(args, 4);
|
||||
if (ARGS.size() != 4) {
|
||||
Debug::log(ERR, "sendkeystate: invalid args");
|
||||
Log::logger->log(Log::ERR, "sendkeystate: invalid args");
|
||||
return {.success = false, .error = "sendkeystate: invalid args"};
|
||||
}
|
||||
|
||||
const auto STATE = ARGS[2];
|
||||
|
||||
if (STATE != "down" && STATE != "repeat" && STATE != "up") {
|
||||
Debug::log(ERR, "sendkeystate: invalid state, must be 'down', 'repeat', or 'up'");
|
||||
Log::logger->log(Log::ERR, "sendkeystate: invalid state, must be 'down', 'repeat', or 'up'");
|
||||
return {.success = false, .error = "sendkeystate: invalid state, must be 'down', 'repeat', or 'up'"};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue