assume default values if xdg dirs not set
This commit is contained in:
@@ -4,7 +4,7 @@ date '+%Y %b %d (%a) %I:%M%p'
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
|
||||
2) $TERMINAL -e calcurse -D $XDG_CONFIG_HOME/calcurse ;;
|
||||
2) $TERMINAL -e calcurse -D ${XDG_CONFIG_HOME:$HOME/.config}/calcurse ;;
|
||||
3) pgrep -x dunst >/dev/null && 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" ;;
|
||||
esac
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) groff -mom $XDG_DATA_HOME/larbs/readme.mom -Tpdf | zathura - ;;
|
||||
1) groff -mom ${XDG_DATA_HOME:$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - ;;
|
||||
2) i3 restart ;;
|
||||
3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide.
|
||||
- Middle click to refresh i3.";;
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
|
||||
ifinstalled "geoiplookup" || exit
|
||||
addr="$(curl ifconfig.me 2>/dev/null)" || exit
|
||||
grep "flag: " $XDG_CONFIG_HOME/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
|
||||
grep "flag: " ${XDG_CONFIG_HOME:$HOME/.config}/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
|
||||
|
||||
@@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
|
||||
- Middle click syncs mail" ;;
|
||||
esac
|
||||
|
||||
unread="$(find $XDG_DATA_HOME/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)"
|
||||
unread="$(find ${XDG_DATA_HOME:$HOME/.local/share}/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)"
|
||||
|
||||
icon="$(cat "/tmp/imapsyncicon_$USER")"
|
||||
|
||||
|
||||
@@ -14,4 +14,4 @@ case $BLOCK_BUTTON in
|
||||
<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;;
|
||||
esac
|
||||
|
||||
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰 " $1}' | sed s/^0$//g)$(cat $XDG_CONFIG_HOME/newsboat/.update 2>/dev/null)"
|
||||
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰 " $1}' | sed s/^0$//g)$(cat ${XDG_CONFIG_HOME:$HOME/.config}/newsboat/.update 2>/dev/null)"
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
# 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.
|
||||
getforecast() { ping -q -c 1 1.1.1.1 >/dev/null &&
|
||||
curl -sf "wttr.in/$LOCATION" > "$XDG_DATA_HOME/weatherreport" || exit 1 ;}
|
||||
curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" || exit 1 ;}
|
||||
|
||||
# Some very particular and terse stream manipulation. We get the maximum
|
||||
# precipication chance and the daily high and low from the downloaded file and
|
||||
# display them with coresponding emojis.
|
||||
showweather() { printf "%s" "$(sed '16q;d' "$XDG_DATA_HOME/weatherreport" |
|
||||
showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" |
|
||||
grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔ /g;1q" | tr -d '\n')"
|
||||
sed '13q;d' "$XDG_DATA_HOME/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' ;}
|
||||
sed '13q;d' "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' ;}
|
||||
|
||||
# The BLOCK_BUTTON bloat for clicking in i3.
|
||||
case $BLOCK_BUTTON in
|
||||
1) $TERMINAL -e less -Srf "$XDG_DATA_HOME/weatherreport" ;;
|
||||
1) $TERMINAL -e less -Srf "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" ;;
|
||||
2) getforecast && showweather ;;
|
||||
3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast.
|
||||
- Middle click to update forecast.
|
||||
@@ -29,7 +29,7 @@ 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 "$XDG_DATA_HOME/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
|
||||
[ "$(stat -c %y "${XDG_DATA_HOME:$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
|
||||
getforecast
|
||||
|
||||
showweather
|
||||
|
||||
Reference in New Issue
Block a user