From 29b6d79e5252b8e6af18898ee0d6d7596ffd0841 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 14 Mar 2021 17:03:06 +0530 Subject: pushing lemonblocks config --- lemonblocks/config.txt | 5 +++++ lemonblocks/modules/cpu_load.sh | 10 +++++++++ lemonblocks/modules/cpu_temp.sh | 5 +++++ lemonblocks/modules/date.sh | 3 +++ lemonblocks/modules/mem_usage.sh | 4 ++++ lemonblocks/modules/volume.sh | 9 ++++++++ lemonblocks/start.sh | 46 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 82 insertions(+) create mode 100644 lemonblocks/config.txt create mode 100755 lemonblocks/modules/cpu_load.sh create mode 100755 lemonblocks/modules/cpu_temp.sh create mode 100755 lemonblocks/modules/date.sh create mode 100755 lemonblocks/modules/mem_usage.sh create mode 100755 lemonblocks/modules/volume.sh create mode 100755 lemonblocks/start.sh diff --git a/lemonblocks/config.txt b/lemonblocks/config.txt new file mode 100644 index 00000000..b2b407c7 --- /dev/null +++ b/lemonblocks/config.txt @@ -0,0 +1,5 @@ +0,5,NULL,/usr/bin/lbscripts/volume.sh,r,NULL,130F23,cc1168,NULL,NULL,NULL,NULL,NULL, , +5,4,NULL,/usr/bin/lbscripts/cpu_temp.sh,r,NULL,130F23,1045cc,NULL,NULL,NULL,NULL,NULL, , +5,3,NULL,/usr/bin/lbscripts/cpu_load.sh,r,NULL,130F23,7410cc,NULL,NULL,NULL,NULL,NULL, , +5,2,NULL,/usr/bin/lbscripts/mem_usage.sh,r,NULL,130F23,10cc8e,NULL,NULL,NULL,NULL,NULL, , +30,1,NULL,/usr/bin/lbscripts/date.sh,r,NULL,130F23,6C71C4,NULL,NULL,NULL,NULL,NULL, , diff --git a/lemonblocks/modules/cpu_load.sh b/lemonblocks/modules/cpu_load.sh new file mode 100755 index 00000000..1a677a96 --- /dev/null +++ b/lemonblocks/modules/cpu_load.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +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) )) + +printf " CPU:%s%% " $cpu diff --git a/lemonblocks/modules/cpu_temp.sh b/lemonblocks/modules/cpu_temp.sh new file mode 100755 index 00000000..c4a2ca6c --- /dev/null +++ b/lemonblocks/modules/cpu_temp.sh @@ -0,0 +1,5 @@ +#!/bin/bash +CEL=$'\xc2\xb0C' +temp=$( cat /sys/devices/virtual/thermal/thermal_zone0/temp ) +temp=`expr $temp / 1000` +printf " TEMP:$temp$CEL "" diff --git a/lemonblocks/modules/date.sh b/lemonblocks/modules/date.sh new file mode 100755 index 00000000..dcd06819 --- /dev/null +++ b/lemonblocks/modules/date.sh @@ -0,0 +1,3 @@ +#!/bin/bash +date=$(date +"%d %b(%A) %H:%M") +printf " $date " diff --git a/lemonblocks/modules/mem_usage.sh b/lemonblocks/modules/mem_usage.sh new file mode 100755 index 00000000..6b939ebc --- /dev/null +++ b/lemonblocks/modules/mem_usage.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +mem=$(free -m | grep Mem: | awk '{print$3 / $2 * 100}') +printf " MEM: %.0f%% " $mem diff --git a/lemonblocks/modules/volume.sh b/lemonblocks/modules/volume.sh new file mode 100755 index 00000000..a0843dd9 --- /dev/null +++ b/lemonblocks/modules/volume.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +printf " VOL:$(pamixer --get-volume-human)% " +# if [ $volume_level == "muted" ]; then + # printf "%{F#ff0058}VOL: $(pamixer --get-volume)%{F-}" +# else + # printf "VOL: $volume_level" +# fi + diff --git a/lemonblocks/start.sh b/lemonblocks/start.sh new file mode 100755 index 00000000..c7b591ce --- /dev/null +++ b/lemonblocks/start.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# setup xmonad status +# mkfifo /tmp/xmonad_stat +# xmonad-log > /tmp/xmonad_stat & + +CLICKABLE_AREAS=1 +PANEL_WIDTH=566 +PANEL_HEIGHT=21 +PANEL_HORIZONTAL_OFFSET=800 +PANEL_VERTICAL_OFFSET=0 +PANEL_FONT="Source Han Sans JP:size=10" +PANEL_ICON_FONT="RobotoMono Nerd Font:style=Regular:size=15" +COLOR_DEFAULT_FG="#FFFFFF" +COLOR_DEFAULT_BG="#171520" +UNDERLINE_HEIGHT=3 +PANEL_WM_NAME="lemon" + +# Kill potential instances of lemonbar & lemonblocks +killall "lemonbar" +killall "lemonblocks" + +# Make sure the named pipe already exists +mkfifo /tmp/lemonblockspipe + +# start xmonad status lemonbar +xmonad-log | lemonbar -b -g 800x21+0+0 -B '#171520' -F '#ffffff' -o -3 -f 'Source Han Sans JP:size=10' -o 0 -f 'RobotoMono Nerd Font:style=Regular:size=15' & +# Start lemonbar +cat "/tmp/lemonblockspipe" | lemonbar -b -p -a "$CLICKABLE_AREAS" \ + -g "$PANEL_WIDTH"x"$PANEL_HEIGHT"+"$PANEL_HORIZONTAL_OFFSET"+"$PANEL_VERTICAL_OFFSET" \ + -o -3 -f "$PANEL_FONT" -o 0 -f "$PANEL_ICON_FONT" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" \ + -u "$UNDERLINE_HEIGHT" -n "$PANEL_WM_NAME" | bash & + +sleep 0.5 + +# Make sure lemonbar is hidden below a fullscreen window +## Bspwm +# wid=$(xdo id -a "$PANEL_WM_NAME") +# xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid" + +if [ $# -eq 0 ] +then + lemonblocks +else + ./bin/lemonblocks +fi -- cgit v1.2.3