92 lines
2.1 KiB
Nix
92 lines
2.1 KiB
Nix
{
|
|
inputs,
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.modules.Hyprland;
|
|
suspend = pkgs.writeShellScript "hyprland_suspend" ''
|
|
#!/bin/bash
|
|
|
|
case "$1" in
|
|
suspend)
|
|
killall -STOP Hyprland
|
|
;;
|
|
resume)
|
|
killall -CONT Hyprland
|
|
;;
|
|
esac
|
|
'';
|
|
in
|
|
{
|
|
imports = [
|
|
./settings.nix
|
|
./runner.nix
|
|
./screenshot.nix
|
|
];
|
|
options.modules.Hyprland = {
|
|
enable = lib.mkEnableOption "Hyprland";
|
|
suspend-on-hibernate = lib.mkEnableOption "soh";
|
|
};
|
|
# TODO, split this into its own module;
|
|
config = lib.mkIf cfg.enable {
|
|
wayland.windowManager.hyprland = {
|
|
enable = true;
|
|
# set the flake package
|
|
# settings = { };
|
|
systemd.variables = [ "--all" ];
|
|
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
|
portalPackage =
|
|
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
|
};
|
|
programs = {
|
|
hyprlock = {
|
|
enable = true;
|
|
};
|
|
};
|
|
systemd.user.services."hyprland_suspend" = lib.mkIf cfg.suspend-on-hibernate {
|
|
Unit = {
|
|
Description = "Suspend hyprland";
|
|
Before = [
|
|
"systemd-suspend.service"
|
|
"systemd-hibernate.service"
|
|
"nvidia-suspend.service"
|
|
"nvidia-hibernate.service"
|
|
];
|
|
};
|
|
Install = {
|
|
WantedBy = [
|
|
"systemd-suspend.service"
|
|
"systemd-hibernate.service"
|
|
];
|
|
};
|
|
Service = {
|
|
Type = "oneshot";
|
|
ExecStart = "${suspend} suspend";
|
|
};
|
|
};
|
|
systemd.user.services."hyprland_resume" = {
|
|
Unit = {
|
|
Description = "Resume hyprland";
|
|
After = [
|
|
"systemd-suspend.service"
|
|
"systemd-hibernate.service"
|
|
"nvidia-resume.service"
|
|
];
|
|
};
|
|
Install = {
|
|
WantedBy = [
|
|
"systemd-suspend.service"
|
|
"systemd-hibernate.service"
|
|
];
|
|
};
|
|
Service = {
|
|
Type = "oneshot";
|
|
ExecStart = "${suspend} resume";
|
|
};
|
|
};
|
|
};
|
|
}
|