调整配置结构并添加 client 规则配置
This commit is contained in:
15
src/main.c
15
src/main.c
@@ -19,7 +19,7 @@ static char **get_monitor_tags(uint32_t monitor_count, uint32_t monitor_index);
|
||||
static void init_wallpaper(void);
|
||||
static gboolean update_wallpaper(gpointer user_data);
|
||||
static void set_wallpaper_by_index(uint32_t index);
|
||||
static wallpaper_config_t *parse_wallpaper_config(const char **wallpapers);
|
||||
static wallpaper_config_t *parse_wallpaper_config(void);
|
||||
static void free_wallpaper_config(wallpaper_config_t *wallpaper_config);
|
||||
static void init_xcb_event_loop(void);
|
||||
static gboolean handle_xcb_event(GIOChannel *channel, GIOCondition condition,
|
||||
@@ -98,14 +98,11 @@ void init_monitors(void) {
|
||||
}
|
||||
|
||||
char **get_monitor_tags(uint32_t monitor_count, uint32_t monitor_index) {
|
||||
int config_count = 0;
|
||||
while (monitor_tags[config_count]) config_count++;
|
||||
|
||||
GStrvBuilder *builder = g_strv_builder_new();
|
||||
const char *const *tags = NULL;
|
||||
|
||||
/* 倒序遍历,达到后面的配置覆盖前面相同配置的效果 */
|
||||
for (int i = config_count - 1; i >= 0; i--) {
|
||||
for (int i = LENGTH(monitor_tags) - 1; i >= 0; i--) {
|
||||
const char *const *const *config = monitor_tags[i];
|
||||
|
||||
uint32_t monitor_count_in_tags_config = 0;
|
||||
@@ -128,7 +125,7 @@ char **get_monitor_tags(uint32_t monitor_count, uint32_t monitor_index) {
|
||||
}
|
||||
|
||||
void init_wallpaper(void) {
|
||||
wallpaper_config = parse_wallpaper_config(wallpager_list);
|
||||
wallpaper_config = parse_wallpaper_config();
|
||||
if (!wallpaper_config) return;
|
||||
|
||||
update_wallpaper(wallpaper_config);
|
||||
@@ -171,13 +168,13 @@ void set_wallpaper_by_index(uint32_t index) {
|
||||
free(screen_size);
|
||||
}
|
||||
|
||||
wallpaper_config_t *parse_wallpaper_config(const char **wallpapers) {
|
||||
if (!wallpapers) return NULL;
|
||||
wallpaper_config_t *parse_wallpaper_config(void) {
|
||||
if (!LENGTH(wallpapers)) return NULL;
|
||||
|
||||
wallpaper_config_t *wc = ecalloc(1, sizeof(wallpaper_config_t));
|
||||
|
||||
GStrvBuilder *builder = g_strv_builder_new();
|
||||
for (int i = 0; wallpapers && wallpapers[i]; i++) {
|
||||
for (int i = 0; i < LENGTH(wallpapers); i++) {
|
||||
wordexp_t p;
|
||||
if (wordexp(wallpapers[i], &p, 0)) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user