Introduction
Introduction Statistics Contact Development Disclaimer Help
termbar - dotfiles - These are my dotfiles. There are many like it, but these a…
git clone git://jay.scot/dotfiles
Log
Files
Refs
README
---
termbar (919B)
---
1 #!/bin/sh
2
3 ## Debug
4 #set -x
5
6 trap 'exec $0' HUP # Restart itself
7 trap 'tput cnorm; exit 1' INT QUIT TERM
8
9 esc="\033"
10 reset="${esc}[0m"
11 redf="${esc}[31m"
12 cyanf="${esc}[36m";
13 purplef="${esc}[35m"
14 pipe="${purplef}|${reset}"
15
16 today()
17 {
18 DATE=$(date '+%a %d %b %H:%M')
19 }
20
21 desktop_id()
22 {
23 DESKTOP_ID=$(xprop -root 32c '\t$0' _NET_CURRENT_DESKTOP | cut -…
24 }
25
26 bat()
27 {
28 BAT=$(apm -l)
29 }
30
31 bat_status()
32 {
33 STATUS=$(sysctl hw.sensors.acpiac0.indicator0 | grep -c On)
34
35 if [ ${STATUS} -eq "1" ]; then
36 BAT_STATUS=$(echo Connected)
37 else
38 BAT_STATUS=$(echo ${redf}Disconnected${reset})
39 fi
40 }
41
42 mem()
43 {
44 MEM=$(top -n | grep Memory | awk {'print $6'})
45 }
46
47 tput civis
48
49 while true; do
50 today
51 desktop_id
52 mem
53 bat
54 bat_status
55 tput cup 1 0
56 printf "[${DESKTOP_ID}] ${pipe} ${reset} ${DATE} ${pipe} ${cyanf…
57 printf "${pipe} ${cyanf}Bat:${reset} $BAT - ${BAT_STATUS}"
58 printf " " echo "\e[1A"
59 sleep 1
60 done
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.