Merge branch 'DreamMaoMao:main' into feat/add-config-flag

This commit is contained in:
Victor Tennekes 2025-11-25 12:56:56 +01:00 committed by GitHub
commit c1096642e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 63 additions and 19 deletions

View file

@ -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];

View file

@ -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);
}

View file

@ -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 &&
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;

View file

@ -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 &&
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;

View file

@ -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) {