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

Tag-Sync patch (for syncing tags across all monitors) #219

Merged
merged 5 commits into from
Feb 11, 2022

Conversation

Bagellll
Copy link
Contributor

I wrote this up for myself and wanted to share it. Stock dwm works alright, as for this fork I can only confirm compatibility with EWMH. Thanks for taking a look!

@Bagellll Bagellll changed the title Tag-Sync patch Tag-Sync patch (for syncing tags across all monitors) Jan 23, 2022
@bakkeby
Copy link
Owner

bakkeby commented Jan 24, 2022

This is in principle the same as my desktop patch.

For those reading over this the general idea is that all the tags change in unison across all monitors - giving the illusion that there are only 9 tags and that the tags span across all monitors. This gives the kind of "desktop" feel which one would get in any desktop environment where the viewport changes. This gives a better look and feel than one might expect.

I am not against adding something like this to dwm-flexipatch, but I would probably try to make it less invasive (potentially looping through selmon and restoring the originally selected monitor at the end).

I had a quick look and this patch as-is may have compatibility issues with the following patches:

  • COMBO_PATCH
  • FOCUSADJACENTTAG_PATCH
  • PERTAG_PATCH
  • REORGANIZETAGS_PATCH
  • SCRATCHPADS_PATCH
  • SWAPTAGS_PATCH
  • SWITCHTAG_PATCH

Behavioural compatibility with these patches may also warrant review:

  • FOCUSURGENT_PATCH
  • SHIFTVIEW_CLIENTS_PATCH

@Bagellll
Copy link
Contributor Author

I'll see if I can work on compatibility then, and also make it less invasive. I think I tried looping through selmon but it kept crashing on me. Now that I think about it I was probably just doing it wrong.

After reading your reply I tested PERTAG first and it half worked. If there weren't any additional functions being called in the loop that reference selmon then I bet it would've worked fully but I digress. I'll take your advice and see what I can do.

@bakkeby
Copy link
Owner

bakkeby commented Jan 24, 2022

It probably ended up crashing if you were to leave selmon as NULL after looping. I can look into compatibility regarding this later when I have more time.

Points of interest can be found with this grep:

$ grep -rn 'seltags] ='
dwm.c:914:						c->mon->tagset[c->mon->seltags] = newtagset;
dwm.c:4084:		selmon->tagset[selmon->seltags] = newtagset;
dwm.c:4681:		selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
patch/swaptags.c:18:   selmon->tagset[selmon->seltags] = newtag;
patch/focusadjacenttag.c:34:		selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
patch/focusadjacenttag.c:53:		selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
patch/focusadjacenttag.c:74:		selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
patch/focusadjacenttag.c:95:		selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
patch/pertag.c:35:		selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
patch/scratchpad.c:64:			selmon->tagset[selmon->seltags] = newtagset;
patch/combo.c:43:			selmon->tagset[selmon->seltags] = newtags;
patch/reorganizetags.c:25:       selmon->tagset[selmon->seltags] = selmon->sel->tags;

@Bagellll
Copy link
Contributor Author

I've added quite a bit to support the patches you mentioned above and also figured out the right way to loop selmon.
The only patch I can't confirm compatibility with is the SWITCHTAG_PATCH

I believe it's finished but if you are entertaining this being added please feel free to verify. Personally, having not used SWITCHTAG I wasn't sure how to test it. As for the others they have been tested and work. I know I'll be using it :)

@bakkeby
Copy link
Owner

bakkeby commented Feb 11, 2022

In the above commit I am simplifying a few things like especially the combo patch and the focusadjacenttag patches. This makes them differ compared to the original patches, but they were starting to get silly to maintain considering how much they mimic the view function.

As for the removal of the updatemonitordesktop(Monitor *m) function, this is merely because the existing updatecurrentdesktop() is sufficient in that it sets a property on the root window with information about which tag is currently shown. The tags should stay the same on all monitors, so it will not make any difference to set this property more than once.

@bakkeby bakkeby merged commit ae67378 into bakkeby:master Feb 11, 2022
polarmutex pushed a commit to polarmutex/dwm that referenced this pull request May 3, 2022
* Tag-Sync patch
* Major compatibility updates
* SWITCHTAG/TAGSYNC compatibility
* tagsync: refactoring

Co-authored-by: bakkeby <bakkeby@gmail.com>
SunJukebox pushed a commit to SunJukebox/dwm that referenced this pull request Aug 6, 2022
* Tag-Sync patch
* Major compatibility updates
* SWITCHTAG/TAGSYNC compatibility
* tagsync: refactoring

Co-authored-by: bakkeby <bakkeby@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants