aboutsummaryrefslogtreecommitdiff
path: root/archive/XMonad/baraction
diff options
context:
space:
mode:
Diffstat (limited to 'archive/XMonad/baraction')
-rwxr-xr-xarchive/XMonad/baraction58
1 files changed, 58 insertions, 0 deletions
diff --git a/archive/XMonad/baraction b/archive/XMonad/baraction
new file mode 100755
index 00000000..70316740
--- /dev/null
+++ b/archive/XMonad/baraction
@@ -0,0 +1,58 @@
+#!/bin/zsh
+
+get_date_time() {
+ datetime=$(date +"%d %b(%A) %H:%M")
+ echo $datetime
+}
+
+get_dnd_status() {
+ dnd_status=$(</tmp/dnd_status)
+ if [ $dnd_status = "on" ]; then
+ echo "%{F#232627}%{B#f70258}" "サイレント" "%{F-}%{B-}"
+ fi
+}
+
+get_cpu_load() {
+ read cpu a b c previdle rest < /proc/stat
+ prevtotal=$((a+b+c+previdle))
+ sleep 0.5
+ read cpu a b c idle rest < /proc/stat
+ total=$((a+b+c+idle))
+ cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
+ echo -e "CPU: $cpu%"
+}
+
+get_cpu_temp() {
+ CEL=$'\xc2\xb0C'
+ temp=$( cat /sys/devices/virtual/thermal/thermal_zone0/temp )
+ temp=`expr $temp / 1000`
+ echo "TEMP: " $temp$CEL
+}
+
+get_disk_usage() {
+ root=$(df -h / | awk 'NR==2 {print $4 "/" $2}')
+ home=$(df -h /home | awk 'NR==2 {print $4 "/" $2}')
+ echo "ROOT:" $root " %{B-} " "%{B#E6739F} HOME:" $home " "
+}
+
+get_mem_usage() {
+ mem=$(free -m | grep Mem: | awk '{print$3 / $2 * 100}')
+ printf "MEM: %.0f %%" $mem
+}
+
+get_mute_status() {
+ vol=$(pamixer --get-volume-human)
+ if [ $vol = "muted" ]
+ then
+ echo "%{B#F15BB5}%{F#232627} ミュート"
+ fi
+}
+
+get_weather() {
+ echo $(</tmp/weather_stat)
+}
+
+while :; do
+ echo "%{B#FD3A69}%{F#232627} " $(get_disk_usage) "%{B-} %{B#FECD1A} " $(get_cpu_load) "%{B-} %{B#03C4A1}" $(get_cpu_temp) "%{B-} %{B#00BBF9}" $(get_mem_usage) "%{c}%{F-}%{B-}%{r}" $(get_dnd_status) $(get_mute_status) "%{B-}%{F-} %{B#9B5DE5}%{F#FCFCFC}" $(get_weather) "%{B-} %{B#892CDC}%{F#FCFCFC} " $(get_date_time) " %{F-}%{B-}"
+ sleep 3
+done