| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -4,24 +4,30 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Joe Standring <git@joestandring.com> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# GNU GPLv3 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					df_check_location='/home' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					dwm_resources () { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    # Used and total memory | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    MEMUSED=$(free -h | awk '(NR == 2) {print $3}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    MEMTOT=$(free -h |awk '(NR == 2) {print $2}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    # CPU temperature | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    CPU=$(sysctl -n hw.sensors.cpu0.temp0 | cut -d. -f1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    # Used and total storage in /home (rounded to 1024B) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    STOUSED=$(df -h | grep '/home$' | awk '{print $3}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    STOTOT=$(df -h | grep '/home$' | awk '{print $2}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    STOPER=$(df -h | grep '/home$' | awk '{print $5}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						# get all the infos first to avoid high resources usage | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						free_output=$(free -h | grep Mem) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						df_output=$(df -h $df_check_location | tail -n 1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						# Used and total memory | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						MEMUSED=$(echo $free_output | awk '{print $3}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						MEMTOT=$(echo $free_output | awk '{print $2}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						# CPU temperature | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						CPU=$(top -bn1 | grep Cpu | awk '{print $2}')% | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						#CPU=$(sysctl -n hw.sensors.cpu0.temp0 | cut -d. -f1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						# Used and total storage in /home (rounded to 1024B) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						STOUSED=$(echo $df_output | awk '{print $3}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						STOTOT=$(echo $df_output | awk '{print $2}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						STOPER=$(echo $df_output | awk '{print $5}') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    printf "%s" "$SEP1" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    if [ "$IDENTIFIER" = "unicode" ]; then | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        printf "💻 MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        printf "STA | MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    fi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    printf "%s\n" "$SEP2" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						printf "%s" "$SEP1" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						if [ "$IDENTIFIER" = "unicode" ]; then | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							printf "💻 MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							printf "STA | MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						fi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						printf "%s\n" "$SEP2" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					dwm_resources |