From 45ee293d35284642fb31880ec26843e8562f632c Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 26 Dec 2021 14:56:06 +0100 Subject: [PATCH] weather: do not make it depend on polybar It's not used only by polybar and can be run before or after it. --- bin/{polybar-weather => weather} | 4 ++-- dotfiles/systemd/i3-session.target | 2 -- .../systemd/{polybar-weather.service => weather.service} | 6 ++---- dotfiles/systemd/{polybar-weather.timer => weather.timer} | 0 dotfiles/systemd/xsession.target | 4 +++- 5 files changed, 7 insertions(+), 9 deletions(-) rename bin/{polybar-weather => weather} (98%) rename dotfiles/systemd/{polybar-weather.service => weather.service} (66%) rename dotfiles/systemd/{polybar-weather.timer => weather.timer} (100%) diff --git a/bin/polybar-weather b/bin/weather similarity index 98% rename from bin/polybar-weather rename to bin/weather index 9fba65d..61ca028 100755 --- a/bin/polybar-weather +++ b/bin/weather @@ -11,7 +11,7 @@ import subprocess import time from systemd import journal -logger = logging.getLogger("polybar-weather") +logger = logging.getLogger("weather") def get_location(): @@ -95,7 +95,7 @@ def update_status(status, output): f.write(status) # Send it to polybar - subprocess.run(["polybar-msg", "action", f"#weather.send.{status}"], check=True) + subprocess.run(["polybar-msg", "action", f"#weather.send.{status}"]) if __name__ == "__main__": diff --git a/dotfiles/systemd/i3-session.target b/dotfiles/systemd/i3-session.target index 25b596e..4448688 100644 --- a/dotfiles/systemd/i3-session.target +++ b/dotfiles/systemd/i3-session.target @@ -3,8 +3,6 @@ Description=i3 session BindsTo=graphical-session.target Wants=wallpaper.service Wants=wallpaper.timer -Wants=polybar-weather.service -Wants=polybar-weather.timer Wants=polybar.service Wants=i3-companion.service Wants=misc-x.service diff --git a/dotfiles/systemd/polybar-weather.service b/dotfiles/systemd/weather.service similarity index 66% rename from dotfiles/systemd/polybar-weather.service rename to dotfiles/systemd/weather.service index 3f525be..fc6096b 100644 --- a/dotfiles/systemd/polybar-weather.service +++ b/dotfiles/systemd/weather.service @@ -1,14 +1,12 @@ [Unit] -Description=Update weather for Polybar +Description=Update weather PartOf=graphical-session.target -After=polybar.service -Requisite=polybar.service [Service] # Get one from https://openweathermap.org/, it's free Environment=OWM_API_KEY=81687c78e0376836871a6cb9fc347249 ExecStart=/usr/bin/mkdir -p %t/i3 -ExecStart=%h/.config/i3/bin/polybar-weather +ExecStart=%h/.config/i3/bin/weather Type=oneshot RemainAfterExit=false Restart=on-failure diff --git a/dotfiles/systemd/polybar-weather.timer b/dotfiles/systemd/weather.timer similarity index 100% rename from dotfiles/systemd/polybar-weather.timer rename to dotfiles/systemd/weather.timer diff --git a/dotfiles/systemd/xsession.target b/dotfiles/systemd/xsession.target index 9248ce9..fd198d5 100644 --- a/dotfiles/systemd/xsession.target +++ b/dotfiles/systemd/xsession.target @@ -5,11 +5,13 @@ Wants=autorandr.service Wants=dunst.socket Wants=inputplug.service Wants=picom.service -Wants=pulseaudio.socket Wants=policykit-agent.service +Wants=pulseaudio.socket Wants=redshift.service Wants=spotify-clean.timer Wants=ssh-agent.service +Wants=weather.service +Wants=weather.timer Wants=xiccd.service Wants=xsettingsd.service Wants=xss-lock.service