no ping and other tweaks
This commit is contained in:
parent
5caaa489ac
commit
60e6128754
3 changed files with 15 additions and 10 deletions
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
# Syncs repositories and downloads updates, meant to be run as a cronjob.
|
# Syncs repositories and downloads updates, meant to be run as a cronjob.
|
||||||
|
|
||||||
ping -q -c 1 example.org > /dev/null || exit
|
|
||||||
|
|
||||||
notify-send "📦 Repository Sync" "Checking for package updates..."
|
notify-send "📦 Repository Sync" "Checking for package updates..."
|
||||||
|
|
||||||
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
|
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
# Set as a cron job to check for new RSS entries for newsboat.
|
# Set as a cron job to check for new RSS entries for newsboat.
|
||||||
# If newsboat is open, sends it an "R" key to refresh.
|
# If newsboat is open, sends it an "R" key to refresh.
|
||||||
|
|
||||||
ping -q -c 1 example.org > /dev/null || exit
|
|
||||||
|
|
||||||
/usr/bin/notify-send "📰 Updating RSS feeds..."
|
/usr/bin/notify-send "📰 Updating RSS feeds..."
|
||||||
|
|
||||||
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
|
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
|
||||||
|
|
|
@ -11,12 +11,14 @@
|
||||||
currency="${4:-usd}"
|
currency="${4:-usd}"
|
||||||
interval="@14d" # History contained in chart preceded by '@' (7d = 7 days)
|
interval="@14d" # History contained in chart preceded by '@' (7d = 7 days)
|
||||||
dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices"
|
dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices"
|
||||||
pricefile="$dir/$1"
|
pricefile="$dir/$1-$currency"
|
||||||
chartfile="$dir/$1-chart"
|
chartfile="$dir/$1-$currency-chart"
|
||||||
|
|
||||||
updateprice() { ping -q -c 1 example.org >/dev/null 2>&1 &&
|
updateprice() { temp="$(mktemp)"
|
||||||
curl -s "$currency.rate.sx/1$1" > "$pricefile" &&
|
curl -s "$currency.rate.sx/1$1" > "$temp" &&
|
||||||
curl -s "$currency.rate.sx/$1$interval" > "$chartfile" ;}
|
mv -f "$temp" "$pricefile" &&
|
||||||
|
curl -s "$currency.rate.sx/$1$interval" > "$temp" &&
|
||||||
|
mv -f "$temp" "$chartfile" ;}
|
||||||
|
|
||||||
[ -d "$dir" ] || mkdir -p "$dir"
|
[ -d "$dir" ] || mkdir -p "$dir"
|
||||||
|
|
||||||
|
@ -38,4 +40,11 @@ case $BLOCK_BUTTON in
|
||||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "$3%0.2f$currency" "$(cat "$pricefile")"
|
case "$currency" in
|
||||||
|
usd) symb="$" ;;
|
||||||
|
gbp) symb="£" ;;
|
||||||
|
eur) symb="€" ;;
|
||||||
|
btc) symb="₿" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "$3$symb%0.2f$after" "$(cat "$pricefile")"
|
||||||
|
|
Loading…
Reference in a new issue