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; }; 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: { config, lib, pkgs, inputs, ... }@args:
let nathan = config.nathan; let nathan = config.nathan;
in with lib; { in with lib; {
imports = [ ./desktop/waybar.nix ./desktop/locking.nix ./desktop/fuzzel.nix ]; imports = [
config = mkIf nathan.programs.hyprland.enable (let ./desktop/waybar.nix
notif-package = ./desktop/locking.nix
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter; ./desktop/fuzzel.nix
in { ./desktop/notifs.nix
];
config = mkIf nathan.programs.hyprland.enable ({
home.packages = with pkgs; [ home.packages = with pkgs; [
# General # General
killall killall
# Display management # Display management
wdisplays wdisplays
# Notifications
notif-package
# glib for sound stuff # glib for sound stuff
glib glib
# Screenshots # Screenshots
@ -30,7 +30,6 @@ in with lib; {
## Hyprland addons ## Hyprland addons
font-awesome font-awesome
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprpaper inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprpaper
swayosd
inputs.self.packages.${pkgs.system}.pyprland inputs.self.packages.${pkgs.system}.pyprland
# For fancy x11 scaling # For fancy x11 scaling
sommelier sommelier
@ -174,8 +173,6 @@ in with lib; {
# systemd integration # 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 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 ## Window rules
@ -239,19 +236,6 @@ in with lib; {
######################### #########################
## Hyprland Addons ## 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 # Setup pyprland
systemd.user.services.pypr = { systemd.user.services.pypr = {
Unit = { Unit = {
@ -308,35 +292,10 @@ in with lib; {
# Bluetooth applet # Bluetooth applet
services.blueman-applet.enable = true; 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 ## EasyEffects
######################### #########################
services.easyeffects.enable = true; 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 ## Default applications
######################### #########################
xdg.mimeApps.defaultApplications = { xdg.mimeApps.defaultApplications = {