Skip to content

Commit

Permalink
fix: 切换边框时,只有一个窗口就不能切换边框颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
roukaixin committed Mar 10, 2024
1 parent 903ca13 commit 7f0de1b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7f0de1b

Please sign in to comment.