break change: remove autostar.sh and MANGOCONFIG env
This commit is contained in:
@@ -2307,17 +2307,12 @@ void parse_config_file(Config *config, const char *file_path) {
|
||||
if (file_path[0] == '.' && file_path[1] == '/') {
|
||||
// Relative path
|
||||
|
||||
const char *mangoconfig = getenv("MANGOCONFIG");
|
||||
|
||||
if (cli_config_path) {
|
||||
char *config_path = strdup(cli_config_path);
|
||||
char *config_dir = dirname(config_path);
|
||||
snprintf(full_path, sizeof(full_path), "%s/%s", config_dir,
|
||||
file_path + 1);
|
||||
free(config_path);
|
||||
} else 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) {
|
||||
@@ -3044,13 +3039,9 @@ void parse_config(void) {
|
||||
|
||||
create_config_keymap();
|
||||
|
||||
// 获取 MANGOCONFIG 环境变量
|
||||
const char *mangoconfig = getenv("MANGOCONFIG");
|
||||
|
||||
// 如果 MANGOCONFIG 环境变量不存在或为空,则使用 HOME 环境变量
|
||||
if (cli_config_path) {
|
||||
snprintf(filename, sizeof(filename), "%s", cli_config_path);
|
||||
} else if (!mangoconfig || mangoconfig[0] == '\0') {
|
||||
} else {
|
||||
// 获取当前用户家目录
|
||||
const char *homedir = getenv("HOME");
|
||||
if (!homedir) {
|
||||
@@ -3067,9 +3058,6 @@ void parse_config(void) {
|
||||
snprintf(filename, sizeof(filename), "%s/mango/config.conf",
|
||||
SYSCONFDIR);
|
||||
}
|
||||
} else {
|
||||
// 使用 MANGOCONFIG 环境变量作为配置文件夹路径
|
||||
snprintf(filename, sizeof(filename), "%s/config.conf", mangoconfig);
|
||||
}
|
||||
|
||||
set_value_default();
|
||||
|
||||
@@ -26,29 +26,6 @@ int isdescprocess(pid_t p, pid_t c) {
|
||||
return (int)c;
|
||||
}
|
||||
|
||||
char *get_autostart_path(char *autostart_path, uint32_t buf_size) {
|
||||
const char *mangoconfig = getenv("MANGOCONFIG");
|
||||
|
||||
if (cli_config_path) {
|
||||
char *config_path = strdup(cli_config_path);
|
||||
char *config_dir = dirname(config_path);
|
||||
snprintf(autostart_path, buf_size, "%s/autostart.sh", config_dir);
|
||||
free(config_path);
|
||||
} else if (mangoconfig && mangoconfig[0] != '\0') {
|
||||
snprintf(autostart_path, buf_size, "%s/autostart.sh", mangoconfig);
|
||||
} else {
|
||||
const char *homedir = getenv("HOME");
|
||||
if (!homedir) {
|
||||
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
||||
return NULL;
|
||||
}
|
||||
snprintf(autostart_path, buf_size, "%s/.config/mango/autostart.sh",
|
||||
homedir);
|
||||
}
|
||||
|
||||
return autostart_path;
|
||||
}
|
||||
|
||||
void get_layout_abbr(char *abbr, const char *full_name) {
|
||||
// 清空输出缓冲区
|
||||
abbr[0] = '\0';
|
||||
|
||||
@@ -536,7 +536,6 @@ arrange(Monitor *m,
|
||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||
struct wlr_box *usable_area, int exclusive);
|
||||
static void arrangelayers(Monitor *m);
|
||||
static char *get_autostart_path(char *, uint32_t); // 自启动命令执行
|
||||
static void handle_print_status(struct wl_listener *listener, void *data);
|
||||
static void axisnotify(struct wl_listener *listener,
|
||||
void *data); // 滚轮事件处理
|
||||
@@ -4369,7 +4368,6 @@ run(char *startup_cmd) {
|
||||
|
||||
set_env();
|
||||
|
||||
char autostart_temp_path[1024];
|
||||
/* Add a Unix socket to the Wayland display. */
|
||||
const char *socket = wl_display_add_socket_auto(dpy);
|
||||
if (!socket)
|
||||
@@ -4383,9 +4381,7 @@ run(char *startup_cmd) {
|
||||
|
||||
/* Now that the socket exists and the backend is started, run the
|
||||
* startup command */
|
||||
if (!startup_cmd)
|
||||
startup_cmd = get_autostart_path(autostart_temp_path,
|
||||
sizeof(autostart_temp_path));
|
||||
|
||||
if (startup_cmd) {
|
||||
int piperw[2];
|
||||
if (pipe(piperw) < 0)
|
||||
|
||||
Reference in New Issue
Block a user