summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAbhinav <abhinav.prsai@gmail.com>2025-06-23 20:52:58 +0100
committerAbhinav <abhinav.prsai@gmail.com>2025-06-23 20:52:58 +0100
commit4cd111d9d1356db27f6c90b9c95144f9c409ec54 (patch)
treee0d1c92289ab6b0703fe6e99890468919628ad9e /src
parent8f4933642e2f2616321dcf7dda4f409aa1f20115 (diff)
add new_win_master
new windows spawned can now be set as master window
Diffstat (limited to 'src')
-rw-r--r--src/defs.h1
-rw-r--r--src/parser.c3
-rw-r--r--src/sxwm.c17
3 files changed, 16 insertions, 5 deletions
diff --git a/src/defs.h b/src/defs.h
index a0e06f2..ae60c94 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -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);
}
diff --git a/src/sxwm.c b/src/sxwm.c
index b223207..7b35b09 100644
--- a/src/sxwm.c
+++ b/src/sxwm.c
@@ -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++) {