mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-05 06:47:12 -04:00
Merge branch 'DreamMaoMao:main' into feat/add-config-flag
This commit is contained in:
commit
c1096642e0
5 changed files with 63 additions and 19 deletions
|
|
@ -26,6 +26,25 @@ in {
|
||||||
xdg.portal = {
|
xdg.portal = {
|
||||||
enable = lib.mkDefault true;
|
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;
|
wlr.enable = lib.mkDefault true;
|
||||||
|
|
||||||
configPackages = [cfg.package];
|
configPackages = [cfg.package];
|
||||||
|
|
|
||||||
|
|
@ -2274,35 +2274,53 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
|
|
||||||
void parse_config_file(Config *config, const char *file_path) {
|
void parse_config_file(Config *config, const char *file_path) {
|
||||||
FILE *file;
|
FILE *file;
|
||||||
// 检查路径是否以 ~/ 开头
|
char full_path[1024];
|
||||||
if (file_path[0] == '~' && (file_path[1] == '/' || file_path[1] == '\0')) {
|
|
||||||
|
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");
|
const char *home = getenv("HOME");
|
||||||
if (!home) {
|
if (!home) {
|
||||||
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建完整路径(家目录 + / + 原路径去掉 ~)
|
|
||||||
char full_path[1024];
|
|
||||||
snprintf(full_path, sizeof(full_path), "%s%s", home, file_path + 1);
|
snprintf(full_path, sizeof(full_path), "%s%s", home, file_path + 1);
|
||||||
|
|
||||||
file = fopen(full_path, "r");
|
file = fopen(full_path, "r");
|
||||||
if (!file) {
|
|
||||||
perror("Error opening file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
// Absolute path
|
||||||
file = fopen(file_path, "r");
|
file = fopen(file_path, "r");
|
||||||
if (!file) {
|
}
|
||||||
perror("Error opening file");
|
|
||||||
return;
|
if (!file) {
|
||||||
}
|
perror("Error opening file");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char line[512];
|
char line[512];
|
||||||
while (fgets(line, sizeof(line), file)) {
|
while (fgets(line, sizeof(line), file)) {
|
||||||
if (line[0] == '#' || line[0] == '\n')
|
if (line[0] == '#' || line[0] == '\n') {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
parse_config_line(config, line);
|
parse_config_line(config, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -301,8 +301,7 @@ void scroller(Monitor *m) {
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
c = tempClients[i];
|
c = tempClients[i];
|
||||||
if (root_client == c) {
|
if (root_client == c) {
|
||||||
if (!c->is_pending_open_animation &&
|
if (c->geom.x >= m->w.x + scroller_structs &&
|
||||||
c->geom.x >= m->w.x + scroller_structs &&
|
|
||||||
c->geom.x + c->geom.width <=
|
c->geom.x + c->geom.width <=
|
||||||
m->w.x + m->w.width - scroller_structs) {
|
m->w.x + m->w.width - scroller_structs) {
|
||||||
need_scroller = false;
|
need_scroller = false;
|
||||||
|
|
|
||||||
|
|
@ -263,8 +263,7 @@ void vertical_scroller(Monitor *m) {
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
c = tempClients[i];
|
c = tempClients[i];
|
||||||
if (root_client == c) {
|
if (root_client == c) {
|
||||||
if (!c->is_pending_open_animation &&
|
if (c->geom.y >= m->w.y + scroller_structs &&
|
||||||
c->geom.y >= m->w.y + scroller_structs &&
|
|
||||||
c->geom.y + c->geom.height <=
|
c->geom.y + c->geom.height <=
|
||||||
m->w.y + m->w.height - scroller_structs) {
|
m->w.y + m->w.height - scroller_structs) {
|
||||||
need_scroller = false;
|
need_scroller = false;
|
||||||
|
|
|
||||||
|
|
@ -2210,6 +2210,15 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
// 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面
|
// 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面
|
||||||
arrangelayers(l->mon);
|
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) {
|
void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue