aboutsummaryrefslogtreecommitdiff
path: root/.config/eww/scripts/start.sh
blob: 9819fa0f504b6665af41dff424b10db0f63651bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

# 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)
total=$(wlr-randr | grep "^[^ ]" | awk '{ print$1 }' | wc -l | xargs)
monitors=$(($monitors-1))
# for ((i = 0 ; i < $monitors ; i++)); do
for ((i = $monitors ; i >= 0 ; i-=1)); do 
	eww open bar${i}
done
if [ "$total" -gt "1" ]; then
	riverctl focus-output HDMI-A-1
	# Focus the lowest active tag
	num=$(river-bedload -print outputs | jq -r '.['0'] | select(.).view_tags')
	b=0                                                                                                           
	while [[ $num -gt 0 ]]                                                                                        
	do
  	let temp=$num%2                                                                                       
  	if [[ $temp -eq 1 ]]                                                                                  
  	then                                                                                                  
  	let count=$count+1                                                                                        
	fi                                                                                                    
	let num=$num/2                                                                                        
	let b=b+1                                                                                                   
	if [[ $temp -eq 1 ]]                                                                                        
	then                                                                                                        
  	riverctl set-focused-tags $((1 << ($b - 1)))
  	exit 0                                                                                                   
	fi                                                                                                          
	done
fi