From 6e4a15d79352ca2707a3b0d81d158228a7d14704 Mon Sep 17 00:00:00 2001 From: 0scar Date: Thu, 3 Jun 2021 23:33:31 +0200 Subject: Add/move statusbar scripts --- .scripts/batinfo | 33 --------------------------------- .scripts/checkupdates | 15 --------------- .scripts/cpuinfo | 30 ------------------------------ .scripts/meminfo | 13 ------------- .scripts/netinfo | 34 ---------------------------------- 5 files changed, 125 deletions(-) delete mode 100755 .scripts/batinfo delete mode 100755 .scripts/checkupdates delete mode 100755 .scripts/cpuinfo delete mode 100755 .scripts/meminfo delete mode 100755 .scripts/netinfo (limited to '.scripts') diff --git a/.scripts/batinfo b/.scripts/batinfo deleted file mode 100755 index 1719181..0000000 --- a/.scripts/batinfo +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env sh - -set -e - -status="$(acpi -abi)" # get battery and adapter info - -case $BLOCK_BUTTON in - 1) notify-send -t $((15 * 1000)) --urgency=low "Battery status" "$status" ;; - 4) brightnessctl -q s 10%+ ;; - 5) brightnessctl -q s 10%- ;; -esac - -power=$(echo "${status}" | awk '/Battery [0-9]+: [A-Z]/{s+=$4;c++}; END{printf "%.1f%%", s/c}') - -icon='?' -if [[ -z $(echo $status | sed -n '/on-line/p') ]]; then - case "${power%.*}" in - 100 | 9[0-9]) icon='\uf578' ;; - 8[0-9]) icon='\uf581';; - 7[0-9]) icon='\uf580';; - 6[0-9]) icon='\uf57f';; - 5[0-9]) icon='\uf57e';; - 4[0-9]) icon='\uf57d';; - 3[0-9]) icon='\uf57c';; - 2[0-9]) icon='\uf57b';; - 1[0-9]) icon='\uf57a';; - [0-9]) icon='\uf579';; - esac -else - icon='\uf583' -fi - -echo -e "$icon $power" diff --git a/.scripts/checkupdates b/.scripts/checkupdates deleted file mode 100755 index 5a95974..0000000 --- a/.scripts/checkupdates +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh -set -e - -updates=$(pacman -Qu | sed '/\[ignored\]$/d') - -case $BLOCK_BUTTON in - 1) ;& # fallthrough - 3) if [ -n "${updates}" ]; then - notify-send -t $((1000 * 20)) "Available updates" "$updates" - else - notify-send "Available updates" "No available updates" - fi;; -esac - -[ -n "$updates" ] && echo $(echo "${updates}" | wc -l) || exit 0 diff --git a/.scripts/cpuinfo b/.scripts/cpuinfo deleted file mode 100755 index f46121b..0000000 --- a/.scripts/cpuinfo +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env sh -set -e - -case $BLOCK_BUTTON in - 1) notify-send --urgency=low \ - "Process status" \ - "$(ps -eo pid,pcpu,size,comm \ - | sort -rnk 3 \ - | awk '{printf "% 8s% 8s% 8s ", $1, $2, $3; - $1="";$2="";$3=""; - print $0; c++} - c>10 {exit}')" - ;; - 3) notify-send --urgency=low \ - "Process status" \ - "$(ps -eo pid,pcpu,size,cmd \ - | sort -rnk 3 \ - | cut -b -45 \ - | awk '{printf "% 8s% 8s% 8s ", $1, $2, $3; - $1="";$2="";$3=""; - print $0; c++} - c>10 {exit}')" - ;; -esac - -# Load -sed -Ee 's/^([0-9]+\.[0-9]+) .*/[\1  /g' /proc/loadavg | tr -d '\n' - -# Thermals -awk '{s+=$1}END{printf "%.1f°]", s / (1000*NR)}' /sys/class/thermal/thermal_zone*/temp diff --git a/.scripts/meminfo b/.scripts/meminfo deleted file mode 100755 index 2b31b97..0000000 --- a/.scripts/meminfo +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env sh -set -e - -case $BLOCK_BUTTON in - 1) notify-send --urgency=low \ - "Memory status" \ - "$(free -h | \ - awk '/total/ {printf "%15s%10s%10s\n", $1, $2, $3} - /Mem|Swap/{printf "%-5s%10s%10s%10s\n", $1, $2, $3, $4}')" - ;; -esac - -free -h | awk '/Mem/{print "[" $3 " RAM " $2 "]" }' diff --git a/.scripts/netinfo b/.scripts/netinfo deleted file mode 100755 index ceb79f7..0000000 --- a/.scripts/netinfo +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env sh - -netstatus="$(awk '{ - n = split(FILENAME, a, "/") - printf("%-15s %s\n", a[n-1], $1) - }' /sys/class/net/[ew]*/operstate | sort -k 2)" - -function add_connected_address() { - TMPIFS=$IFS - IFS=' -' - for line in $netstatus; do - device=$(echo $line | awk '{print $1}') - address=$(ip addr show $device | sed -En 's/inet ([0-9\.]+).*/\1/p') - # Append Wifi AP if connected - [ -n "$address" ] && address=$address" ("$(iwgetid -r)")" - echo $line $address - done - IFS=$TMPIFS -} - -case $BLOCK_BUTTON in - 1) notify-send --urgency=low "Internet connection" "$(add_connected_address)" ;; -esac - -#echo "$(echo -e "$netstatus" | sed -En '/up$/p')" -#echo ====== - -if [ -z "$(echo -e "${netstatus}" | sed -En '/up$/p' | tr -d '\n')" ]; then - echo -n '' -else - echo -n "${netstatus}" | sed -En 's/^(w[^ ]+).*up//p;s/^(e[^ ]+).*up//p' -fi - -- cgit v1.3