From 134b54dfe0e4d142ac4b6b7fe25e84485ba63387 Mon Sep 17 00:00:00 2001 From: jdevdevdev Date: Tue, 2 May 2023 01:53:01 +1000 Subject: [PATCH] .desktop: remove StartupWMClass from server, use distinct StartupWMClass for foot and footclient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For this to work, the default app-id of footclient has been changed from ‘foot’ to ‘footclient’. By using distinct StartupWMClasses, the compositor can connect a running foot/footclient instance to the correct .desktop-file. This ensures the correct icon is being used in e.g. docks, and that actions like “open another window” works correctly. Note that the user can override the app-id, either by setting app-id in foot.ini, or with the -a,--app-id command line option. Closes #1355 --- CHANGELOG.md | 5 ++++- config.c | 7 ++++--- config.h | 3 ++- doc/foot.1.scd | 2 +- doc/foot.ini.5.scd | 6 ++++-- doc/footclient.1.scd | 2 +- foot.ini | 2 +- main.c | 2 +- org.codeberg.dnkl.foot-server.desktop | 1 - org.codeberg.dnkl.footclient.desktop | 2 +- 10 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b4df58..4c8245b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,6 @@ * Meson option `default-utempter-path` renamed to `utmp-default-helper-path`. - ### Deprecated * `[main].utempter` option. @@ -75,8 +74,12 @@ * Crash when scrolling after resizing the window with non-zero scrolling regions. * `XTMODKEYS` state not being reset on a terminal reset. +* In Gnome dock foot always groups under "foot client". Change + instances of footclient and foot to appear as "foot client" and + "foot" respectively. ([#1355][1355]) [1317]: https://codeberg.org/dnkl/foot/issues/1317 +[1355]: https://codeberg.org/dnkl/foot/issues/1355 ### Security diff --git a/config.c b/config.c index c3ab61e2..1d9f200b 100644 --- a/config.c +++ b/config.c @@ -2905,7 +2905,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(); @@ -2914,7 +2915,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, @@ -3348,7 +3349,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 34517019..ce1ee536 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/doc/foot.1.scd b/doc/foot.1.scd index 6f63d4c8..60420bef 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -65,7 +65,7 @@ the foot command line *-a*,*--app-id*=_ID_ Value to set the *app-id* property on the Wayland window - to. Default: _foot_. + to. Default: _foot_ (normal mode), or _footclient_ (server mode). *-m*,*--maximized* Start in maximized mode. If both *--maximized* and *--fullscreen* diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 6a820892..32c493be 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -289,7 +289,8 @@ empty string to be set, but it must be quoted: *KEY=""*) *app-id* Value to set the *app-id* property on the Wayland window to. The compositor can use this value to e.g. group multiple windows, or - apply window management rules. Default: _foot_. + apply window management rules. Default: _foot_ (normal mode), or + _footclient_ (server mode). *bold-text-in-bright* Semi-boolean. When enabled, bold text is rendered in a brighter @@ -314,7 +315,8 @@ empty string to be set, but it must be quoted: *KEY=""*) and _body_ (message content). _${app-id}_ is replaced with the value of the command line option - _--app-id_, and defaults to *foot*. + _--app-id_, and defaults to *foot* (normal mode), or + *footclient* (server mode). _${window-title}_ is replaced with the current window title. diff --git a/doc/footclient.1.scd b/doc/footclient.1.scd index 63235134..1464700c 100644 --- a/doc/footclient.1.scd +++ b/doc/footclient.1.scd @@ -31,7 +31,7 @@ terminal has terminated. *-a*,*--app-id*=_ID_ Value to set the *app-id* property on the Wayland window - to. Default: _foot_. + to. Default: _foot_ (normal mode), or _footclient_ (server mode). *-w*,*--window-size-pixels*=_WIDTHxHEIGHT_ Set initial window width and height, in pixels. Default: _700x500_. diff --git a/foot.ini b/foot.ini index 4b2218a4..fcaef4a9 100644 --- a/foot.ini +++ b/foot.ini @@ -4,7 +4,7 @@ # term=foot (or xterm-256color if built with -Dterminfo=disabled) # login-shell=no -# app-id=foot +# app-id=foot # globally set wayland app-id. Default values are "foot" and "footclient" for desktop and server mode # title=foot # locked-title=no diff --git a/main.c b/main.c index 4af200fd..3f9846f3 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) { diff --git a/org.codeberg.dnkl.foot-server.desktop b/org.codeberg.dnkl.foot-server.desktop index a40117c7..6e8891c0 100644 --- a/org.codeberg.dnkl.foot-server.desktop +++ b/org.codeberg.dnkl.foot-server.desktop @@ -9,4 +9,3 @@ Keywords=shell;prompt;command;commandline; Name=Foot Server GenericName=Terminal Comment=A wayland native terminal emulator (server) -StartupWMClass=foot diff --git a/org.codeberg.dnkl.footclient.desktop b/org.codeberg.dnkl.footclient.desktop index dc8bc5dc..b65790b4 100644 --- a/org.codeberg.dnkl.footclient.desktop +++ b/org.codeberg.dnkl.footclient.desktop @@ -9,4 +9,4 @@ Keywords=shell;prompt;command;commandline; Name=Foot Client GenericName=Terminal Comment=A wayland native terminal emulator (client) -StartupWMClass=foot +StartupWMClass=footclient