Adding my personal blocks

This commit is contained in:
Ashish Kumar Yadav 2020-07-07 01:36:10 +05:30
parent d97732daf9
commit 93c80d538a
15 changed files with 88 additions and 1 deletions

View file

@ -1,7 +1,7 @@
/* time interval in seconds to sleep before looking for updates in the main loop */ /* time interval in seconds to sleep before looking for updates in the main loop */
#define SLEEPINTERVAL 30 #define SLEEPINTERVAL 30
#define PATH(name) "/home/ashish/.scripts/statusbar/"name #define PATH(name) "/home/ashish/.local/projects/dwmblocks/blocks/"name
/* If multiple realtime signals are pending, then the lowest numbered signal is delivered first. /* If multiple realtime signals are pending, then the lowest numbered signal is delivered first.
* If interval of a block is set to 0, the block will only be updated once at startup. * If interval of a block is set to 0, the block will only be updated once at startup.

3
blocks/battery.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/dash
read -r capacity </sys/class/power_supply/BAT0/capacity
echo "${capacity}%"

6
blocks/battery_button.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/dash
case "$1" in
1) exec termite -e "htop -s PERCENT_CPU" ;;
2) exec termite -e "htop" ;;
3) exec termite -e "htop -s PERCENT_MEM" ;;
esac

2
blocks/calendar.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/dash
echo "$(date '+%a, %d %b')"

6
blocks/calendar_button.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/dash
case "$1" in
1) exec termite -e "htop -s PERCENT_CPU" ;;
2) exec termite -e "htop" ;;
3) exec termite -e "htop -s PERCENT_MEM" ;;
esac

12
blocks/cpu_temp.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/dash
crit=70
read -r temp </sys/class/thermal/thermal_zone0/temp
temp=${temp%???}
if [ "$temp" -ge "$crit" ] ; then
echo "${temp}°C"
else
echo "${temp}°C"
fi

6
blocks/cpu_temp_button.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/dash
case "$1" in
1) exec termite -e "htop -s PERCENT_CPU" ;;
2) exec termite -e "htop" ;;
3) exec termite -e "htop -s PERCENT_MEM" ;;
esac

6
blocks/hotspot.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/dash
if [ "$1" = 1 ] ; then
echo ""
else
echo ""
fi

4
blocks/hotspot_button.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/dash
case "$1" in
1|2|3) echo "turn off hotspot" ;;
esac

12
blocks/mail.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/dash
crit=70
read -r temp </sys/class/thermal/thermal_zone0/temp
temp=${temp%???}
if [ "$temp" -ge "$crit" ] ; then
echo "${temp}°C"
else
echo "${temp}°C"
fi

6
blocks/mail_button.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/dash
case "$1" in
1) setsid -f termite -e "htop -s PERCENT_CPU" ;;
2) setsid -f termite -e "htop" ;;
3) setsid -f termite -e "htop -s PERCENT_MEM" ;;
esac

7
blocks/pulse_daemon.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/dash
pactl subscribe |
while read -r output ; do
if [ -z "${output##*sink *}" ] ; then
sigdsblocks 1
fi
done

2
blocks/time.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/dash
echo "$(date '+%H:%M')"

9
blocks/volume.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/dash
volstat=$(pamixer --get-mute --get-volume)
if "${volstat% *}" ; then
echo "${volstat#* }%"
else
echo "${volstat#* }%"
fi

6
blocks/volume_button.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/dash
case "$1" in
1) pamixer --toggle-mute ;;
2) exec pavucontrol-qt ;;
3) pamixer --set-volume 60 ;;
esac