The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

11.11. Laptop Power

If you have a laptop with APM installed, try the following PROMPT_COMMAND to create an environment variable ${battery} you can add to your prompt. This will indicate if AC power is connected and percentage power remaining. AC power is indicated by a "^" (for on) and a "v" (for off) before the percentage value.

function prompt_command {
	#  As much of the response of the "apm" command as is 
	#  necessary to identify the given condition:
   NO_AC_MESG="AC off"
   AC_MESG="AC on"

   APMD_RESPONSE="$(apm)"
   case ${APMD_RESPONSE} in
      *${AC_MESG}*)
         ACstat="^"
         ;;
      *${NO_AC_MESG}*)
         ACstat="v"
         ;;
   esac

   battery="${temp##* }"
   battery="${ACstat}${battery}"
}



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру