From e22cf99e742bfc93f73c862b351ee2557f20b1ab Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 20 Nov 2025 10:34:32 +0800 Subject: [PATCH 1/5] feat: support relative path for source keyword --- src/config/parse_config.h | 48 +++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/config/parse_config.h b/src/config/parse_config.h index d7b32234..a58a106f 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -2274,35 +2274,53 @@ void parse_config_line(Config *config, const char *line) { void parse_config_file(Config *config, const char *file_path) { FILE *file; - // 检查路径是否以 ~/ 开头 - if (file_path[0] == '~' && (file_path[1] == '/' || file_path[1] == '\0')) { + char full_path[1024]; + + if (file_path[0] == '.' && file_path[1] == '/') { + // Relative path + + const char *mangoconfig = getenv("MANGOCONFIG"); + if (mangoconfig && mangoconfig[0] != '\0') { + snprintf(full_path, sizeof(full_path), "%s/%s", mangoconfig, + file_path + 1); + } else { + const char *home = getenv("HOME"); + if (!home) { + fprintf(stderr, "Error: HOME environment variable not set.\n"); + return; + } + snprintf(full_path, sizeof(full_path), "%s/.config/mango/%s", home, + file_path + 1); + } + file = fopen(full_path, "r"); + + } else if (file_path[0] == '~' && + (file_path[1] == '/' || file_path[1] == '\0')) { + // Home directory + const char *home = getenv("HOME"); if (!home) { fprintf(stderr, "Error: HOME environment variable not set.\n"); return; } - - // 构建完整路径(家目录 + / + 原路径去掉 ~) - char full_path[1024]; snprintf(full_path, sizeof(full_path), "%s%s", home, file_path + 1); - file = fopen(full_path, "r"); - if (!file) { - perror("Error opening file"); - return; - } + } else { + // Absolute path file = fopen(file_path, "r"); - if (!file) { - perror("Error opening file"); - return; - } + } + + if (!file) { + perror("Error opening file"); + return; } char line[512]; while (fgets(line, sizeof(line), file)) { - if (line[0] == '#' || line[0] == '\n') + if (line[0] == '#' || line[0] == '\n') { continue; + } parse_config_line(config, line); } From e7cb4f77f37c3ebb15bcd803adcadd9d64f92039 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 20 Nov 2025 21:21:29 +0800 Subject: [PATCH 2/5] fix: wrong scroll judge when disable animaitons --- src/layout/horizontal.h | 2 +- src/layout/vertical.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index ff517cc1..99bb0926 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -301,7 +301,7 @@ void scroller(Monitor *m) { for (i = 0; i < n; i++) { c = tempClients[i]; if (root_client == c) { - if (!c->is_pending_open_animation && + if ((!c->is_pending_open_animation || !animations) && c->geom.x >= m->w.x + scroller_structs && c->geom.x + c->geom.width <= m->w.x + m->w.width - scroller_structs) { diff --git a/src/layout/vertical.h b/src/layout/vertical.h index cef0e3bb..5cc8ceb1 100644 --- a/src/layout/vertical.h +++ b/src/layout/vertical.h @@ -263,7 +263,7 @@ void vertical_scroller(Monitor *m) { for (i = 0; i < n; i++) { c = tempClients[i]; if (root_client == c) { - if (!c->is_pending_open_animation && + if ((!c->is_pending_open_animation || !animations) && c->geom.y >= m->w.y + scroller_structs && c->geom.y + c->geom.height <= m->w.y + m->w.height - scroller_structs) { From a0824c05df5482fde37898b9a5d81f779167b60e Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 20 Nov 2025 22:47:12 +0800 Subject: [PATCH 3/5] opt: optimize scroll judge when open new client --- src/layout/horizontal.h | 3 +-- src/layout/vertical.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index 99bb0926..2385c848 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -301,8 +301,7 @@ void scroller(Monitor *m) { for (i = 0; i < n; i++) { c = tempClients[i]; if (root_client == c) { - if ((!c->is_pending_open_animation || !animations) && - c->geom.x >= m->w.x + scroller_structs && + if (c->geom.x >= m->w.x + scroller_structs && c->geom.x + c->geom.width <= m->w.x + m->w.width - scroller_structs) { need_scroller = false; diff --git a/src/layout/vertical.h b/src/layout/vertical.h index 5cc8ceb1..7eb95291 100644 --- a/src/layout/vertical.h +++ b/src/layout/vertical.h @@ -263,8 +263,7 @@ void vertical_scroller(Monitor *m) { for (i = 0; i < n; i++) { c = tempClients[i]; if (root_client == c) { - if ((!c->is_pending_open_animation || !animations) && - c->geom.y >= m->w.y + scroller_structs && + if (c->geom.y >= m->w.y + scroller_structs && c->geom.y + c->geom.height <= m->w.y + m->w.height - scroller_structs) { need_scroller = false; From 03ee277ef604639e623a2c7a5cbafa7ecf3c76d4 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Fri, 21 Nov 2025 14:50:27 +0800 Subject: [PATCH 4/5] opt: allow init focus to on-demand-focus layer --- src/mango.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mango.c b/src/mango.c index 540a0257..8a27b751 100644 --- a/src/mango.c +++ b/src/mango.c @@ -2210,6 +2210,15 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) { } // 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面 arrangelayers(l->mon); + + // 按需交互layer需要像正常窗口一样抢占非独占layer的焦点 + if (!exclusive_focus && + l->layer_surface->current.keyboard_interactive == + ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) { + focusclient(NULL, 0); + client_notify_enter(l->layer_surface->surface, + wlr_seat_get_keyboard(seat)); + } } void commitlayersurfacenotify(struct wl_listener *listener, void *data) { From c004f7460c48a5c317df1ec2b4cb4ed6c3ca57a6 Mon Sep 17 00:00:00 2001 From: David Delarosa Date: Thu, 20 Nov 2025 14:40:34 +0200 Subject: [PATCH 5/5] nix: add portals.conf file --- nix/nixos-modules.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nix/nixos-modules.nix b/nix/nixos-modules.nix index 5d0aa61e..33811022 100644 --- a/nix/nixos-modules.nix +++ b/nix/nixos-modules.nix @@ -26,6 +26,25 @@ in { xdg.portal = { enable = lib.mkDefault true; + config = { + mango = { + default = [ + "gtk" + ]; + # except those + "org.freedesktop.impl.portal.Secret" = ["gnome-keyring"]; + "org.freedesktop.impl.portal.ScreenCast" = ["wlr"]; + "org.freedesktop.impl.portal.ScreenShot" = ["wlr"]; + + # wlr does not have this interface + "org.freedesktop.impl.portal.Inhibit" = []; + }; + }; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + wlr.enable = lib.mkDefault true; configPackages = [cfg.package];