.desktop: remove StartupWMClass from server, use distinct StartupWMClass for foot and footclient

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
This commit is contained in:
jdevdevdev 2023-05-02 01:53:01 +10:00 committed by Daniel Eklöf
parent f4b8e4f4d6
commit 134b54dfe0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
10 changed files with 19 additions and 13 deletions

View file

@ -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

View file

@ -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", &nots, &overrides, false);
bool ret = config_load(&original, "/dev/null", &nots, &overrides, false, false);
xassert(ret);
struct config *clone = config_clone(&original);

View file

@ -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);

View file

@ -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*

View file

@ -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.

View file

@ -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_.

View file

@ -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

2
main.c
View file

@ -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) {

View file

@ -9,4 +9,3 @@ Keywords=shell;prompt;command;commandline;
Name=Foot Server
GenericName=Terminal
Comment=A wayland native terminal emulator (server)
StartupWMClass=foot

View file

@ -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