This commit is contained in:
Talha Ahmed 2026-02-05 08:01:12 +00:00 committed by GitHub
commit a51b5e8f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 253 additions and 2 deletions

3
bnc.sh Executable file
View file

@ -0,0 +1,3 @@
meson build -Dprefix=$PWD
ninja -C build

View file

@ -303,6 +303,49 @@ typedef struct {
float globalcolor[4];
float overlaycolor[4];
/* TABS */
// Tab Border Visbility (1 = true, 0 = false)
uint32_t tab_border_top;
uint32_t tab_border_bottom;
uint32_t tab_border_left;
uint32_t tab_border_right;
// Color of the tab's border when focused
float tab_focused_border_top[4];
float tab_focused_border_bottom[4];
float tab_focused_border_left[4];
float tab_focused_border_right[4];
// Color of tab's focused background (bg) and text color
float tab_focused_bg[4];
float tab_focused_text_color[4];
// Color of the tab's border when unfocused
float tab_unfocused_border_top[4];
float tab_unfocused_border_bottom[4];
float tab_unfocused_border_left[4];
float tab_unfocused_border_right[4];
// Color of tab's unfocused background (bg) and text color
float tab_unfocused_bg[4];
float tab_unfocused_text_color[4];
// Tab layout appearance
uint32_t tab_padding_width; // Space between text and left borders
uint32_t tab_padding_height; // Space between text and top/bottom borders
uint32_t tab_border_size; // Tab border thickness (pixels)
uint32_t tab_font_size; // Tab text font size (pixels)
uint32_t tab_client_border; // enable client borders (1=true, 0=false)
char tab_client_border_style[16]; // "full" (client border all sides) or "notop" (client no top border)
// Tab area appearance
uint32_t tab_area_borders; // enable borders around tab area (1=true, 0=false)
// Tab area border visibility (1=true, 0=false)
uint32_t tab_area_border_top; // top border of tab area
uint32_t tab_area_border_bottom; // bottom border of tab area
uint32_t tab_area_border_left; // left border of tab area
uint32_t tab_area_border_right; // right border of tab area
// Tab Area Border Appearance
float tab_area_border_focused[4]; // color of the tab area border when focused
float tab_area_border_unfocused[4]; // color of the tab area border when unfocused
uint32_t tab_area_border_size; // Tab border thickness (pixels)
uint32_t tab_area_padding_width; // Space between tab area border and tab's left/right borders
uint32_t tab_area_padding_height; // Space between tab area border and tab's top/bottom borders
char autostart[3][256];
ConfigTagRule *tag_rules; // 动态数组
@ -1757,6 +1800,155 @@ bool parse_option(Config *config, char *key, char *value) {
} else {
convert_hex_to_rgba(config->overlaycolor, color);
}
} else if (strcmp(key, "tab_border_top") == 0) {
config->tab_area_border_top = atoi(value);
} else if(strcmp(key, "tab_border_bottom") == 0) {
config->tab_border_bottom = atoi(value);
} else if(strcmp(key, "tab_border_left") == 0) {
config->tab_border_left = atoi(value);
} else if(strcmp(key, "tab_border_right") == 0) {
config->tab_border_right = atoi(value);
} else if (strcmp(key, "tab_focused_border_top") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_focused_border_top format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_focused_border_top, color);
}
} else if (strcmp(key, "tab_focused_border_bottom") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_focused_border_bottom format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_focused_border_bottom, color);
}
} else if (strcmp(key, "tab_focused_border_left") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_focused_border_left format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_focused_border_left, color);
}
} else if (strcmp(key, "tab_focused_border_right") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_focused_border_right format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_focused_border_right, color);
}
} else if (strcmp(key, "tab_focused_bg") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_focused_bg format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_focused_bg, color);
}
} else if (strcmp(key, "tab_focused_text_color") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_focused_text_color format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_focused_text_color, color);
}
} else if (strcmp(key, "tab_unfocused_border_top") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_unfocused_border_top format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_unfocused_border_top, color);
}
} else if (strcmp(key, "tab_unfocused_border_bottom") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_unfocused_border_bottom format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_unfocused_border_bottom, color);
}
} else if (strcmp(key, "tab_unfocused_border_left") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_unfocused_border_left format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_unfocused_border_left, color);
}
} else if (strcmp(key, "tab_unfocused_border_right") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_unfocused_border_right format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_unfocused_border_right, color);
}
} else if (strcmp(key, "tab_unfocused_bg") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_unfocused_bg format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_unfocused_bg, color);
}
} else if (strcmp(key, "tab_unfocused_text_color") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_unfocused_text_color format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_unfocused_text_color, color);
}
} else if (strcmp(key, "tab_padding_width") == 0) {
config->tab_padding_width = atoi(value);
} else if (strcmp(key, "tab_padding_height") == 0) {
config->tab_padding_height = atoi(value);
} else if (strcmp(key, "tab_border_size") == 0) {
config->tab_border_size = atoi(value);
} else if (strcmp(key, "tab_font_size") == 0) {
config->tab_font_size = atoi(value);
} else if (strcmp(key, "tab_client_border") == 0) {
config->tab_client_border = atoi(value);
} else if (strcmp(key, "tab_client_border_style") == 0) {
strncpy(config->tab_client_border_style, value, sizeof(config->tab_client_border_style) - 1);
config->tab_client_border_style[sizeof(config->tab_client_border_style) - 1] = '\0';
} else if (strcmp(key, "tab_area_borders") == 0) {
config->tab_area_borders = atoi(value);
} else if (strcmp(key, "tab_area_border_top") == 0) {
config->tab_area_border_top = atoi(value);
} else if (strcmp(key, "tab_area_border_bottom") == 0) {
config->tab_area_border_bottom = atoi(value);
} else if (strcmp(key, "tab_area_border_left") == 0) {
config->tab_area_border_left = atoi(value);
} else if (strcmp(key, "tab_area_border_right") == 0) {
config->tab_area_border_right = atoi(value);
} else if (strcmp(key, "tab_area_border_focused") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_area_border_focused format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_area_border_focused, color);
}
} else if (strcmp(key, "tab_area_border_unfocused") == 0) {
int64_t color = parse_color(value);
if (color == -1) {
fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Invalid tab_area_border_unfocused format: %s\n", value);
return false;
} else {
convert_hex_to_rgba(config->tab_area_border_unfocused, color);
}
} else if (strcmp(key, "tab_area_border_size") == 0) {
config->tab_area_border_size = atoi(value);
} else if (strcmp(key, "tab_area_padding_width") == 0) {
config->tab_area_padding_width = atoi(value);
} else if (strcmp(key, "tab_area_padding_height") == 0) {
config->tab_area_padding_height = atoi(value);
} else if (strcmp(key, "monitorrule") == 0) {
config->monitor_rules =
realloc(config->monitor_rules, (config->monitor_rules_count + 1) *

View file

@ -42,6 +42,50 @@ double default_mfact = 0.55f; // master 窗口比例
uint32_t default_nmaster = 1; // 默认master数量
int32_t center_master_overspread = 0; // 中心master时是否铺满
int32_t center_when_single_stack = 1; // 单个stack时是否居中
/* TABS */
// Tab Border Visbility
uint32_t tab_border_top = 0;
uint32_t tab_border_bottom = 1;
uint32_t tab_border_left = 0;
uint32_t tab_border_right = 0;
// Color of the tab's border when focused
float tab_focused_border_top[] = COLOR(0xc9b890ff);
float tab_focused_border_bottom[] = COLOR(0xc9b890ff);
float tab_focused_border_left[] = COLOR(0xc9b890ff);
float tab_focused_border_right[] = COLOR(0xc9b890ff);
// Color of tab's focused background (bg) and text color
float tab_focused_bg[] = COLOR(0xc9b890ff);
float tab_focused_text_color[] = COLOR(0x201b14ff);
// Color of the tab's border when unfocused
float tab_unfocused_border_top[] = COLOR(0x444444ff);
float tab_unfocused_border_bottom[] = COLOR(0x444444ff);
float tab_unfocused_border_left[] = COLOR(0x444444ff);
float tab_unfocused_border_right[] = COLOR(0x444444ff);
// Color of tab's unfocused background (bg) and text color
float tab_unfocused_bg[] = COLOR(0x444444ff);
float tab_unfocused_text_color[] = COLOR(0xccccccff);
// Tab appearance
uint32_t tab_padding_width = 10; // Space between text and left borders (pixels)
uint32_t tab_padding_height = 3; // Space between text and top/bottom borders (pixel)
uint32_t tab_border_size = 2; // Tab border thickness (pixels)
uint32_t tab_font_size = 14; // Tab text font size (pixels)
uint32_t tab_client_border = 1; // enable client borders (1=true, 0=false)
char tab_client_border_style[] = "notop"; // "full" (client border all sides) or "notop" (client no top border)
// Tab area appearance
uint32_t tab_area_borders = 1; // enable borders around tab area (1=true, 0=false)
// Tab area border visibility (1=true, 0=false)
uint32_t tab_area_border_top = 1; // top border of tab area
uint32_t tab_area_border_bottom = 0; // bottom border of tab area
uint32_t tab_area_border_left = 1; // left border of tab area
uint32_t tab_area_border_right = 1; // right border of tab area
// Tab Area Border Appearance
float tab_area_border_focused[] = COLOR(0xc9b890ff); // color of the tab area border when focused
float tab_area_border_unfocused[] = COLOR(0x444444ff); // color of the tab area border when unfocused
uint32_t tab_area_border_size = 2; // Tab border thickness (pixels)
uint32_t tab_area_padding_width = 1; // Space between tab area border and tab's left/right borders
uint32_t tab_area_padding_height = 1; // Space between tab area border and tab's top/bottom borders
/* logging */
int32_t log_level = WLR_ERROR;
uint32_t numlockon = 0; // 是否打开右边小键盘

View file

@ -69,4 +69,8 @@ int32_t setoption(const Arg *arg);
int32_t disable_monitor(const Arg *arg);
int32_t enable_monitor(const Arg *arg);
int32_t toggle_monitor(const Arg *arg);
int32_t scroller_stack(const Arg *arg);
int32_t scroller_stack(const Arg *arg);
int32_t tab_switch_next(const Arg *arg);
int32_t tab_switch_prev(const Arg *arg);
int32_t tab_focus_first(const Arg *arg); // Switch to the first tab in the stack
int32_t tab_focus_last(const Arg *arg); // Switch to the last tab in the stack

View file

@ -930,3 +930,8 @@ void tgmix(Monitor *m) {
return;
}
}
void tab_layout(Monitor *m) {
monocle(m);
}

View file

@ -12,6 +12,7 @@ static void vertical_grid(Monitor *m);
static void vertical_scroller(Monitor *m);
static void vertical_deck(Monitor *mon);
static void tgmix(Monitor *m);
static void tab_layout(Monitor *m);
/* layout(s) */
Layout overviewlayout = {"󰃇", overview, "overview"};
@ -29,6 +30,7 @@ enum {
VERTICAL_DECK,
RIGHT_TILE,
TGMIX,
TAB,
};
Layout layouts[] = {
@ -47,4 +49,5 @@ Layout layouts[] = {
{"VG", vertical_grid, "vertical_grid", VERTICAL_GRID}, // 垂直格子布局
{"VK", vertical_deck, "vertical_deck", VERTICAL_DECK}, // 垂直卡片布局
{"TG", tgmix, "tgmix", TGMIX}, // 混合布局
};
{"TAB", tab_layout, "tab_layout", TAB},
};