mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 01:05:59 +01:00
hyprctl: hide unmapped windows without -a
This commit is contained in:
parent
0a4ade01d3
commit
717d5b3cc2
3 changed files with 18 additions and 3 deletions
|
@ -309,6 +309,8 @@ int main(int argc, char** argv) {
|
||||||
json = true;
|
json = true;
|
||||||
} else if (ARGS[i] == "-r" && !fullArgs.contains("r")) {
|
} else if (ARGS[i] == "-r" && !fullArgs.contains("r")) {
|
||||||
fullArgs += "r";
|
fullArgs += "r";
|
||||||
|
} else if (ARGS[i] == "-a" && !fullArgs.contains("a")) {
|
||||||
|
fullArgs += "a";
|
||||||
} else if (ARGS[i] == "--batch") {
|
} else if (ARGS[i] == "--batch") {
|
||||||
fullRequest = "--batch ";
|
fullRequest = "--batch ";
|
||||||
} else if (ARGS[i] == "--instance" || ARGS[i] == "-i") {
|
} else if (ARGS[i] == "--instance" || ARGS[i] == "-i") {
|
||||||
|
|
|
@ -242,6 +242,9 @@ std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
result += "[";
|
result += "[";
|
||||||
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
||||||
|
continue;
|
||||||
|
|
||||||
result += getWindowData(w.get(), format);
|
result += getWindowData(w.get(), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +253,9 @@ std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
||||||
|
continue;
|
||||||
|
|
||||||
result += getWindowData(w.get(), format);
|
result += getWindowData(w.get(), format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1562,8 +1568,9 @@ void CHyprCtl::unregisterCommand(const std::shared_ptr<SHyprCtlCommand>& cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CHyprCtl::getReply(std::string request) {
|
std::string CHyprCtl::getReply(std::string request) {
|
||||||
auto format = eHyprCtlOutputFormat::FORMAT_NORMAL;
|
auto format = eHyprCtlOutputFormat::FORMAT_NORMAL;
|
||||||
bool reloadAll = false;
|
bool reloadAll = false;
|
||||||
|
m_sCurrentRequestParams = {};
|
||||||
|
|
||||||
// process flags for non-batch requests
|
// process flags for non-batch requests
|
||||||
if (!request.starts_with("[[BATCH]]") && request.contains("/")) {
|
if (!request.starts_with("[[BATCH]]") && request.contains("/")) {
|
||||||
|
@ -1584,8 +1591,10 @@ std::string CHyprCtl::getReply(std::string request) {
|
||||||
|
|
||||||
if (c == 'j')
|
if (c == 'j')
|
||||||
format = eHyprCtlOutputFormat::FORMAT_JSON;
|
format = eHyprCtlOutputFormat::FORMAT_JSON;
|
||||||
if (c == 'r')
|
else if (c == 'r')
|
||||||
reloadAll = true;
|
reloadAll = true;
|
||||||
|
else if (c == 'a')
|
||||||
|
m_sCurrentRequestParams.all = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sepIndex < request.size())
|
if (sepIndex < request.size())
|
||||||
|
|
|
@ -16,6 +16,10 @@ class CHyprCtl {
|
||||||
|
|
||||||
int m_iSocketFD = -1;
|
int m_iSocketFD = -1;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool all = false;
|
||||||
|
} m_sCurrentRequestParams;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void startHyprCtlSocket();
|
void startHyprCtlSocket();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue