Compare commits
	
		
			1 Commits
		
	
	
		
			1b2a277a7a
			...
			0efee5882a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0efee5882a | 
@ -10,6 +10,7 @@
 | 
				
			|||||||
    - tmux
 | 
					    - tmux
 | 
				
			||||||
    - urlview
 | 
					    - urlview
 | 
				
			||||||
    - reattach-to-user-namespace
 | 
					    - reattach-to-user-namespace
 | 
				
			||||||
 | 
					    - osx-cpu-temp
 | 
				
			||||||
- pacman:
 | 
					- pacman:
 | 
				
			||||||
    - tmux
 | 
					    - tmux
 | 
				
			||||||
    - xclip
 | 
					    - xclip
 | 
				
			||||||
 | 
				
			|||||||
@ -12,8 +12,22 @@ fi
 | 
				
			|||||||
trap '[ -f $cache_file ] && rm $cache_file; exit' INT
 | 
					trap '[ -f $cache_file ] && rm $cache_file; exit' INT
 | 
				
			||||||
trap '[ -f $cache_file ] && rm $cache_file; exit' TERM
 | 
					trap '[ -f $cache_file ] && rm $cache_file; exit' TERM
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Check if a battery is installed.
 | 
				
			||||||
 | 
					if ioreg -w0 -l|grep BatteryInstalled &> /dev/null; then
 | 
				
			||||||
 | 
					  has_battery=true
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					  has_battery=false
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
while true; do
 | 
					while true; do
 | 
				
			||||||
  battery="`pmset -g batt | grep --color=never -Eo '\d+%'` ↯"
 | 
					  # Get the current CPU temperature.
 | 
				
			||||||
  echo "$battery" > $cache_file
 | 
					  cpu_temp="`/usr/local/bin/osx-cpu-temp`"
 | 
				
			||||||
 | 
					  if $has_battery; then
 | 
				
			||||||
 | 
					    # Parse the current battery charge percentage.
 | 
				
			||||||
 | 
					    battery=" `pmset -g batt | grep --color=never -Eo '\d+%'` ↯"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  # Write to the cache file.
 | 
				
			||||||
 | 
					  echo "$cpu_temp$battery" > $cache_file
 | 
				
			||||||
 | 
					  # Don't spin, sleep instead.
 | 
				
			||||||
  sleep 2
 | 
					  sleep 2
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user