Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/layout/horizontal.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,25 @@ void deck(Monitor *m) {
}
}

extern char monocle_symbol[16];

void // 17
monocle(Monitor *m) {
Client *c = NULL;
struct wlr_box geom;
int n = 0;

// count visible clients
wl_list_for_each(c, &clients, link) {
if (VISIBLEON(c, m) && ISFAKETILED(c))
n++;
}

// dynamically update the global monocle symbol buffer
if (n > 0)
snprintf(monocle_symbol, sizeof(monocle_symbol), "[%d]", n);
else
snprintf(monocle_symbol, sizeof(monocle_symbol), "[M]");

int32_t cur_gappov = enablegaps ? m->gappov : 0;
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
Expand Down Expand Up @@ -1007,4 +1022,4 @@ void fair(Monitor *m) {
free(row_h_base);
free(row_y_max);
free(row_h_max);
}
}
7 changes: 5 additions & 2 deletions src/layout/layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ enum {
VERTICAL_FAIR,
};

// client count in monocle layout
char monocle_symbol[16] = "[M]";

Layout layouts[] = {
// 最少两个,不能删除少于两个
/* symbol arrange function name */
{"T", tile, "tile", TILE}, // 平铺布局
{"S", scroller, "scroller", SCROLLER}, // 滚动布局
{"G", grid, "grid", GRID}, // 格子布局
{"M", monocle, "monocle", MONOCLE}, // 单屏布局
{monocle_symbol, monocle, "monocle", MONOCLE}, // 单屏布局
{"K", deck, "deck", DECK}, // 卡片布局
{"CT", center_tile, "center_tile", CENTER_TILE}, // 居中布局
{"RT", right_tile, "right_tile", RIGHT_TILE}, // 右布局
Expand All @@ -53,4 +56,4 @@ Layout layouts[] = {
{"DW", dwindle, "dwindle", DWINDLE},
{"F", fair, "fair", FAIR},
{"VF", vertical_fair, "vertical_fair", VERTICAL_FAIR},
};
};