hyprctl: don't return empty str if there are no global shortcuts

fixes #6043
This commit is contained in:
Vaxry 2025-02-18 00:33:27 +00:00
parent d01f9943e1
commit e59623d1d5

View File

@ -811,8 +811,11 @@ static std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::stri
std::string ret = ""; std::string ret = "";
const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts(); const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts();
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) { if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
for (auto const& sh : SHORTCUTS) for (auto const& sh : SHORTCUTS) {
ret += std::format("{}:{} -> {}\n", sh.appid, sh.id, sh.description); ret += std::format("{}:{} -> {}\n", sh.appid, sh.id, sh.description);
}
if (ret.empty())
ret = "none";
} else { } else {
ret += "["; ret += "[";
for (auto const& sh : SHORTCUTS) { for (auto const& sh : SHORTCUTS) {