Organising
This commit is contained in:
11
.config/waybar/indicators/statusbar/sb-clock
Executable file
11
.config/waybar/indicators/statusbar/sb-clock
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
|
||||
2) setsid -f "$TERMINAL" -e calcurse ;;
|
||||
3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
|
||||
- Middle click opens calcurse if installed" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
date "+%b %d %I:%M%p"
|
||||
12
.config/waybar/indicators/statusbar/sb-cpu
Executable file
12
.config/waybar/indicators/statusbar/sb-cpu
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;;
|
||||
2) setsid -f "$TERMINAL" -e htop ;;
|
||||
3) notify-send "🖥 CPU module " "\- Shows CPU temperature.
|
||||
- Click to show intensive processes.
|
||||
- Middle click to open htop." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
sensors | awk '/Core 0/ {print "" $3}'
|
||||
44
.config/waybar/indicators/statusbar/sb-cpubars
Executable file
44
.config/waybar/indicators/statusbar/sb-cpubars
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Module showing CPU load as a changing bars.
|
||||
# Just like in polybar.
|
||||
# Each bar represents amount of load on one core since
|
||||
# last run.
|
||||
|
||||
# Cache in tmpfs to improve speed and reduce SSD load
|
||||
cache=/tmp/cpubarscache
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
2) setsid -f "$TERMINAL" -e htop ;;
|
||||
3) notify-send "🪨 CPU load module" "Each bar represents
|
||||
one CPU core";;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
# id total idle
|
||||
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
|
||||
[ ! -f $cache ] && echo "$stats" > "$cache"
|
||||
old=$(cat "$cache")
|
||||
printf "🪨"
|
||||
echo "$stats" | while read -r row; do
|
||||
id=${row%% *}
|
||||
rest=${row#* }
|
||||
total=${rest%% *}
|
||||
idle=${rest##* }
|
||||
|
||||
case "$(echo "$old" | awk '{if ($1 == id)
|
||||
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
|
||||
id="$id" total="$total" idle="$idle")" in
|
||||
|
||||
"0") printf "▁";;
|
||||
"1") printf "▂";;
|
||||
"2") printf "▃";;
|
||||
"3") printf "▄";;
|
||||
"4") printf "▅";;
|
||||
"5") printf "▆";;
|
||||
"6") printf "▇";;
|
||||
"7") printf "█";;
|
||||
"8") printf "█";;
|
||||
esac
|
||||
done; printf "\\n"
|
||||
echo "$stats" > "$cache"
|
||||
88
.config/waybar/indicators/statusbar/sb-forecast
Executable file
88
.config/waybar/indicators/statusbar/sb-forecast
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Displays todays precipication chance () and daily low () and high ().
|
||||
# Usually intended for the statusbar.
|
||||
|
||||
# If we have internet, get a weather report from wttr.in and store it locally.
|
||||
# You could set up a shell alias to view the full file in a pager in the
|
||||
# terminal if desired. This function will only be run once a day when needed.
|
||||
weather_report="${XDG_DATA_HOME:-$HOME/.local/share}/weather_report"
|
||||
|
||||
get_forecast() {
|
||||
curl -sf "wttr.in/$LOCATION?format=j1" > "$weather_report" || exit 1
|
||||
}
|
||||
|
||||
codes="113=
|
||||
116=
|
||||
119=
|
||||
122=
|
||||
143=
|
||||
176=
|
||||
179=
|
||||
182=
|
||||
185=
|
||||
200=
|
||||
227=
|
||||
230=
|
||||
248=
|
||||
260=
|
||||
263=
|
||||
266=
|
||||
281=
|
||||
284=
|
||||
293=
|
||||
296=
|
||||
299=
|
||||
302=
|
||||
305=
|
||||
308=
|
||||
311=
|
||||
314=
|
||||
317=
|
||||
320=
|
||||
323=
|
||||
326=
|
||||
329=
|
||||
332=
|
||||
335=
|
||||
338=
|
||||
350=
|
||||
353=
|
||||
356=
|
||||
359=
|
||||
362=
|
||||
365=
|
||||
368=
|
||||
371=
|
||||
374=
|
||||
377=
|
||||
386=
|
||||
389=
|
||||
392=
|
||||
395="
|
||||
|
||||
show_weather() {
|
||||
weather_code="$(cat "$weather_report" | jq -r '.current_condition[0].weatherCode')"
|
||||
temperature="$(cat "$weather_report" | jq -r '.current_condition[0].FeelsLikeC')"
|
||||
|
||||
echo "$codes" | sed -n "/$weather_code/{s/[0-9]*=//;p;q}" | tr -d '\n'
|
||||
|
||||
symbol="$([[ $temperature -lt 15 ]] && echo || echo )"
|
||||
|
||||
echo " $temperature $symbol"
|
||||
}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e curl "wttr.in/$LOCATION";;
|
||||
2) get_forecast && show_weather ;;
|
||||
3) notify-send "🌈 Weather module" "\- Left click for full forecast.
|
||||
- Middle click to update forecast." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
# The test if our forcecast is updated to the day. If it isn't download a new
|
||||
# weather report from wttr.in with the above function.
|
||||
[ "$(stat -c %y "$weather_report" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
|
||||
get_forecast
|
||||
|
||||
show_weather
|
||||
17
.config/waybar/indicators/statusbar/sb-kbselect
Executable file
17
.config/waybar/indicators/statusbar/sb-kbselect
Executable file
@@ -0,0 +1,17 @@
|
||||
!/bin/sh
|
||||
# works on any init system
|
||||
# requirements: dmenu, xorg-setxkbmap
|
||||
kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
|
||||
[[ ! $kb_choice ]] && echo "$kb" && exit 0
|
||||
kb="$(echo "$kb_choice" | awk '{print $3}')"
|
||||
setxkbmap "$kb"
|
||||
pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
|
||||
3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')")
|
||||
- Left click to change keyboard.";;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
echo " $kb"
|
||||
12
.config/waybar/indicators/statusbar/sb-memory
Executable file
12
.config/waybar/indicators/statusbar/sb-memory
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send " Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
|
||||
2) setsid -f "$TERMINAL" -e htop ;;
|
||||
3) notify-send " Memory module" "\- Shows Memory Used/Total.
|
||||
- Click to show memory hogs.
|
||||
- Middle click to open htop." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
free --mebi | sed -n '2{p;q}' | awk '{printf ("%2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
|
||||
37
.config/waybar/indicators/statusbar/sb-moonphase
Executable file
37
.config/waybar/indicators/statusbar/sb-moonphase
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Shows the current moon phase.
|
||||
|
||||
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
|
||||
|
||||
[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
|
||||
{ curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}
|
||||
|
||||
icon="$(cat "$moonfile")"
|
||||
|
||||
case "$icon" in
|
||||
🌑) name="New" ;;
|
||||
🌒) name="Waxing Crescent" ;;
|
||||
🌓) name="First Quarter" ;;
|
||||
🌔) name="Waxing Gibbous" ;;
|
||||
🌕) name="Full" ;;
|
||||
🌖) name="Waning Gibbous" ;;
|
||||
🌗) name="Last Quarter" ;;
|
||||
🌘) name="Waning Crescent" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
||||
echo "${icon-?}"
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) notify-send "🌜 Moon phase module" "Displays current moon phase.
|
||||
- 🌑: New
|
||||
- 🌒: Waxing Crescent
|
||||
- 🌓: First Quarter
|
||||
- 🌔: Waxing Gibbous
|
||||
- 🌕: Full
|
||||
- 🌖: Waning Gibbous
|
||||
- 🌗: Last Quarter
|
||||
- 🌘: Waning Crescent" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
29
.config/waybar/indicators/statusbar/sb-nettraf
Executable file
29
.config/waybar/indicators/statusbar/sb-nettraf
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Module showing network traffic. Shows how much data has been received (RX) or
|
||||
# transmitted (TX) since the previous time this script ran. So if run every
|
||||
# second, gives network traffic per second.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e bmon ;;
|
||||
3) notify-send "🌐 Network traffic module" ": Traffic received
|
||||
: Traffic transmitted" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
update() {
|
||||
sum=0
|
||||
for arg; do
|
||||
read -r i < "$arg"
|
||||
sum=$(( sum + i ))
|
||||
done
|
||||
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
|
||||
[ -f "$cache" ] && read -r old < "$cache" || old=0
|
||||
printf %d\\n "$sum" > "$cache"
|
||||
printf %d\\n $(( sum - old ))
|
||||
}
|
||||
|
||||
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
||||
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
|
||||
|
||||
printf "%4sB %4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
|
||||
14
.config/waybar/indicators/statusbar/sb-speedtest
Executable file
14
.config/waybar/indicators/statusbar/sb-speedtest
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) "$TERMINAL" -e speedtest-cli --secure --timeout 1 --no-upload ;;
|
||||
3) notify-send "🌐 Speedtest module" "\- Click to run" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
download_speed="$(speedtest-cli --secure --timeout 1 --no-upload --csv)"
|
||||
|
||||
[[ -z $download_speed ]] &&
|
||||
echo "" ||
|
||||
echo "$(echo $download_speed |
|
||||
awk -F, '{ printf("%d",(($7 / 1000000) + 0.5)) }')"
|
||||
20
.config/waybar/indicators/statusbar/sb-tasks
Executable file
20
.config/waybar/indicators/statusbar/sb-tasks
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Originally by Andr3as07 <https://github.com/Andr3as07>
|
||||
# Some changes by Luke
|
||||
# Rebuild by Tenyun
|
||||
|
||||
# This block displays the number running background tasks. Requires tsp.
|
||||
|
||||
num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}')
|
||||
|
||||
# Handle mouse clicks
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e tsp -l ;;
|
||||
3) notify-send "Tasks module" "🤖: number of running/queued background tasks
|
||||
- Left click opens tsp" ;; # Right click
|
||||
2) $EDITOR "$0" ;; # Middle click
|
||||
esac
|
||||
|
||||
[ "$num" != "0(0)" ] &&
|
||||
echo "$num"
|
||||
11
.config/waybar/indicators/statusbar/sb-time
Executable file
11
.config/waybar/indicators/statusbar/sb-time
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
|
||||
2) setsid -f "$TERMINAL" -e calcurse ;;
|
||||
3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
|
||||
- Middle click opens calcurse if installed" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
date "+%I:%M%p"
|
||||
Reference in New Issue
Block a user