Browse Source

Merge pull request #242 from SherLock707/development

Hyprlock weather delay fix
pull/243/head
Ja.KooLit 2 years ago committed by GitHub
parent
commit
6e3d093a44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      config/hypr/UserScripts/Weather.py
  2. 4
      config/hypr/UserScripts/Weather.sh
  3. 2
      config/hypr/hyprlock.conf

14
config/hypr/UserScripts/Weather.py

@ -3,7 +3,7 @@
import subprocess
from pyquery import PyQuery # install using `pip install pyquery`
import json
import os
# original code https://gist.github.com/Surendrajat/ff3876fd2166dd86fb71180f4e9342d7
# weather icons
@ -122,3 +122,15 @@ out_data = {
"class": status_code,
}
print(json.dumps(out_data))
simple_weather =f"{icon} {status}\n" + \
f" {temp} ({temp_feel_text})\n" + \
f"{wind_text}\n" + \
f"{humidity_text}\n" + \
f"{visbility_text} AQI {air_quality_index}\n"
try:
with open(os.path.expanduser("~/.cache/.weather_cache"), "w") as file:
file.write(simple_weather)
except:
pass

4
config/hypr/UserScripts/Weather.sh

@ -78,3 +78,7 @@ esac
#echo $temp $condition
echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
cached_weather=" $temperature \n$condition ${weather[1]}"
echo -e $cached_weather > ~/.cache/.weather_cache

2
config/hypr/hyprlock.conf

@ -110,7 +110,7 @@ label {
# weather edit specific location. Note, this cause a 2-4 seconds delay in locking
label {
monitor =
text = cmd[update:3600000] ping -c 1 wttr.in > /dev/null && curl -s 'wttr.in?format=2' # For specific location : wttr.in/busan?format=2
text = cmd[update:3600000] [ -f ~/.cache/.weather_cache ] && cat ~/.cache/.weather_cache
color = $color10
font_size = 24
font_family = JetBrains Mono Nerd Font 10

Loading…
Cancel
Save