initial prep for new DWM
This commit is contained in:
parent
73bc813ce2
commit
6f12f51699
|
@ -1,29 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
clock=$(date '+%I')
|
||||
|
||||
case "$clock" in
|
||||
"00") icon="" ;;
|
||||
"01") icon="" ;;
|
||||
"02") icon="" ;;
|
||||
"03") icon="" ;;
|
||||
"04") icon="" ;;
|
||||
"05") icon="" ;;
|
||||
"06") icon="" ;;
|
||||
"07") icon="" ;;
|
||||
"08") icon="" ;;
|
||||
"09") icon="" ;;
|
||||
"10") icon="" ;;
|
||||
"11") icon="" ;;
|
||||
"12") icon="" ;;
|
||||
esac
|
||||
|
||||
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
|
||||
|
||||
echo " $(date "+%d.%m.%Y $icon %H:%M") "
|
||||
date "+%d.%m.%Y %H:%M"
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 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.
|
||||
# Options can be found at https://wttr.in/:help
|
||||
weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
|
||||
weatheremoji="${XDG_CACHE_HOME:-$HOME/.cache}/weatheremoji"
|
||||
url="wttr.in/Karlsruhe"
|
||||
|
@ -26,28 +19,13 @@ s/🌩//
|
|||
s/🌫//
|
||||
' "${weatheremoji}"
|
||||
}
|
||||
getforecast() { curl -sf "$url$opt" > "$weatherreport" && curl -sf "$url$emojiopt" > "$weatheremoji" || exit 1 ;}
|
||||
|
||||
# Some very particular and terse stream manipulation. We get the maximum
|
||||
# precipitation chance and the daily high and low from the downloaded file and
|
||||
# display them with coresponding emojis.
|
||||
getforecast() { curl -sf "$url$opt" > "$weatherreport" && curl -sf "$url$emojiopt" > "$weatheremoji" ;}
|
||||
showweather() { emoji=$(cat "$weatheremoji") && printf "%s" "$(sed '16q;d' "$weatherreport" |
|
||||
grep -wo "[0-9]*%" | sort -rn | sed "s/^/ $(printf %.1s "$emoji") /g;1q" | tr -d '\n')"
|
||||
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " " $1 "°"," " $2 "°"}' ;}
|
||||
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " " $1 "°"," " $2 "°"}' ;}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;
|
||||
2) getforecast && showweather ;;
|
||||
3) notify-send " Weather module" "\- Left click for full forecast.
|
||||
- Middle click to update forecast.
|
||||
${emoji}: Chance of rain/snow
|
||||
: Daily low
|
||||
: Daily high" ;;
|
||||
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 "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
|
||||
getforecast && convertemoji
|
||||
|
||||
showweather
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The clickable help menu. Middle click to restart wm.
|
||||
|
||||
# If dwm is running, use dwm's readme and restart.
|
||||
pidof dwm >/dev/null &&
|
||||
READMEFILE=/usr/local/share/dwm/larbs.mom
|
||||
restartwm() { pkill -HUP dwm ;} ||
|
||||
restartwm() { i3 restart ;}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) groff -mom "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom}" -Tpdf | zathura - ;;
|
||||
2) restartwm ;;
|
||||
3) notify-send " Help module" "\- Left click to open LARBS guide.
|
||||
- Middle click to refresh window manager." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac; echo ""
|
|
@ -4,5 +4,5 @@
|
|||
# music player's status. mpd must be running on X's start for this to work.
|
||||
|
||||
while : ; do
|
||||
mpc idle >/dev/null && kill -45 "$(pidof "${STATUSBAR:-dwmblocks}")" || break
|
||||
mpc idle >/dev/null && kill -46 "$(pidof dwm)" || break
|
||||
done
|
||||
|
|
|
@ -1,30 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
filter() {
|
||||
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
|
||||
song=$(mpc current -f "%artist% - %title%" | xargs -0 )
|
||||
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
|
||||
mpc | awk 'NR==2' | grep -q playing && icon="" || icon=""
|
||||
echo " $icon $song "
|
||||
echo "$icon $song"
|
||||
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
|
||||
echo " ﱙ "
|
||||
echo "ﱙ"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause
|
||||
2) mpc toggle | filter ;; # right click, pause/unpause
|
||||
3) mpc status | filter ; notify-send " Music module" "\- Shows mpd song playing.
|
||||
- ⏸ when paused.
|
||||
- Left click opens ncmpcpp.
|
||||
- Middle click pauses.
|
||||
- Scroll changes track.";; # right click, pause/unpause
|
||||
4) mpc prev | filter ;; # scroll up, previous
|
||||
5) mpc next | filter ;; # scroll down, next
|
||||
6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
*) mpc status | filter ;;
|
||||
esac
|
||||
|
|
|
@ -2,18 +2,7 @@
|
|||
|
||||
# Prints the current volume or ﱝ if muted.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e pulsemixer ;;
|
||||
2) pamixer -t ;;
|
||||
4) pamixer --allow-boost -i 1 ;;
|
||||
5) pamixer --allow-boost -d 1 ;;
|
||||
3) notify-send "蓼Volume module" "\- Shows volume , ﱝ if muted.
|
||||
- Middle click to mute.
|
||||
- Scroll to change." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
[ $(pamixer --get-mute) = true ] && echo "ﱝ" && exit
|
||||
[ "$(pamixer --get-mute)" = true ] && echo "ﱝ" && exit
|
||||
|
||||
vol="$(pamixer --get-volume)"
|
||||
|
||||
|
@ -29,4 +18,4 @@ else
|
|||
echo " " && exit
|
||||
fi
|
||||
|
||||
echo " $icon $vol% "
|
||||
echo "$icon $vol%"
|
||||
|
|
Loading…
Reference in New Issue