mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-02 06:46:29 -04:00
Merge branch 'mangowm:main' into main
This commit is contained in:
commit
c00b05f306
2 changed files with 26 additions and 28 deletions
24
mangowm.scm
24
mangowm.scm
|
|
@ -15,7 +15,7 @@
|
||||||
#:use-module (gnu packages ninja)
|
#:use-module (gnu packages ninja)
|
||||||
#:use-module (gnu packages pkg-config)
|
#:use-module (gnu packages pkg-config)
|
||||||
#:use-module (guix build-system meson)
|
#:use-module (guix build-system meson)
|
||||||
#:use-module (guix licenses))
|
#:use-module ((guix licenses) #:prefix license:))
|
||||||
|
|
||||||
|
|
||||||
(define-public mangowm-git
|
(define-public mangowm-git
|
||||||
|
|
@ -36,10 +36,13 @@
|
||||||
(add-before 'configure 'patch-meson
|
(add-before 'configure 'patch-meson
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* "meson.build"
|
(substitute* "meson.build"
|
||||||
|
;; MangoWM ignores sysconfdir handling for NixOS.
|
||||||
|
;; We also need to skip that sysconfdir edits.
|
||||||
|
(("is_nixos = false")
|
||||||
|
"is_nixos = true")
|
||||||
|
;; Unhardcode path. Fixes loading default config.
|
||||||
(("'-DSYSCONFDIR=\\\"@0@\\\"'.format\\('/etc'\\)")
|
(("'-DSYSCONFDIR=\\\"@0@\\\"'.format\\('/etc'\\)")
|
||||||
"'-DSYSCONFDIR=\"@0@\"'.format(sysconfdir)")
|
"'-DSYSCONFDIR=\"@0@\"'.format(sysconfdir)")))))))
|
||||||
(("sysconfdir = sysconfdir.substring\\(prefix.length\\(\\)\\)")
|
|
||||||
"")))))))
|
|
||||||
(inputs (list wayland
|
(inputs (list wayland
|
||||||
libinput
|
libinput
|
||||||
libdrm
|
libdrm
|
||||||
|
|
@ -52,14 +55,17 @@
|
||||||
pcre2
|
pcre2
|
||||||
libxcb
|
libxcb
|
||||||
xcb-util-wm
|
xcb-util-wm
|
||||||
wlroots
|
wlroots-0.19
|
||||||
scenefx))
|
scenefx))
|
||||||
(native-inputs (list pkg-config wayland-protocols))
|
(native-inputs (list pkg-config wayland-protocols))
|
||||||
(home-page "https://github.com/DreamMaoMao/mangowm")
|
(home-page "https://github.com/mangowm/mango")
|
||||||
(synopsis "Wayland compositor based on wlroots and scenefx")
|
(synopsis "Wayland compositor based on wlroots and scenefx")
|
||||||
(description "A Wayland compositor based on wlroots and scenefx,
|
(description
|
||||||
inspired by dwl but aiming to be more feature-rich.")
|
"MangoWM is a modern, lightweight, high-performance Wayland compositor
|
||||||
(license gpl3)))
|
built on dwl — crafted for speed, flexibility, and a customizable desktop experience.")
|
||||||
|
(license (list license:gpl3 ;mangowm itself, dwl
|
||||||
|
license:expat ;dwm, sway, wlroots
|
||||||
|
license:cc0)))) ;tinywl
|
||||||
|
|
||||||
(define-deprecated-package mangowc
|
(define-deprecated-package mangowc
|
||||||
mangowm-git)
|
mangowm-git)
|
||||||
|
|
|
||||||
|
|
@ -913,7 +913,6 @@ int32_t spawn_shell(const Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spawn(const Arg *arg) {
|
int32_t spawn(const Arg *arg) {
|
||||||
|
|
||||||
if (!arg->v)
|
if (!arg->v)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -926,28 +925,21 @@ int32_t spawn(const Arg *arg) {
|
||||||
dup2(STDERR_FILENO, STDOUT_FILENO);
|
dup2(STDERR_FILENO, STDOUT_FILENO);
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
// 2. 解析参数
|
// 2. 对整个参数字符串进行单词展开
|
||||||
char *argv[64];
|
wordexp_t p;
|
||||||
int32_t argc = 0;
|
if (wordexp(arg->v, &p, 0) != 0) {
|
||||||
char *token = strtok((char *)arg->v, " ");
|
wlr_log(WLR_DEBUG, "mango: wordexp failed for '%s'\n", arg->v);
|
||||||
while (token != NULL && argc < 63) {
|
_exit(EXIT_FAILURE);
|
||||||
wordexp_t p;
|
|
||||||
if (wordexp(token, &p, 0) == 0) {
|
|
||||||
argv[argc++] = p.we_wordv[0];
|
|
||||||
} else {
|
|
||||||
argv[argc++] = token;
|
|
||||||
}
|
|
||||||
token = strtok(NULL, " ");
|
|
||||||
}
|
}
|
||||||
argv[argc] = NULL;
|
|
||||||
|
|
||||||
// 3. 执行命令
|
// 3. 执行命令(p.we_wordv 已经是 argv 数组)
|
||||||
execvp(argv[0], argv);
|
execvp(p.we_wordv[0], p.we_wordv);
|
||||||
|
|
||||||
// 4. execvp 失败时:打印错误并直接退出(避免 coredump)
|
// 4. execvp 失败时:打印错误,释放 wordexp 资源,然后退出
|
||||||
wlr_log(WLR_DEBUG, "mango: execvp '%s' failed: %s\n", argv[0],
|
wlr_log(WLR_DEBUG, "mango: execvp '%s' failed: %s\n", p.we_wordv[0],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
_exit(EXIT_FAILURE); // 使用 _exit 避免缓冲区刷新等操作
|
wordfree(&p); // 释放 wordexp 分配的内存
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue