Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please help me implement this feature: Swap window with master if window is sent to the same workspace. #423

Open
adityadesaha opened this issue Jan 14, 2021 · 1 comment

Comments

@adityadesaha
Copy link

I want to make it so that if a window is sent to the same workspace that it is in, then the window is swapped to the main window. I am not very familiar with the code base, but I think the function swapwin() does that. I guess I have to add something here, in spectrwm.c, in function void win_to_ws(). I can see that I should add something in the following block, inside win_to_ws(), before the return statement:

	if (win->ws->idx == wsid) {
		DNPRINTF(SWM_D_MOVE, "win %#x already on ws %d\n",
		    win->id, wsid);
		return;
	}

Can anyone help me with this? I have already tried the following, and it doesn't work:

	if (win->ws->idx == wsid) {
		DNPRINTF(SWM_D_MOVE, "win %#x already on ws %d\n",
		    win->id, wsid);

                union arg a;
                a.id=SWM_ARG_ID_SWAPMAIN;
                swapwin(NULL, win->ws->r, &a);

		return;
	}

Sorry if I'm doing something stupid.

@chaibronz
Copy link

chaibronz commented Feb 14, 2021

couldn't you get the same result with (swap_main), per the defaults?:

bind[swap_main] = MOD+Return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants