Try to fix the value for XDG_SESSION_DESKTOP

This commit is contained in:
AnErrupTion 2022-04-20 00:37:27 +02:00
parent 56e1111e43
commit e741f386f1
2 changed files with 21 additions and 2 deletions

View File

@ -76,6 +76,7 @@ void handle_text(void* input_struct, struct tb_event* event)
void input_desktop(struct desktop* target)
{
target->list = NULL;
target->list_simple = NULL;
target->cmd = NULL;
target->display_server = NULL;
target->cur = 0;
@ -176,7 +177,8 @@ void input_desktop_add(
{
++(target->len);
target->list = realloc(target->list, target->len * (sizeof (char*)));
target->cmd = realloc(target->cmd, target->len * (sizeof (char*)));
target->list_simple = realloc(target->list_simple, target->len * (sizeof (char*)));
target->cmd = realloc(target->cmd, target->len * (sizeof (char*)));
target->display_server = realloc(
target->display_server,
target->len * (sizeof (enum display_server)));
@ -190,8 +192,24 @@ void input_desktop_add(
return;
}
int name_len = strlen(name);
target->list[target->cur] = name;
target->cmd[target->cur] = cmd;
char* name_simple;
*name_simple = *name;
if (strstr(name_simple, " ") != NULL)
{
name_simple = strtok(name_simple, " ");
}
for (int i = 0; i < name_len; i++)
{
name_simple[i] = tolower(name_simple[i]);
}
target->list_simple[target->cur] = name_simple;
target->cmd[target->cur] = cmd;
target->display_server[target->cur] = display_server;
}

View File

@ -23,6 +23,7 @@ struct text
struct desktop
{
char** list;
char** list_simple;
char** cmd;
enum display_server* display_server;