summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rwxr-xr-xarch/eww/.config/eww/scripts/weather-fetch59
-rwxr-xr-xarch/eww/.config/eww/scripts/weather-notify24
-rwxr-xr-xarch/install.sh1
-rw-r--r--arch/nvim/.config/nvim/lazy-lock.json5
-rw-r--r--arch/nvim/.config/nvim/lua/plugins/extras.lua6
-rw-r--r--arch/nvim/.config/nvim/lua/plugins/treesitter.lua8
6 files changed, 83 insertions, 20 deletions
diff --git a/arch/eww/.config/eww/scripts/weather-fetch b/arch/eww/.config/eww/scripts/weather-fetch
index 257dee4..8fa53ac 100755
--- a/arch/eww/.config/eww/scripts/weather-fetch
+++ b/arch/eww/.config/eww/scripts/weather-fetch
@@ -3,7 +3,7 @@
loc_file="$HOME/.config/eww/.weather-location"
loc=$(cat "$loc_file" 2>/dev/null | xargs | sed 's/ /%20/g')
-url="wttr.in/${loc}?format=j1" # empty loc → wttr.in/?format=j1 → IP fallback
+url="wttr.in/${loc}?format=j1"
data=$(curl -sf "$url")
[[ -z "$data" ]] && echo "?°F" && exit 1
@@ -11,16 +11,53 @@ data=$(curl -sf "$url")
temp=$(echo "$data" | jq -r '.current_condition[0].temp_F')
code=$(echo "$data" | jq -r '.current_condition[0].weatherCode')
-case "$code" in
- 113) icon="󰖙" ;;
- 116) icon="󰖕" ;;
- 119|122) icon="󰖐" ;;
- 143|248|260) icon="󰖑" ;;
- 200|386|389|392|395) icon="󰖓" ;;
- 227|230|323|326|329|332|335|338|368|371) icon="󰖘" ;;
- 182|185|281|284|311|314|317|320|350|362|365|374|377) icon="󰖒" ;;
- *) icon="󰖗" ;;
-esac
+# ── Night check ────────────────────────────────────────────────────────────
+sunset_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunset')
+sunset_epoch=$(date -d "today $sunset_raw" +%s 2>/dev/null)
+now_epoch=$(date +%s)
+is_night=false
+[[ $now_epoch -ge $sunset_epoch ]] && is_night=true
+
+# ── Moon phase ─────────────────────────────────────────────────────────────
+moon_icon() {
+ local ref; ref=$(date -d "2000-01-06" +%s) # known new moon
+ local days=$(( ($(date +%s) - ref) / 86400 ))
+ local phase=$(( days % 29 ))
+ if [[ $phase -le 1 ]]; then echo "󰽤" # new
+ elif [[ $phase -le 7 ]]; then echo "󰽧" # waxing crescent
+ elif [[ $phase -le 8 ]]; then echo "󰽡" # first quarter
+ elif [[ $phase -le 14 ]]; then echo "󰽨" # waxing gibbous
+ elif [[ $phase -le 15 ]]; then echo "󰽢" # full
+ elif [[ $phase -le 21 ]]; then echo "󰽦" # waning gibbous
+ elif [[ $phase -le 22 ]]; then echo "󰽣" # last quarter
+ else echo "󰽥" # waning crescent
+ fi
+}
+
+# ── Icon selection ─────────────────────────────────────────────────────────
+if $is_night; then
+ case "$code" in
+ 113) icon=$(moon_icon) ;; # clear → moon phase
+ 116) icon="" ;; # nf-fa-cloud_moon
+ 119|122) icon="" ;; # overcast (no moon visible)
+ 143|248|260) icon="" ;; # fog/mist
+ 200|386|389|392|395) icon="" ;; # nf-fa-cloud_moon_rain (thunder)
+ 227|230|323|326|329|332|335|338|368|371) icon="" ;; # snow (no night variant needed)
+ 182|185|281|284|311|314|317|320|350|362|365|374|377) icon="" ;; # nf-fa-cloud_moon_rain (sleet)
+ *) icon="" ;; # nf-fa-cloud_moon_rain (rain)
+ esac
+else
+ case "$code" in
+ 113) icon="󰖙" ;;
+ 116) icon="󰖕" ;;
+ 119|122) icon="󰖐" ;;
+ 143|248|260) icon="" ;;
+ 200|386|389|392|395) icon="" ;;
+ 227|230|323|326|329|332|335|338|368|371) icon="" ;;
+ 182|185|281|284|311|314|317|320|350|362|365|374|377) icon="" ;;
+ *) icon="" ;;
+ esac
+fi
sign=$([ "$temp" -ge 0 ] && echo "+" || echo "")
echo "${sign}${temp}°F ${icon}"
diff --git a/arch/eww/.config/eww/scripts/weather-notify b/arch/eww/.config/eww/scripts/weather-notify
index ab78acb..fc95df0 100755
--- a/arch/eww/.config/eww/scripts/weather-notify
+++ b/arch/eww/.config/eww/scripts/weather-notify
@@ -14,6 +14,26 @@ desc=$(echo "$data" | jq -r '.current_condition[0].weatherDesc[0].value')
high=$(echo "$data" | jq -r '.weather[0].maxtempF')
low=$(echo "$data" | jq -r '.weather[0].mintempF')
+# ── Night / moon ───────────────────────────────────────────────────────────
+sunset_raw=$(echo "$data" | jq -r '.weather[0].astronomy[0].sunset')
+sunset_epoch=$(date -d "today $sunset_raw" +%s 2>/dev/null)
+is_night=false
+[[ $(date +%s) -ge $sunset_epoch ]] && is_night=true
+
+moon_phase() {
+ local ref; ref=$(date -d "2000-01-06" +%s)
+ local phase=$(( ( ($(date +%s) - ref) / 86400 ) % 29 ))
+ if [[ $phase -le 1 ]]; then echo "New Moon"
+ elif [[ $phase -le 7 ]]; then echo "Waxing Crescent"
+ elif [[ $phase -le 8 ]]; then echo "First Quarter"
+ elif [[ $phase -le 14 ]]; then echo "Waxing Gibbous"
+ elif [[ $phase -le 15 ]]; then echo "Full Moon"
+ elif [[ $phase -le 21 ]]; then echo "Waning Gibbous"
+ elif [[ $phase -le 22 ]]; then echo "Last Quarter"
+ else echo "Waning Crescent"
+ fi
+}
+
sign() { [ "$1" -ge 0 ] && echo "+" || echo ""; }
line1="$(sign $temp)${temp}°F, ${desc}"
@@ -22,3 +42,7 @@ line2="Feels $(sign $feels)${feels}° · ↑$(sign $high)${high} ↓$(sign $low)
notify-send --urgency=low --expire-time=5000 \
--icon=weather-clear \
"Weather" "${line1}\n${line2}"
+
+$is_night && notify-send --urgency=low --expire-time=5000 \
+ --icon=weather-clear \
+ "Moon" "$(moon_phase)"
diff --git a/arch/install.sh b/arch/install.sh
index b7bc2e4..638a75d 100755
--- a/arch/install.sh
+++ b/arch/install.sh
@@ -87,6 +87,7 @@ pacman_packages+=(
# ── Fonts ─────────────────────────────────────────────────────────────────────
pacman_packages+=(
ttf-jetbrains-mono-nerd
+ ttf-cascadia-code-nerd
noto-fonts
noto-fonts-emoji
noto-fonts-cjk
diff --git a/arch/nvim/.config/nvim/lazy-lock.json b/arch/nvim/.config/nvim/lazy-lock.json
index f69f91a..4d993a2 100644
--- a/arch/nvim/.config/nvim/lazy-lock.json
+++ b/arch/nvim/.config/nvim/lazy-lock.json
@@ -17,15 +17,14 @@
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
"nvim-lint": { "branch": "master", "commit": "eab58b48eb11d7745c11c505e0f3057165902461" },
- "nvim-lspconfig": { "branch": "master", "commit": "f7e89f3d19fb436e1fbeff3bf4291eef35da94e3" },
+ "nvim-lspconfig": { "branch": "master", "commit": "31026a13eefb20681124706a79fc1df6bf11ab27" },
"nvim-surround": { "branch": "main", "commit": "61319d4bd1c5e336e197defa15bd104c51f0fb29" },
- "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
+ "nvim-treesitter": { "branch": "main", "commit": "cfc6f2c117aaaa82f19bcce44deec2c194d900ab" },
"nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" },
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" },
"undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" },
"vim-tmux-navigator": { "branch": "master", "commit": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432" },
- "vim-tpipeline": { "branch": "master", "commit": "9c1fc6a9aed96a6ff5f5cb0420e3760e95dfb1c1" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}
diff --git a/arch/nvim/.config/nvim/lua/plugins/extras.lua b/arch/nvim/.config/nvim/lua/plugins/extras.lua
index c3f2492..3eb0eaf 100644
--- a/arch/nvim/.config/nvim/lua/plugins/extras.lua
+++ b/arch/nvim/.config/nvim/lua/plugins/extras.lua
@@ -32,6 +32,7 @@ return {
opts = {
default_file_explorer = true,
view_options = { show_hidden = true },
+ constrain_cursor = false,
},
},
{
@@ -42,6 +43,7 @@ return {
ignoredFiletypes = {
"oil",
"snacks_dashboard",
+ "lazy",
},
}, -- specify options here
config = function(_, opts)
@@ -61,6 +63,10 @@ return {
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI", "BufEnter" }, {
group = vim.api.nvim_create_augroup("ScrollOffEOF", { clear = true }),
callback = function()
+ if vim.bo.filetype == "oil" then
+ return
+ end
+
local win_h = vim.api.nvim_win_get_height(0)
local off = math.min(SCROLLOFF, math.floor(win_h / 2))
local line = vim.fn.line(".")
diff --git a/arch/nvim/.config/nvim/lua/plugins/treesitter.lua b/arch/nvim/.config/nvim/lua/plugins/treesitter.lua
index 679d3d9..3716860 100644
--- a/arch/nvim/.config/nvim/lua/plugins/treesitter.lua
+++ b/arch/nvim/.config/nvim/lua/plugins/treesitter.lua
@@ -1,6 +1,7 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
+ tag = "v0.9.3",
event = { "BufReadPre", "BufNewFile" },
opts = {
ensure_installed = {
@@ -25,11 +26,6 @@ return {
auto_install = false,
},
config = function(_, opts)
- local ok = pcall(require, "nvim-treesitter.configs")
- if ok then
- require("nvim-treesitter.configs").setup(opts)
- else
- require("nvim-treesitter").setup(opts)
- end
+ require("nvim-treesitter.configs").setup(opts)
end,
}