aboutsummaryrefslogblamecommitdiff
path: root/.config/eww/scripts/start.sh
blob: 4b5e9e98b24a9b34e0ec1e513ad2ab446c43aeab (plain) (tree)
1
2
3
4
5
6
7
8
9
         



                                     
                                                                                        
                                                                                                                      
                                                                                                                      
          

                                                                                                                              
                                                                                                                              
                                                                                                                          
                                                                                                                                      


                                                                                                                                     
                                                                                                                    
                                                   









                                                                                                                    
            


                                                                        






                                                                                                                  
    
#!/bin/sh

focusactivetag() {
	export arg="$1"	
	# Focus the lowest active tag
	num=$(river-bedload -print outputs | jq -r '.["$arg"] | select(.).focused_tags')
	b=0                                                                                                           
	while [ "$num" -gt 0 ]                                                                                        
	do
  			temp=$((num%2))                                                                                       
  			if [ "$temp" -eq 1 ]                                                                                  
  			then                                                                                                  
  	 	count=$((count+1))                                                                                        
				fi                                                                                                    
				num=$((num/2))                                                                                       
	b=$((b+1))                                                                                                   
	if [ "$temp" -eq 1 ]                                                                                        
	then                                                                                                        
  	riverctl set-focused-tags $((1 << (b - 1)))
  	return                                                                                                   
	fi                                                                                                          
done
return
}

# kill any running instances if they exist
eww kill

# Start Eww daemon
# eww daemon

# start a bar for each monitor
monitors=$(wlr-randr | grep "^[^ ]" | awk '{ print$1 }' | wc -l | xargs)
monitors=$((monitors-1))
while [ "$monitors" -ge 0 ]
do
    eww open bar"${monitors}"
    riverctl focus-output "$("wlr-randr | grep "^[^ ]" | awk '{ print$1 }' | awk 'FNR == '$monitors+1' {print}'")"
    focusactivetag "$monitors"
    monitors=$(( monitors - 1 ))
done