diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-29 10:51:32 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-29 10:51:32 +0900 |
| commit | a79416f5eb2de2d9505704911dfca4b048157f2c (patch) | |
| tree | f26ee953809b1f7931956887d88bcc67ac0c60ab /ar | |
| parent | 2ab2c7b0f8f9cf3e6613d2a2a1cf19cc4a69f8d6 (diff) | |
modified statusbar/sb-clock, modified statusbar/sb-forecast, created plugins/auto-tag.lua
Diffstat (limited to 'ar')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/auto-tag.lua | 7 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-clock | 19 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-forecast | 8 |
3 files changed, 29 insertions, 5 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/auto-tag.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/auto-tag.lua new file mode 100644 index 0000000..5ca8008 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/auto-tag.lua @@ -0,0 +1,7 @@ +return { + "windwp/nvim-ts-autotag", + ft = { "javascript", "javascriptreact", "typescript", "typescriptreact" }, + config = function() + require("nvim-ts-autotag").setup() + end, +} diff --git a/ar/.local/bin/statusbar/sb-clock b/ar/.local/bin/statusbar/sb-clock index d909326..d4110be 100755 --- a/ar/.local/bin/statusbar/sb-clock +++ b/ar/.local/bin/statusbar/sb-clock @@ -43,15 +43,26 @@ else fi # Shows the current moon phase. -location=$(curl -s http://ip-api.com/json | jq -r '[.regionName, .countryCode] | join(",")') +locationfile="${XDG_CACHE_HOME:-${HOME}/.cache}/statusbar/location" moonfile="${XDG_DATA_HOME:-${HOME}/.local/share}/wallpapers/moonphase" +# Cache location for 24 hours +if [ ! -s "$locationfile" ] || [ $(($(date +%s) - $(stat -c %Y "$locationfile" 2>/dev/null || echo 0))) -gt 86400 ]; then + mkdir -p "${XDG_CACHE_HOME:-${HOME}/.cache}/statusbar" + curl -s http://ip-api.com/json | jq -r '[.regionName, .countryCode] | join(",")' > "$locationfile" 2>/dev/null & +fi + +location=$(cat "$locationfile" 2>/dev/null || echo "") + +# Update moon phase only once per day if [ ! -s "$moonfile" ] || [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ]; then - moon=$(curl -sf "wttr.in/$location?format=%m") - [ -n "$moon" ] && grep -vq 'Unknown location' "$moon" && echo "$moon" >"$moonfile" + if [ -n "$location" ]; then + moon=$(curl -sf "wttr.in/$location?format=%m" 2>/dev/null) + [ -n "$moon" ] && ! echo "$moon" | grep -q 'Unknown location' && echo "$moon" >"$moonfile" & + fi fi -moonicon="$(cat "$moonfile")" +moonicon="$(cat "$moonfile" 2>/dev/null)" case $BLOCK_BUTTON in 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%B' | tr -d ' ')\>/<b><span color='blue'>&<\/span><\/b>/;s/\<$(date +'%Y' | sed 's/ //g')\>/<b><span color='blue'>&<\/span><\/b>/;s/\<$(date +'%B' | sed 's/ //g')\>/<b><span color='blue'>&<\/span><\/b>/;s/\<$(date +'%e' | sed 's/ //g')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; diff --git a/ar/.local/bin/statusbar/sb-forecast b/ar/.local/bin/statusbar/sb-forecast index 65bcd1a..af3c7fd 100755 --- a/ar/.local/bin/statusbar/sb-forecast +++ b/ar/.local/bin/statusbar/sb-forecast @@ -3,7 +3,13 @@ # Displays today's snow chance (🏂), precipication chance (☔), humidity (💧), wind speed (🎐), and current (feel like) temperature (🌞). # Usually intended for the statusbar. -location=$(curl -s http://ip-api.com/json | jq -r '[.regionName, .countryCode] | join(",")') +# Cache location for 24 hours +locationfile="${XDG_CACHE_HOME:-${HOME}/.cache}/statusbar/location" +if [ ! -s "$locationfile" ] || [ $(($(date +%s) - $(stat -c %Y "$locationfile" 2>/dev/null || echo 0))) -gt 86400 ]; then + mkdir -p "${XDG_CACHE_HOME:-${HOME}/.cache}/statusbar" + curl -s http://ip-api.com/json 2>/dev/null | jq -r '[.regionName, .countryCode] | join(",")' > "$locationfile" 2>/dev/null || true +fi +location=$(cat "$locationfile" 2>/dev/null || echo "") url="${WTTRURL:-wttr.in}" weatherreport="${XDG_CACHE_HOME:-${HOME}/.cache}/weatherreport" |
