Dwm and Multi Monitors

I’m trying to understand how to open certain applications on a particular monitor and workspace (or Tag).

Can someone tell me if this is correct:

	{ "Firefox",  NULL,       NULL,       1 << 0,       0,           0 },
	{ "subl3",    NULL,       NULL,       1 << 2,       0,           1 },
	{ "urxvt",    "ncmpcpp",  NULL,       1 << 2,       0,           1 },

For example I want Firefox on my left monitor and on Tag 1. An instance of URXVT with ncmpcpp on my right monitor and on Tag 2.

Any advice or tips will be appreciated.

Still not a master of bitwise stuff so take what I say with a grain of salt.

Not sure which monitor the left is but I’ll assume it’s mon 0, that much is pretty straightforward, -1 is the “current”.

For tags, it’s a bit mask, this is why they’re not workspa e’s, you can have any viewed in any other simultaneously.

Imagine a setup with 10 tags as being 00000000000 (not entirely true as there are many more leading bits that are unused unless you have more tags and its stored in an int which is 4 bytes on most systems - 32 bits) where any of the the zeros can be subbed with ones to “activate” the tag associated with that bit, the reason you’ll usually see left shifting << is that the bits are populated from right to left or you’d have to shift right some weird number to get past the leading unused bits.

The bits are just a line, literally, so when you shift a bit (0/1) it just goes to that index of the total bits. Eg.

before: 0000000000

1 << 2

after: 0000000100

Meaning tag 3 would be active. Shifting zero would be setting the first or last bit depending on direction.

In your above example you would need to shift left 1 to set Firefox on tag 2, Eg 1 << 1

They have a nice explanation on https://dwm.suckless.org/customisation/tagmask/ as well

1 Like

Ah yes that makes sense. Cheers.