From 250b499c1d557f442efeb377ea5fe3d2fb0e47ae Mon Sep 17 00:00:00 2001 From: jdevdevdev Date: Sun, 14 May 2023 21:19:49 +1000 Subject: [PATCH] *.desktop: Update to allow footclient and foot to track running instances as separate icons in gnome. Make windows spawned from Server mode have the app-id of footclient. Make sure that foot.ini app-id settings are respected. Change StartupWMClass to footclient from foot to track app-id change. --- config.c | 7 ++++--- config.h | 3 ++- main.c | 5 +---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/config.c b/config.c index 2ede1aa5..94bf69f9 100644 --- a/config.c +++ b/config.c @@ -2889,7 +2889,8 @@ config_font_list_clone(struct config_font_list *dst, bool config_load(struct config *conf, const char *conf_path, user_notifications_t *initial_user_notifications, - config_override_t *overrides, bool errors_are_fatal) + config_override_t *overrides, bool errors_are_fatal, + bool as_server) { bool ret = false; enum fcft_capabilities fcft_caps = fcft_capabilities(); @@ -2898,7 +2899,7 @@ config_load(struct config *conf, const char *conf_path, .term = xstrdup(FOOT_DEFAULT_TERM), .shell = get_shell(), .title = xstrdup("foot"), - .app_id = xstrdup("foot"), + .app_id = (as_server ? xstrdup("footclient") : xstrdup("foot")), .word_delimiters = xc32dup(U",│`|:\"'()[]{}<>"), .size = { .type = CONF_SIZE_PX, @@ -3329,7 +3330,7 @@ UNITTEST user_notifications_t nots = tll_init(); config_override_t overrides = tll_init(); - bool ret = config_load(&original, "/dev/null", ¬s, &overrides, false); + bool ret = config_load(&original, "/dev/null", ¬s, &overrides, false, false); xassert(ret); struct config *clone = config_clone(&original); diff --git a/config.h b/config.h index 31dddc64..d6ae4fa6 100644 --- a/config.h +++ b/config.h @@ -355,7 +355,8 @@ bool config_override_apply(struct config *conf, config_override_t *overrides, bool config_load( struct config *conf, const char *path, user_notifications_t *initial_user_notifications, - config_override_t *overrides, bool errors_are_fatal); + config_override_t *overrides, bool errors_are_fatal, + bool as_server); void config_free(struct config *conf); struct config *config_clone(const struct config *old); diff --git a/main.c b/main.c index d4d40d91..48d60830 100644 --- a/main.c +++ b/main.c @@ -487,7 +487,7 @@ main(int argc, char *const *argv) struct config conf = {NULL}; bool conf_successful = config_load( - &conf, conf_path, &user_notifications, &overrides, check_config); + &conf, conf_path, &user_notifications, &overrides, check_config, as_server); tll_free(overrides); if (!conf_successful) { @@ -521,9 +521,6 @@ main(int argc, char *const *argv) if (conf_app_id != NULL) { free(conf.app_id); conf.app_id = xstrdup(conf_app_id); - } else if (as_server) { - free(conf.app_id); - conf.app_id = xstrdup("footclient"); } if (login_shell) conf.login_shell = true;