From 7ae0ced2c0383e25f3c835f77f91bdcac4e2751d Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 25 Jan 2023 02:30:17 +0100 Subject: [PATCH] Add custom wm-ready systemd target, and run wl-gammarelay on it --- home/.config/hypr/hyprland.conf | 1 + home/.config/systemd/user/wl-gammarelay.service | 5 +++-- home/.config/systemd/user/wm-ready.target | 3 +++ .../systemd/user/wm-ready.target.wants/wl-gammarelay.service | 1 + home/.local/bin/scripts/gui/hyprland/launch-hypr | 4 ++++ 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 home/.config/systemd/user/wm-ready.target create mode 120000 home/.config/systemd/user/wm-ready.target.wants/wl-gammarelay.service diff --git a/home/.config/hypr/hyprland.conf b/home/.config/hypr/hyprland.conf index f1f6095..7247333 100644 --- a/home/.config/hypr/hyprland.conf +++ b/home/.config/hypr/hyprland.conf @@ -14,6 +14,7 @@ exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = systemctl --user start xdg-desktop-portal-hyprland +exec-once = systemctl --user start wm-ready.target exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec-once = setbg diff --git a/home/.config/systemd/user/wl-gammarelay.service b/home/.config/systemd/user/wl-gammarelay.service index ebc07e7..e7b882c 100644 --- a/home/.config/systemd/user/wl-gammarelay.service +++ b/home/.config/systemd/user/wl-gammarelay.service @@ -1,9 +1,10 @@ [Unit] -Description="Redshift and brightness control for Wayland " +Description="Redshift and brightness control for Wayland" +BindsTo=graphical-session.target [Service] ExecStart=/usr/bin/wl-gammarelay-rs run Restart=on-failure [Install] -WantedBy=graphical-session.target +WantedBy=wm-ready.target diff --git a/home/.config/systemd/user/wm-ready.target b/home/.config/systemd/user/wm-ready.target new file mode 100644 index 0000000..fc7b7e6 --- /dev/null +++ b/home/.config/systemd/user/wm-ready.target @@ -0,0 +1,3 @@ +[Unit] +Description=Window Manager loaded and ready +BindsTo=graphical-session.target diff --git a/home/.config/systemd/user/wm-ready.target.wants/wl-gammarelay.service b/home/.config/systemd/user/wm-ready.target.wants/wl-gammarelay.service new file mode 120000 index 0000000..2ca58e6 --- /dev/null +++ b/home/.config/systemd/user/wm-ready.target.wants/wl-gammarelay.service @@ -0,0 +1 @@ +/home/itsdrike/.config/systemd/user/wl-gammarelay.service \ No newline at end of file diff --git a/home/.local/bin/scripts/gui/hyprland/launch-hypr b/home/.local/bin/scripts/gui/hyprland/launch-hypr index f376e69..16fc068 100755 --- a/home/.local/bin/scripts/gui/hyprland/launch-hypr +++ b/home/.local/bin/scripts/gui/hyprland/launch-hypr @@ -11,3 +11,7 @@ HYPRLAND_LOG="${XDG_CACHE_HOME:-$HOME/.cache}/hyprlog.txt" echo "---------- NEW RUN $(date) ----------" >> "$HYPRLAND_LOG" Hyprland 2>&1 | awk '{ print strftime("%s: "), $0, fflush(); }' | tee -a "$HYPRLAND_LOG" echo "---------- ENDED $(date) ----------" >> "$HYPRLAND_LOG" + +if systemctl --user is-active wm-ready.target &>/dev/null; then + systemctl --user stop wm-ready.target +fi