根据配置为每个屏幕初始化 tags 属性

This commit is contained in:
2025-08-13 01:25:50 +08:00
parent 43ca95d2f4
commit 72151c1458
4 changed files with 86 additions and 10 deletions

View File

@@ -2,5 +2,27 @@
#include <stdint.h>
/* 壁纸列表,支持通配符和 shell 环境变量拼接,最后以 NULL 结尾 */
extern const char *wallpager_list[];
/* 壁纸切换间隔单位0 表示不切换 */
extern const uint32_t wallpaper_interval;
/**
* @brief 屏幕 tags 设置
* @description 每个屏幕的 tags 配置为字符串数组,以 NULL 结束,如
* {"1", "2", "3", "4", "5", "6", NULL}
*
* 每一项配置里面的数组个数表示对应的屏幕个数,并最后以 NULL 结束,
*
* 如一个屏幕应该配置为 {{"1", "2", "3", "4", NULL}, NULL}
* 两个屏幕应该配置为 {{"1", "2", "3", NULL}, {"1", "2", NULL}, NULL},以此类推
*/
extern const char *const *const *const monitor_tags[];
/**
* @brief 默认屏幕 tags 设置
* @description 若屏幕个数与 monitor_tags 中设置的所有配置项都不符,
* 则所有屏幕的 tags 都使用这个默认配置
*
* 格式为字符串数组,以 NULL 标志结束,如 {"1", "2", "3", NULL}
*/
extern const char *const default_monitor_tags[];

View File

@@ -11,8 +11,6 @@ typedef struct layout_t {
void (*arrange)(monitor_t *monitor);
} layout_t;
#define TAG_SYMBOL_LENGTH 32
/* 避免引入 xcb 头文件 */
typedef uint32_t xcb_window_t;
@@ -22,8 +20,7 @@ struct monitor_t {
uint32_t monitor_width, monitor_height, window_width, window_height;
uint32_t selected_tag;
uint32_t tag_count;
char (*tags)[TAG_SYMBOL_LENGTH];
char **tags;
/* 为了避免引入 cairo 相关头文件,这里用 void *
* 指针代替实际的指针类型,使用时强转为相应指针类型使用即可 */