18 lines
		
	
	
		
			223 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			18 lines
		
	
	
		
			223 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|  | # vim: ft=ruby | ||
|  | 
 | ||
|  | class Battery < Worker | ||
|  | 	require 'open3' | ||
|  | 
 | ||
|  | 	def mainloop() | ||
|  | 		while true do | ||
|  | 			Open3.popen2("acpi") {|i,o,t| | ||
|  | 				self.write(o.gets.split[3]) | ||
|  | 			} | ||
|  | 
 | ||
|  | 			sleep(10) | ||
|  | 		end | ||
|  | 	end | ||
|  | end | ||
|  | 
 | ||
|  | Modules.add("battery", "Battery") |