github.com/wtfutil/wtf@v0.43.0/modules/power/source_linux.go (about)

     1  //go:build linux
     2  
     3  package power
     4  
     5  // powerSource returns the name of the current power source, probably one of
     6  // "AC Power" or "Battery Power"
     7  func powerSource() string {
     8  	switch batteryState {
     9  	case "charging", "fully-charged":
    10  		return "AC Power"
    11  	case "discharging":
    12  		return "Battery Power"
    13  	}
    14  	return batteryState
    15  }