diff options
| author | uint23 <72694427+uint23@users.noreply.github.com> | 2025-05-18 12:57:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-18 12:57:37 +0100 |
| commit | 6d9bf1e70d660ee0f8d2c6c6fa8c8b8e989d6b93 (patch) | |
| tree | 7304a4453413f55667728f0078a230be1719f07f /src/parser.c | |
| parent | 29486b974b1f902254e1520fcc455fbda5e274d7 (diff) | |
| parent | a275a4a1b10f3939cbc9d0179298268c817b8f22 (diff) | |
Merge pull request #22 from werdl/main
Floating window toggle
Diffstat (limited to 'src/parser.c')
| -rw-r--r-- | src/parser.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c index de63e8d..1ceb7e0 100644 --- a/src/parser.c +++ b/src/parser.c @@ -169,6 +169,12 @@ found: char line[512]; int lineno = 0; + int should_floatn = 0; + + for (int i = 0; i < 256; i++) { + cfg->should_float[i] = NULL; + } + while (fgets(line, sizeof line, f)) { lineno++; char *s = strip(line); @@ -221,6 +227,25 @@ found: else if (!strcmp(key, "snap_distance")) { cfg->snap_distance = atoi(rest); } + else if (!strcmp(key, "should_float")) { + // should_float: <window> + + if (should_floatn >= 256) { + fprintf(stderr, "sxwmrc:%d: too many should_float entries\n", lineno); + continue; + } + + char *win = strip(rest); + + cfg->should_float[should_floatn] = malloc(strlen(win) + 1); + if (!cfg->should_float[should_floatn]) { + fprintf(stderr, "sxwmrc:%d: out of memory\n", lineno); + break; + } + + strcpy(cfg->should_float[should_floatn], win); + should_floatn++; + } else if (!strcmp(key, "call") || !strcmp(key, "bind")) { char *mid = strchr(rest, ':'); if (!mid) { |
