add wayland specifier to session names (#162)

Create a config option to force ly to add " (Wayland)" to session
names, as long as those names don't already contain the string.
This commit is contained in:
Érico Nogueira Rolim 2020-02-03 03:20:47 -03:00 committed by GitHub
commit b2c1ef5c50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 0 deletions

View file

@ -95,6 +95,19 @@ void desktop_crawl(
strncat(path, dir_info->d_name, (sizeof (path)) - 1);
configator(&desktop_config, path);
// if these are wayland sessions, add " (Wayland)" to their names,
// as long as their names don't already contain that string
if (server == DS_WAYLAND && config.wayland_specifier)
{
const char wayland_specifier[] = " (Wayland)";
if (strstr(name, wayland_specifier) == NULL)
{
name = realloc(name, (strlen(name) + sizeof(wayland_specifier) + 1));
// using strcat is safe because the string is constant
strcat(name, wayland_specifier);
}
}
if ((name != NULL) && (exec != NULL))
{
input_desktop_add(target, name, exec, server);