desktop: wttr.in -> open-meteo, add blueman
Some checks failed
Update Site / trigger_update (push) Has been cancelled

This commit is contained in:
Pavel Korytov 2025-11-25 14:37:43 +03:00
parent 68d3359644
commit cd387f0e6b
5 changed files with 253 additions and 20 deletions

View file

@ -0,0 +1,6 @@
[Unit]
Description=Autocommit org-mode
[Service]
Type=oneshot
ExecStart=/usr/bin/bash /home/pavel/bin/scripts/autocommit "/home/pavel/30-39 Life/32 org-mode"

View file

@ -0,0 +1,6 @@
[Unit]
Description=Autocommit .password-store
[Service]
Type=oneshot
ExecStart=/usr/bin/bash /home/pavel/bin/scripts/autocommit "/home/pavel/.password-store"

View file

@ -0,0 +1,8 @@
[Unit]
Description=Blueman
[Service]
ExecStart=/usr/bin/blueman-applet
[Install]
WantedBy=wm-session.target

View file

@ -2735,20 +2735,118 @@ format-warn-background = <<get-polybar-bg(module="battery")>>
*** weather *** weather
Gets current weather from [[http://wttr.in/][wttr.in]] Gets current weather from [[http://wttr.in/][wttr.in]]
#+begin_src bash :tangle ./bin/polybar/weather.sh #+begin_src bash :tangle ./bin/polybar/weather.sh
bar_format="${BAR_FORMAT:-"%t"}" # Configuration - can be overridden by environment variables
location="${LOCATION:-"Saint-Petersburg"}" bar_format="${BAR_FORMAT:-"%i %t"}" # %t = temp, %c = condition, %i = icon, %w = wind
format_1=${FORMAT_1:-"qF"} location="${LOCATION:-"St+Petersburg"}"
format_2=${FORMAT_1:-"format=v2n"} units="${UNITS:-celsius}" # celsius or fahrenheit
bar_weather=$(curl -s wttr.in/${location}?format=${bar_format} || echo "??") # WMO weather code to emoji mapping
if [ -z "$bar_weather" ]; then get_weather_icon() {
exit 1 case $1 in
elif [[ "$bar_weather" == *"Unknown"* || "$bar_weather" == *"Sorry"* || "$bar_weather" == *"Bad Gateway"* ]]; then 0) echo "☀️";; # Clear sky
1) echo "🌤️";; # Mainly clear
2) echo "⛅";; # Partly cloudy
3) echo "☁️";; # Overcast
45|48) echo "🌫️";; # Fog
51|53|55) echo "🌧️";; # Drizzle
56|57) echo "🌧️";; # Freezing drizzle
61|63|65) echo "🌧️";; # Rain
66|67) echo "🌨️";; # Freezing rain
71|73|75|77) echo "❄️";; # Snow
80|81|82) echo "🌧️";; # Showers
85|86) echo "🌨️";; # Snow showers
95) echo "⛈️";; # Thunderstorm
96|99) echo "⛈️";; # Thunderstorm with hail
,*) echo "?";;
esac
}
# WMO weather code to description
get_weather_desc() {
case $1 in
0) echo "Clear";;
1) echo "Mostly Clear";;
2) echo "Partly Cloudy";;
3) echo "Cloudy";;
45) echo "Fog";;
48) echo "Rime Fog";;
51) echo "Light Drizzle";;
53) echo "Drizzle";;
55) echo "Heavy Drizzle";;
56|57) echo "Freezing Drizzle";;
61) echo "Light Rain";;
63) echo "Rain";;
65) echo "Heavy Rain";;
66|67) echo "Freezing Rain";;
71) echo "Light Snow";;
73) echo "Snow";;
75) echo "Heavy Snow";;
77) echo "Snow Grains";;
80) echo "Light Showers";;
81) echo "Showers";;
82) echo "Heavy Showers";;
85|86) echo "Snow Showers";;
95) echo "Thunderstorm";;
96|99) echo "Thunderstorm+Hail";;
,*) echo "Unknown";;
esac
}
# Get coordinates from city name using Open-Meteo Geocoding API
geo_response=$(curl -sf "https://geocoding-api.open-meteo.com/v1/search?name=${location}&count=1" 2>/dev/null)
if [ -z "$geo_response" ]; then
echo "??" echo "??"
exit 1 exit 1
else
echo ${bar_weather}
fi fi
lat=$(echo "$geo_response" | jq -r '.results[0].latitude // empty')
lon=$(echo "$geo_response" | jq -r '.results[0].longitude // empty')
if [ -z "$lat" ] || [ -z "$lon" ]; then
echo "??"
exit 1
fi
# Build temperature unit parameter
temp_unit="celsius"
[ "$units" = "fahrenheit" ] && temp_unit="fahrenheit"
# Get current weather from Open-Meteo API
weather_response=$(curl -sf "https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,weather_code,wind_speed_10m&temperature_unit=${temp_unit}" 2>/dev/null)
if [ -z "$weather_response" ]; then
echo "??"
exit 1
fi
# Parse weather data
temp=$(echo "$weather_response" | jq -r '.current.temperature_2m // empty')
code=$(echo "$weather_response" | jq -r '.current.weather_code // empty')
wind=$(echo "$weather_response" | jq -r '.current.wind_speed_10m // empty')
if [ -z "$temp" ] || [ -z "$code" ]; then
echo "??"
exit 1
fi
# Get icon and description
icon=$(get_weather_icon "$code")
desc=$(get_weather_desc "$code")
# Round temperature
temp_rounded=$(printf "%.0f" "$temp")
# Unit symbol
unit_symbol="°C"
[ "$units" = "fahrenheit" ] && unit_symbol="°F"
# Format output based on BAR_FORMAT
output="$bar_format"
output="${output//%t/${temp_rounded}${unit_symbol}}"
output="${output//%c/${desc}}"
output="${output//%i/${icon}}"
output="${output//%w/${wind}km\/h}"
echo "$output"
#+end_src #+end_src
#+begin_src conf-windows :noweb yes #+begin_src conf-windows :noweb yes
@ -4515,6 +4613,22 @@ ExecStart=/usr/bin/flameshot
[Install] [Install]
WantedBy=wm-session.target WantedBy=wm-session.target
#+end_src #+end_src
** blueman
=blueman= is a GUI bluetooth manager.
There's a built-in service, but it misses the install section for some reason.
#+begin_src conf :tangle .config/systemd/user/blueman.service
[Unit]
Description=Blueman
[Service]
ExecStart=/usr/bin/blueman-applet
[Install]
WantedBy=wm-session.target
#+end_src
* Arch settings * Arch settings
Other desktop programs I use are listed below. Other desktop programs I use are listed below.
@ -4544,6 +4658,7 @@ Other desktop programs I use are listed below.
| desktop-misc | remmina | | | desktop-misc | remmina | |
| desktop-misc | android-file-transfer | | | desktop-misc | android-file-transfer | |
| desktop-misc | veracrypt | | | desktop-misc | veracrypt | |
| desktop-misc | gucharmap | View charmaps |
#+NAME: packages #+NAME: packages
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no

View file

@ -1,17 +1,115 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# [[file:../../Desktop.org::*weather][weather:1]] # [[file:../../Desktop.org::*weather][weather:1]]
bar_format="${BAR_FORMAT:-"%t"}" # Configuration - can be overridden by environment variables
location="${LOCATION:-"Saint-Petersburg"}" bar_format="${BAR_FORMAT:-"%i %t"}" # %t = temp, %c = condition, %i = icon, %w = wind
format_1=${FORMAT_1:-"qF"} location="${LOCATION:-"St+Petersburg"}"
format_2=${FORMAT_1:-"format=v2n"} units="${UNITS:-celsius}" # celsius or fahrenheit
bar_weather=$(curl -s wttr.in/${location}?format=${bar_format} || echo "??") # WMO weather code to emoji mapping
if [ -z "$bar_weather" ]; then get_weather_icon() {
exit 1 case $1 in
elif [[ "$bar_weather" == *"Unknown"* || "$bar_weather" == *"Sorry"* || "$bar_weather" == *"Bad Gateway"* ]]; then 0) echo "☀️";; # Clear sky
1) echo "🌤️";; # Mainly clear
2) echo "⛅";; # Partly cloudy
3) echo "☁️";; # Overcast
45|48) echo "🌫️";; # Fog
51|53|55) echo "🌧️";; # Drizzle
56|57) echo "🌧️";; # Freezing drizzle
61|63|65) echo "🌧️";; # Rain
66|67) echo "🌨️";; # Freezing rain
71|73|75|77) echo "❄️";; # Snow
80|81|82) echo "🌧️";; # Showers
85|86) echo "🌨️";; # Snow showers
95) echo "⛈️";; # Thunderstorm
96|99) echo "⛈️";; # Thunderstorm with hail
*) echo "?";;
esac
}
# WMO weather code to description
get_weather_desc() {
case $1 in
0) echo "Clear";;
1) echo "Mostly Clear";;
2) echo "Partly Cloudy";;
3) echo "Cloudy";;
45) echo "Fog";;
48) echo "Rime Fog";;
51) echo "Light Drizzle";;
53) echo "Drizzle";;
55) echo "Heavy Drizzle";;
56|57) echo "Freezing Drizzle";;
61) echo "Light Rain";;
63) echo "Rain";;
65) echo "Heavy Rain";;
66|67) echo "Freezing Rain";;
71) echo "Light Snow";;
73) echo "Snow";;
75) echo "Heavy Snow";;
77) echo "Snow Grains";;
80) echo "Light Showers";;
81) echo "Showers";;
82) echo "Heavy Showers";;
85|86) echo "Snow Showers";;
95) echo "Thunderstorm";;
96|99) echo "Thunderstorm+Hail";;
*) echo "Unknown";;
esac
}
# Get coordinates from city name using Open-Meteo Geocoding API
geo_response=$(curl -sf "https://geocoding-api.open-meteo.com/v1/search?name=${location}&count=1" 2>/dev/null)
if [ -z "$geo_response" ]; then
echo "??" echo "??"
exit 1 exit 1
else
echo ${bar_weather}
fi fi
lat=$(echo "$geo_response" | jq -r '.results[0].latitude // empty')
lon=$(echo "$geo_response" | jq -r '.results[0].longitude // empty')
if [ -z "$lat" ] || [ -z "$lon" ]; then
echo "??"
exit 1
fi
# Build temperature unit parameter
temp_unit="celsius"
[ "$units" = "fahrenheit" ] && temp_unit="fahrenheit"
# Get current weather from Open-Meteo API
weather_response=$(curl -sf "https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,weather_code,wind_speed_10m&temperature_unit=${temp_unit}" 2>/dev/null)
if [ -z "$weather_response" ]; then
echo "??"
exit 1
fi
# Parse weather data
temp=$(echo "$weather_response" | jq -r '.current.temperature_2m // empty')
code=$(echo "$weather_response" | jq -r '.current.weather_code // empty')
wind=$(echo "$weather_response" | jq -r '.current.wind_speed_10m // empty')
if [ -z "$temp" ] || [ -z "$code" ]; then
echo "??"
exit 1
fi
# Get icon and description
icon=$(get_weather_icon "$code")
desc=$(get_weather_desc "$code")
# Round temperature
temp_rounded=$(printf "%.0f" "$temp")
# Unit symbol
unit_symbol="°C"
[ "$units" = "fahrenheit" ] && unit_symbol="°F"
# Format output based on BAR_FORMAT
output="$bar_format"
output="${output//%t/${temp_rounded}${unit_symbol}}"
output="${output//%c/${desc}}"
output="${output//%i/${icon}}"
output="${output//%w/${wind}km\/h}"
echo "$output"
# weather:1 ends here # weather:1 ends here