From aea06d5eda80ebeef1428b83cf5adfd08ea50f75 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 11 Aug 2024 23:43:48 -0400 Subject: [PATCH] home: fix desktop services (#88) * waybar: increase to proper height 34px * sway: restart sway-session-target at launch * home/services: bind desktop services to sway and hyprland --- homeManagerModules/desktop/sway/settings.nix | 6 ++++++ homeManagerModules/services/gammastep/default.nix | 6 ++++++ homeManagerModules/services/mako/default.nix | 4 ++-- homeManagerModules/services/pipewire-inhibit/default.nix | 4 ++-- homeManagerModules/services/randomWallpaper/default.nix | 4 ++-- homeManagerModules/services/swayidle/default.nix | 6 ++---- homeManagerModules/services/swayosd/default.nix | 7 ++----- homeManagerModules/services/waybar/default.nix | 6 ++---- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/homeManagerModules/desktop/sway/settings.nix b/homeManagerModules/desktop/sway/settings.nix index 5bc8c42f..d3ee31a3 100644 --- a/homeManagerModules/desktop/sway/settings.nix +++ b/homeManagerModules/desktop/sway/settings.nix @@ -15,6 +15,12 @@ in { systemd = { enable = true; + + extraCommands = lib.mkDefault [ + "systemctl --user stop sway-session.target" + "systemctl --user start sway-session.target" + ]; + variables = ["--all"]; }; diff --git a/homeManagerModules/services/gammastep/default.nix b/homeManagerModules/services/gammastep/default.nix index cd3c3193..6b1c9413 100644 --- a/homeManagerModules/services/gammastep/default.nix +++ b/homeManagerModules/services/gammastep/default.nix @@ -11,5 +11,11 @@ in { latitude = lib.mkDefault "33.74"; longitude = lib.mkDefault "-84.38"; }; + + systemd.user.services.gammastep = { + Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; + Service.Restart = lib.mkForce "no"; + Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; + }; }; } diff --git a/homeManagerModules/services/mako/default.nix b/homeManagerModules/services/mako/default.nix index 7c77fcc7..7fa231a5 100644 --- a/homeManagerModules/services/mako/default.nix +++ b/homeManagerModules/services/mako/default.nix @@ -41,6 +41,7 @@ in { systemd.user.services.mako = { Unit = { After = "graphical-session.target"; + BindsTo = ["hyprland-session.target" "sway-session.target"]; Description = "Lightweight Wayland notification daemon"; Documentation = "man:mako(1)"; PartOf = "graphical-session.target"; @@ -50,8 +51,7 @@ in { BusName = "org.freedesktop.Notifications"; ExecReload = ''${lib.getExe' pkgs.mako "makoctl"} reload''; ExecStart = "${lib.getExe pkgs.mako}"; - Restart = "on-failure"; - RestartSec = 5; + Restart = lib.mkForce "no"; Type = "dbus"; }; diff --git a/homeManagerModules/services/pipewire-inhibit/default.nix b/homeManagerModules/services/pipewire-inhibit/default.nix index ca913b98..e2d7c9b3 100644 --- a/homeManagerModules/services/pipewire-inhibit/default.nix +++ b/homeManagerModules/services/pipewire-inhibit/default.nix @@ -10,14 +10,14 @@ in { systemd.user.services.pipewire-inhibit-idle = { Unit = { After = "graphical-session.target"; + BindsTo = ["hyprland-session.target" "sway-session.target"]; Description = "inhibit idle when audio is playing with Pipewire."; PartOf = "graphical-session.target"; }; Service = { ExecStart = lib.getExe pkgs.wayland-pipewire-idle-inhibit; - Restart = "on-failure"; - RestartSec = 5; + Restart = "no"; }; Install.WantedBy = ["hyprland-session.target" "sway-session.target"]; diff --git a/homeManagerModules/services/randomWallpaper/default.nix b/homeManagerModules/services/randomWallpaper/default.nix index 8eb4fbf1..a3ce94e7 100644 --- a/homeManagerModules/services/randomWallpaper/default.nix +++ b/homeManagerModules/services/randomWallpaper/default.nix @@ -89,14 +89,14 @@ in { systemd.user.services.randomWallpaper = { Unit = { After = "graphical-session.target"; + BindsTo = ["hyprland-session.target" "sway-session.target"]; Description = "Lightweight swaybg-based random wallpaper daemon."; PartOf = "graphical-session.target"; }; Service = { ExecStart = "${wallpaperD}"; - Restart = "on-failure"; - RestartSec = 5; + Restart = "no"; }; Install.WantedBy = ["hyprland-session.target" "sway-session.target"]; diff --git a/homeManagerModules/services/swayidle/default.nix b/homeManagerModules/services/swayidle/default.nix index 4d34add6..45afc13e 100644 --- a/homeManagerModules/services/swayidle/default.nix +++ b/homeManagerModules/services/swayidle/default.nix @@ -60,10 +60,8 @@ in { systemd.user.services.swayidle = { Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; - Service = { - Restart = lib.mkForce "on-failure"; - RestartSec = 5; - }; + Service.Restart = lib.mkForce "no"; + Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; }; }; } diff --git a/homeManagerModules/services/swayosd/default.nix b/homeManagerModules/services/swayosd/default.nix index 84dd88ca..3da0b8cc 100644 --- a/homeManagerModules/services/swayosd/default.nix +++ b/homeManagerModules/services/swayosd/default.nix @@ -18,11 +18,8 @@ in { systemd.user.services.swayosd = { Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; - - Service = { - Restart = lib.mkForce "on-failure"; - RestartSec = 5; - }; + Service.Restart = lib.mkForce "no"; + Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; }; xdg.configFile."swayosd/style.css" = { diff --git a/homeManagerModules/services/waybar/default.nix b/homeManagerModules/services/waybar/default.nix index 07599b47..f496bf1c 100644 --- a/homeManagerModules/services/waybar/default.nix +++ b/homeManagerModules/services/waybar/default.nix @@ -357,10 +357,8 @@ in { systemd.user.services.waybar = { Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; - Service = { - Restart = lib.mkForce "on-failure"; - RestartSec = 5; - }; + Service.Restart = lib.mkForce "no"; + Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; }; xdg.configFile."nwg-drawer/drawer.css".text = ''