Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,19 @@ static char *get_config_path(void) {
return NULL;
}

static void trim_end(char *str) {
if (strlen(str) == 0) {
return;
}

char* end = str + strlen(str) - 1;
while (end > str && isspace((unsigned char)*end)) {
end--;
}

*(end + 1) = '\0';
}

static int load_config(char *path, struct swaylock_state *state,
enum line_mode *line_mode) {
FILE *config = fopen(path, "r");
Expand All @@ -1043,6 +1056,8 @@ static int load_config(char *path, struct swaylock_state *state,
continue;
}

trim_end(line);

swaylock_log(LOG_DEBUG, "Config Line #%d: %s", line_number, line);
char *flag = malloc(nread + 3);
if (flag == NULL) {
Expand Down