From 6aafa8969ac006ea77a250bb1fca57b065187f45 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 12 Aug 2024 10:17:21 -0400 Subject: [PATCH] home/desktop: check if sway/hyprland are enabled before binding services --- homeManagerModules/services/gammastep/default.nix | 4 ++-- homeManagerModules/services/mako/default.nix | 4 ++-- homeManagerModules/services/pipewire-inhibit/default.nix | 4 ++-- homeManagerModules/services/randomWallpaper/default.nix | 4 ++-- homeManagerModules/services/swayidle/default.nix | 4 ++-- homeManagerModules/services/swayosd/default.nix | 4 ++-- homeManagerModules/services/waybar/default.nix | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/homeManagerModules/services/gammastep/default.nix b/homeManagerModules/services/gammastep/default.nix index 6b1c9413..62fc4824 100644 --- a/homeManagerModules/services/gammastep/default.nix +++ b/homeManagerModules/services/gammastep/default.nix @@ -13,9 +13,9 @@ in { }; systemd.user.services.gammastep = { - Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; + Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"); Service.Restart = lib.mkForce "no"; - Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; + Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; }; }; } diff --git a/homeManagerModules/services/mako/default.nix b/homeManagerModules/services/mako/default.nix index 7fa231a5..985f7e5e 100644 --- a/homeManagerModules/services/mako/default.nix +++ b/homeManagerModules/services/mako/default.nix @@ -41,7 +41,7 @@ in { systemd.user.services.mako = { Unit = { After = "graphical-session.target"; - BindsTo = ["hyprland-session.target" "sway-session.target"]; + BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; Description = "Lightweight Wayland notification daemon"; Documentation = "man:mako(1)"; PartOf = "graphical-session.target"; @@ -55,7 +55,7 @@ in { Type = "dbus"; }; - Install.WantedBy = ["hyprland-session.target" "sway-session.target"]; + Install.WantedBy = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; }; }; } diff --git a/homeManagerModules/services/pipewire-inhibit/default.nix b/homeManagerModules/services/pipewire-inhibit/default.nix index e2d7c9b3..a7552718 100644 --- a/homeManagerModules/services/pipewire-inhibit/default.nix +++ b/homeManagerModules/services/pipewire-inhibit/default.nix @@ -10,7 +10,7 @@ in { systemd.user.services.pipewire-inhibit-idle = { Unit = { After = "graphical-session.target"; - BindsTo = ["hyprland-session.target" "sway-session.target"]; + BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; Description = "inhibit idle when audio is playing with Pipewire."; PartOf = "graphical-session.target"; }; @@ -20,7 +20,7 @@ in { Restart = "no"; }; - Install.WantedBy = ["hyprland-session.target" "sway-session.target"]; + Install.WantedBy = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; }; }; } diff --git a/homeManagerModules/services/randomWallpaper/default.nix b/homeManagerModules/services/randomWallpaper/default.nix index a3ce94e7..e0032a9d 100644 --- a/homeManagerModules/services/randomWallpaper/default.nix +++ b/homeManagerModules/services/randomWallpaper/default.nix @@ -89,7 +89,7 @@ in { systemd.user.services.randomWallpaper = { Unit = { After = "graphical-session.target"; - BindsTo = ["hyprland-session.target" "sway-session.target"]; + BindsTo = lib.optional (config.ar.home.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (config.ar.home.desktop.sway.enable) "sway-session.target"; Description = "Lightweight swaybg-based random wallpaper daemon."; PartOf = "graphical-session.target"; }; @@ -99,7 +99,7 @@ in { Restart = "no"; }; - Install.WantedBy = ["hyprland-session.target" "sway-session.target"]; + Install.WantedBy = lib.optional (config.ar.home.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (config.ar.home.desktop.sway.enable) "sway-session.target"; }; }; } diff --git a/homeManagerModules/services/swayidle/default.nix b/homeManagerModules/services/swayidle/default.nix index 45afc13e..4003bb52 100644 --- a/homeManagerModules/services/swayidle/default.nix +++ b/homeManagerModules/services/swayidle/default.nix @@ -59,9 +59,9 @@ in { }; systemd.user.services.swayidle = { - Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; + Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"); Service.Restart = lib.mkForce "no"; - Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; + Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; }; }; } diff --git a/homeManagerModules/services/swayosd/default.nix b/homeManagerModules/services/swayosd/default.nix index 3da0b8cc..22d62a1d 100644 --- a/homeManagerModules/services/swayosd/default.nix +++ b/homeManagerModules/services/swayosd/default.nix @@ -17,9 +17,9 @@ in { }; systemd.user.services.swayosd = { - Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; + Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"); Service.Restart = lib.mkForce "no"; - Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; + Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; }; xdg.configFile."swayosd/style.css" = { diff --git a/homeManagerModules/services/waybar/default.nix b/homeManagerModules/services/waybar/default.nix index f496bf1c..2e64dc12 100644 --- a/homeManagerModules/services/waybar/default.nix +++ b/homeManagerModules/services/waybar/default.nix @@ -356,9 +356,9 @@ in { }; systemd.user.services.waybar = { - Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"]; + Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"); Service.Restart = lib.mkForce "no"; - Unit.BindsTo = ["hyprland-session.target" "sway-session.target"]; + Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target"; }; xdg.configFile."nwg-drawer/drawer.css".text = ''