shiftview

This commit is contained in:
Luke Smith 2019-12-15 16:10:30 -05:00
parent cef8e1eaf3
commit 29f9e54c15
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

19
shiftview.c Normal file
View file

@ -0,0 +1,19 @@
/** Function to shift the current view to the left/right
*
* @param: "arg->i" stores the number of tags to shift right (positive value)
* or left (negative value)
*/
void
shiftview(const Arg *arg) {
Arg shifted;
if(arg->i > 0) // left circular shift
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
else // right circular shift
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
view(&shifted);
}