Update aji.c for cyclelayout and custom shift-tools
This commit is contained in:
		
							parent
							
								
									b20b81562c
								
							
						
					
					
						commit
						aefae1c570
					
				
							
								
								
									
										54
									
								
								aji.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								aji.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,54 @@
 | 
			
		||||
void
 | 
			
		||||
cyclelayout(const Arg *arg) {
 | 
			
		||||
    Layout *next;
 | 
			
		||||
    for (next = (Layout *)layouts; next != selmon->lt[selmon->sellt]; next++);
 | 
			
		||||
    if ((++next - layouts) >= LENGTH(layouts))
 | 
			
		||||
        next = (Layout *)layouts;
 | 
			
		||||
    setlayout(&(Arg) { .v = next });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 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
 | 
			
		||||
shifttag(const Arg *arg) {
 | 
			
		||||
	if(selmon->sel){
 | 
			
		||||
	
 | 
			
		||||
		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);
 | 
			
		||||
	
 | 
			
		||||
        	selmon->sel->tags = shifted.ui & TAGMASK;
 | 
			
		||||
        	arrange(selmon);
 | 
			
		||||
		view(&shifted);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 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);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user