focusadjacenttag.c (1732B)
1 void 2 tagtoleft(const Arg *arg) 3 { 4 unsigned int MASK = (1 << NUMTAGS) - 1; 5 if (selmon->sel != NULL 6 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 7 && selmon->tagset[selmon->seltags] > 1) { 8 selmon->sel->tags >>= 1; 9 arrange(selmon); 10 focus(NULL); 11 } 12 } 13 14 void 15 tagtoright(const Arg *arg) 16 { 17 unsigned int MASK = (1 << NUMTAGS) - 1; 18 if (selmon->sel != NULL 19 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 20 && selmon->tagset[selmon->seltags] & (MASK >> 1)) { 21 selmon->sel->tags <<= 1; 22 arrange(selmon); 23 focus(NULL); 24 } 25 } 26 27 void 28 viewtoleft(const Arg *arg) 29 { 30 unsigned int MASK = (1 << NUMTAGS) - 1; 31 if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 32 && selmon->tagset[selmon->seltags] > 1) { 33 view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 })); 34 } 35 } 36 37 void 38 viewtoright(const Arg *arg) 39 { 40 unsigned int MASK = (1 << NUMTAGS) - 1; 41 if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 42 && selmon->tagset[selmon->seltags] & (MASK >> 1)) { 43 view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 })); 44 } 45 } 46 47 void 48 tagandviewtoleft(const Arg *arg) 49 { 50 unsigned int MASK = (1 << NUMTAGS) - 1; 51 if (selmon->sel != NULL 52 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 53 && selmon->tagset[selmon->seltags] > 1) { 54 selmon->sel->tags >>= 1; 55 view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 })); 56 } 57 } 58 59 void 60 tagandviewtoright(const Arg *arg) 61 { 62 unsigned int MASK = (1 << NUMTAGS) - 1; 63 if (selmon->sel != NULL 64 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1 65 && selmon->tagset[selmon->seltags] & (MASK >> 1)) { 66 selmon->sel->tags <<= 1; 67 view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 })); 68 } 69 }