diff --git a/home-manager/linux/programs/desktop/notifs.nix b/home-manager/linux/programs/desktop/notifs.nix new file mode 100644 index 0000000..5dfe7a9 --- /dev/null +++ b/home-manager/linux/programs/desktop/notifs.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, inputs, ... }: +let + fuzzel-command = config.nathan.config.desktop.fuzzel-command; + hyprland = config.nathan.programs.hyprland.enable; + targets = config.nathan.config.desktop.targets; + shortcuts = inputs.self.packages.${pkgs.system}.shortcuts; + notif-package = + inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter; +in lib.mkMerge [ + # Hyprland specific + (lib.mkIf hyprland { + wayland.windowManager.hyprland.extraConfig = '' + # Notif bind + bind = $mainMod, T, exec, swaync-client -t -sw + ''; + }) + # General configuration + (lib.mkIf hyprland { + home.packages = with pkgs; [ swayosd notif-package ]; + + # Setup swayosd as a service + systemd.user.services.swayosd = { + Unit = { + Description = "Swayosd"; + After = [ "graphical-session.target" ]; + }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.swayosd}/bin/swayosd"; + Restart = "on-failure"; + }; + Install = { WantedBy = [ "hyprland-session.target" ]; }; + }; + # Then sway notification center + systemd.user.services.swaync = { + Unit = { + Description = "SwayNotificationCenter"; + After = [ "graphical-session.target" ]; + }; + Service = { + Type = "simple"; + ExecStart = "${notif-package}/bin/swaync"; + Restart = "on-failure"; + }; + Install = { WantedBy = [ "hyprland-session.target" ]; }; + }; + }) +] diff --git a/home-manager/linux/programs/desktop/waybar.nix b/home-manager/linux/programs/desktop/waybar.nix index 9cf09d1..459227f 100644 --- a/home-manager/linux/programs/desktop/waybar.nix +++ b/home-manager/linux/programs/desktop/waybar.nix @@ -467,5 +467,15 @@ in lib.mkIf hyprland { Install = { WantedBy = targets; }; }; + ######################### + ## Create tray target to fix some things + ######################### + systemd.user.targets.tray = { + Unit = { + Description = "Home Manager System Tray"; + Requires = [ "graphical-session-pre.target" "waybar.service" ]; + After = [ "waybar.service" ]; + }; + }; } diff --git a/home-manager/linux/programs/hyprland.nix b/home-manager/linux/programs/hyprland.nix index 3c03ac7..79567de 100644 --- a/home-manager/linux/programs/hyprland.nix +++ b/home-manager/linux/programs/hyprland.nix @@ -1,18 +1,18 @@ { config, lib, pkgs, inputs, ... }@args: let nathan = config.nathan; in with lib; { - imports = [ ./desktop/waybar.nix ./desktop/locking.nix ./desktop/fuzzel.nix ]; - config = mkIf nathan.programs.hyprland.enable (let - notif-package = - inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter; - in { + imports = [ + ./desktop/waybar.nix + ./desktop/locking.nix + ./desktop/fuzzel.nix + ./desktop/notifs.nix + ]; + config = mkIf nathan.programs.hyprland.enable ({ home.packages = with pkgs; [ # General killall # Display management wdisplays - # Notifications - notif-package # glib for sound stuff glib # Screenshots @@ -30,7 +30,6 @@ in with lib; { ## Hyprland addons font-awesome inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprpaper - swayosd inputs.self.packages.${pkgs.system}.pyprland # For fancy x11 scaling sommelier @@ -174,8 +173,6 @@ in with lib; { # systemd integration exec-once=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && sleep 2 && systemctl --user start hyprland-session.target - # Notif bind - bind = $mainMod, T, exec, swaync-client -t -sw ## Window rules @@ -239,19 +236,6 @@ in with lib; { ######################### ## Hyprland Addons ######################### - # Setup swayosd as a service - systemd.user.services.swayosd = { - Unit = { - Description = "Swayosd"; - After = [ "graphical-session.target" ]; - }; - Service = { - Type = "simple"; - ExecStart = "${pkgs.swayosd}/bin/swayosd"; - Restart = "on-failure"; - }; - Install = { WantedBy = [ "hyprland-session.target" ]; }; - }; # Setup pyprland systemd.user.services.pypr = { Unit = { @@ -308,35 +292,10 @@ in with lib; { # Bluetooth applet services.blueman-applet.enable = true; ######################### - ## SwayNotificationCenter (notifications) - ######################### - systemd.user.services.swaync = { - Unit = { - Description = "SwayNotificationCenter"; - After = [ "graphical-session.target" ]; - }; - Service = { - Type = "simple"; - ExecStart = "${notif-package}/bin/swaync"; - Restart = "on-failure"; - }; - Install = { WantedBy = [ "hyprland-session.target" ]; }; - }; - ######################### ## EasyEffects ######################### services.easyeffects.enable = true; ######################### - ## Create tray target to fix some things - ######################### - systemd.user.targets.tray = { - Unit = { - Description = "Home Manager System Tray"; - Requires = [ "graphical-session-pre.target" "waybar.service" ]; - After = [ "waybar.service" ]; - }; - }; - ######################### ## Default applications ######################### xdg.mimeApps.defaultApplications = {