diff --git a/dwm.c b/dwm.c index 325cb8fc..2c8876a1 100644 --- a/dwm.c +++ b/dwm.c @@ -2864,8 +2864,20 @@ toggleglobal(const Arg *arg) void toggleborder(const Arg *arg) { + int client_count = 0; + Client *c = NULL; + // 判断当前是否选中客户端 if (!selmon->sel) return; + // 判断是否只有一个窗口 + for (c = selmon->clients; c; c = c->next) { + if (ISVISIBLE(c) && !HIDDEN(c)) { + client_count ++; + } + } + if (client_count == 1) { + return; + } selmon->sel->isnoborder ^= 1; selmon->sel->bw = selmon->sel->isnoborder ? 0 : borderpx; int diff = (selmon->sel->isnoborder ? -1 : 1) * borderpx;