feat: add show desktop and move window to workspace features

build: enhance security with stricter compiler flags and sanitizer build
refactor: replace standard memory functions with custom dwn_ variants
chore: remove unused wifi and dropdown menu code from systray
This commit is contained in:
2026-01-24 12:26:45 +00:00
parent a94ddfeda5
commit ff2e183e0d
33 changed files with 169 additions and 436 deletions
+14 -10
View File
@@ -244,9 +244,11 @@ static void add_to_recent(const char *desktop_id)
for (int i = 0; i < launcher_state.recent_count; i++) {
if (strcmp(launcher_state.recent[i], desktop_id) == 0) {
for (int j = i; j > 0; j--) {
strcpy(launcher_state.recent[j], launcher_state.recent[j-1]);
memcpy(launcher_state.recent[j], launcher_state.recent[j-1],
sizeof(launcher_state.recent[0]));
}
strcpy(launcher_state.recent[0], desktop_id);
snprintf(launcher_state.recent[0], sizeof(launcher_state.recent[0]),
"%s", desktop_id);
save_recent_apps();
return;
}
@@ -257,9 +259,11 @@ static void add_to_recent(const char *desktop_id)
}
for (int i = launcher_state.recent_count - 1; i > 0; i--) {
strcpy(launcher_state.recent[i], launcher_state.recent[i-1]);
memcpy(launcher_state.recent[i], launcher_state.recent[i-1],
sizeof(launcher_state.recent[0]));
}
strncpy(launcher_state.recent[0], desktop_id, sizeof(launcher_state.recent[0]) - 1);
snprintf(launcher_state.recent[0], sizeof(launcher_state.recent[0]),
"%s", desktop_id);
save_recent_apps();
}
@@ -330,16 +334,16 @@ void applauncher_show(void)
}
size_t buf_size = launcher_state.app_count * 140;
char *choices = malloc(buf_size);
char *choices = dwn_malloc(buf_size);
if (choices == NULL) {
LOG_ERROR("Failed to allocate memory for app list");
return;
}
choices[0] = '\0';
bool *added = calloc(launcher_state.app_count, sizeof(bool));
bool *added = dwn_calloc(launcher_state.app_count, sizeof(bool));
if (added == NULL) {
free(choices);
dwn_free(choices);
return;
}
@@ -379,19 +383,19 @@ void applauncher_show(void)
choices[pos-1] = '\0';
}
free(added);
dwn_free(added);
char tmp_path[] = "/tmp/dwn_apps_XXXXXX";
int tmp_fd = mkstemp(tmp_path);
if (tmp_fd < 0) {
free(choices);
dwn_free(choices);
LOG_ERROR("Failed to create temp file for app list");
return;
}
ssize_t written = write(tmp_fd, choices, strlen(choices));
close(tmp_fd);
free(choices);
dwn_free(choices);
if (written < 0) {
unlink(tmp_path);