Factor out notifs and osd

This commit is contained in:
Nathan McCarty 2023-06-20 02:25:00 -04:00
parent 00c2ca236a
commit f078caccaa
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
3 changed files with 65 additions and 48 deletions

View File

@ -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" ]; };
};
})
]

View File

@ -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" ];
};
};
}

View File

@ -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 = {