diff options
author | Paul <[email protected]> | 2024-05-13 16:57:06 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-13 14:57:06 +0100 |
commit | 064bdb06f1f10676d18c333cc24caee2eb199408 (patch) | |
tree | 9a7e0fdd8938d8d52123e0179dabad898677ae4d /src/debug | |
parent | fd35b35000fa11ce540d944966ff17c71c31fd27 (diff) | |
download | Hyprland-064bdb06f1f10676d18c333cc24caee2eb199408.tar.gz Hyprland-064bdb06f1f10676d18c333cc24caee2eb199408.zip |
hyprctl: Add locked cmd to requests (#6042)
Co-authored-by: Leftas <[email protected]>
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/HyprCtl.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index a89e0710..f8fdb03f 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1550,6 +1550,18 @@ std::string dispatchDismissNotify(eHyprCtlOutputFormat format, std::string reque return "ok"; } +std::string getIsLocked(eHyprCtlOutputFormat format, std::string request) { + std::string lockedStr = g_pSessionLockManager->isSessionLocked() ? "true" : "false"; + if (format == eHyprCtlOutputFormat::FORMAT_JSON) + lockedStr = std::format(R"#( +{{ + "locked": {} +}} +)#", + lockedStr); + return lockedStr; +} + CHyprCtl::CHyprCtl() { registerCommand(SHyprCtlCommand{"workspaces", true, workspacesRequest}); registerCommand(SHyprCtlCommand{"workspacerules", true, workspaceRulesRequest}); @@ -1569,6 +1581,7 @@ CHyprCtl::CHyprCtl() { registerCommand(SHyprCtlCommand{"rollinglog", true, rollinglogRequest}); registerCommand(SHyprCtlCommand{"layouts", true, layoutsRequest}); registerCommand(SHyprCtlCommand{"configerrors", true, configErrorsRequest}); + registerCommand(SHyprCtlCommand{"locked", true, getIsLocked}); registerCommand(SHyprCtlCommand{"monitors", false, monitorsRequest}); registerCommand(SHyprCtlCommand{"reload", false, reloadRequest}); |