So, I started sending a lot of commands to dvtm via the command fifo and
I noticed an odd thing.

Every window exposes a variable called $DVTM_WINDOW_ID, so one can
imagine that if you want to focus on a window you should just pass the
command 'focusn 1' where 1 would be the id of that window.

What happens is something different than this and somewhat confusing.

Maybe there's a reason for it being that way, I don't know if this is a
design decision or a bug.

In any case: I attached a patch that changes the focus command to
use the window id, so that the focus command is invariant in respect to
layout changes and scripts have a better api to interact with.
diff --git a/dvtm.c b/dvtm.c
index 71ffccb..055d982 100644
--- a/dvtm.c
+++ b/dvtm.c
@@ -787,7 +787,7 @@ copymode(const char *args[]) {
 static void
 focusn(const char *args[]) {
 	for (Client *c = clients; c; c = c->next) {
-		if (c->order == atoi(args[0])) {
+		if (c->id == atoi(args[0])) {
 			focus(c);
 			if (c->minimized)
 				toggleminimize(NULL);

Reply via email to