diff options
| author | Abhinav <abhinav.prsai@gmail.com> | 2025-06-23 20:52:58 +0100 |
|---|---|---|
| committer | Abhinav <abhinav.prsai@gmail.com> | 2025-06-23 20:52:58 +0100 |
| commit | 4cd111d9d1356db27f6c90b9c95144f9c409ec54 (patch) | |
| tree | e0d1c92289ab6b0703fe6e99890468919628ad9e | |
| parent | 8f4933642e2f2616321dcf7dda4f409aa1f20115 (diff) | |
add new_win_master
new windows spawned can now be set as master window
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | default_sxwmrc | 1 | ||||
| -rw-r--r-- | src/defs.h | 1 | ||||
| -rw-r--r-- | src/parser.c | 3 | ||||
| -rw-r--r-- | src/sxwm.c | 17 | ||||
| -rw-r--r-- | sxwm.1 | 4 |
7 files changed, 23 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 320b2a5..ff3fe90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. - **NEW**: Can move windows between monitors via keyboard - **NEW**: Can click on a window to set focus to it - **NEW**: Window swallowing +- **NEW**: New windows can now open as master window - **CHANGE**: Renamed `focus_previous` to `focus_prev` - **CHANGE**: Invalid sample config - **CHANGE**: Parser `$HOME` searching order. XDG Compliance @@ -84,6 +84,7 @@ The file uses a `key : value` format. Lines starting with `#` are ignored. | `exec` | String | `Nothing` | Command to run on startup (e.g., `sxbar`, `picom`, "autostart", etc.). | | `can_swallow` | String | `st` | Windows that can swallow. | | `can_be_swallowed` | String | `mpv` | Windows that can be swallowed. | +| `new_win_master` | Bool | `false` | New windows will open as master window. | --- diff --git a/default_sxwmrc b/default_sxwmrc index 78ff91e..746912c 100644 --- a/default_sxwmrc +++ b/default_sxwmrc @@ -16,6 +16,7 @@ new_win_focus : true warp_cursor : true can_swallow : "st" can_be_swallowed : "mpv" +new_win_master : false # Keybinds: # Commands must be surrounded with "" @@ -91,6 +91,7 @@ typedef struct { int bindsn; Bool new_win_focus; Bool warp_cursor; + Bool new_win_master; Binding binds[256]; char **should_float[256]; char **can_swallow[256]; diff --git a/src/parser.c b/src/parser.c index 315013d..42c57df 100644 --- a/src/parser.c +++ b/src/parser.c @@ -439,6 +439,9 @@ found: token = strtok(NULL, ","); } } + else if (!strcmp(key, "new_win_master")) { + cfg->new_win_master = !strcmp(rest, "true") ? True : False; + } else { fprintf(stderr, "sxwmrc:%d: unknown option '%s'\n", lineno, key); } @@ -12,7 +12,7 @@ * will use this will probably be programmers :) * * (C) Abhinav Prasai 2025 - */ +*/ #include <X11/X.h> #include <err.h> @@ -173,11 +173,17 @@ Client *add_client(Window w, int ws) workspaces[ws] = c; } else { - Client *tail = workspaces[ws]; - while (tail->next) { - tail = tail->next; + if (user_config.new_win_master) { + c->next = workspaces[ws]; + workspaces[ws] = c; + } + else { + Client *tail = workspaces[ws]; + while (tail->next) { + tail = tail->next; + } + tail->next = c; } - tail->next = c; } open_windows++; @@ -1437,6 +1443,7 @@ void init_defaults(void) default_config.bindsn = 0; default_config.new_win_focus = True; default_config.warp_cursor = True; + default_config.new_win_master = False; if (backup_binds) { for (unsigned long i = 0; i < LENGTH(binds); i++) { @@ -110,6 +110,10 @@ Windows that can swallow other windows. Default is "st". .B can_be_swallowed Windows that can be swallowed by others. Default is "mpv". +.TP +.B new_win_as_master +New windows will take place as the master window + .SH KEYBINDINGS Keybindings associate key combinations with actions, either running external commands or internal sxwm functions. |
