调整配置结构并添加 client 规则配置

This commit is contained in:
2025-08-13 21:26:40 +08:00
parent 72151c1458
commit e78c847125
6 changed files with 85 additions and 61 deletions

60
src/config.h Normal file
View File

@@ -0,0 +1,60 @@
#pragma once
#include <stdint.h>
#include <stdio.h>
#include "types.h"
/* 壁纸列表,支持通配符和 shell 环境变量拼接,最后以 NULL 结尾 */
const char *wallpapers[] = {};
/* 壁纸切换间隔单位0 表示不切换 */
const uint32_t wallpaper_interval = 0;
/**
* @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},以此类推
*/
const char *const *const *const monitor_tags[] = {
(const char *const *const[]){
(const char *const[]){"1", "2", "3", "4", "5", "6", NULL},
NULL,
},
(const char *const *const[]){
(const char *const[]){"1", "2", "3", NULL},
(const char *const[]){"1", "2", "3", "4", "5", NULL},
NULL,
},
};
/**
* @brief 默认屏幕 tags 设置
* @description 若屏幕个数与 monitor_tags 中设置的所有配置项都不符,
* 则所有屏幕的 tags 都使用这个默认配置
*
* 格式为字符串数组,以 NULL 标志结束,如 {"1", "2", "3", NULL}
*/
const char *const default_monitor_tags[] = {
"1", "2", "3", "4", "5", "6", "7", "8", "9", NULL,
};
/* 新建窗口规则,以 NULL 结束 */
const rule_t rules[] = {
/* client 固定规则 */
{.class = "firefox", .maximize = true},
{.class = "Google-chrome", .maximize = true},
{.class = "mpv", .fullscreen = true},
{.class = "Emacs", .switch_to_tag = true, .maximize = true},
/* client 默认 tag 规则 */
{.class = "firefox", .monitor_index = 0, .tags = 1 << 1},
{.class = "Google-chrome", .monitor_index = 0, .tags = 1 << 1},
{.class = "mpv", .monitor_amount = 1, .monitor_index = 0, .tags = 1 << 3},
{.class = "mpv", .monitor_amount = 2, .monitor_index = 1, .tags = 1 << 2},
{.class = "Emacs", .monitor_amount = 1, .monitor_index = 0, .tags = 1 << 2},
{.class = "Emacs", .monitor_amount = 2, .monitor_index = 0, .tags = 1 << 1},
};