mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-25 02:31:54 -05:00
swayidle: setup binPath
This commit is contained in:
parent
04fc8d374b
commit
0a2131cb75
|
@ -44,7 +44,7 @@ in {
|
|||
|
||||
Service = {
|
||||
BusName = "org.freedesktop.Notifications";
|
||||
Environment = ["PATH=${pkgs.lib.makeBinPath [pkgs.bash pkgs.mpv]}"];
|
||||
Environment = ["PATH=${lib.makeBinPath [pkgs.bash pkgs.mpv]}"];
|
||||
ExecReload = ''${lib.getExe' pkgs.mako "makoctl"} reload'';
|
||||
ExecStart = "${lib.getExe pkgs.mako}";
|
||||
Restart = lib.mkForce "no";
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
...
|
||||
}: let
|
||||
cfg = config.ar.home;
|
||||
hyprctl = lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl";
|
||||
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
|
||||
in {
|
||||
config = lib.mkIf cfg.services.swayidle.enable {
|
||||
services.swayidle = {
|
||||
|
@ -15,15 +13,15 @@ in {
|
|||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${lib.getExe pkgs.playerctl} pause";
|
||||
command = "playerctl pause";
|
||||
}
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${lib.getExe pkgs.swaylock} && ${lib.getExe' pkgs.coreutils "sleep"} 2";
|
||||
command = "swaylock && sleep 2";
|
||||
}
|
||||
{
|
||||
event = "lock";
|
||||
command = "${lib.getExe pkgs.swaylock}";
|
||||
command = "swaylock";
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -31,36 +29,54 @@ in {
|
|||
[
|
||||
{
|
||||
timeout = 120;
|
||||
command = "${lib.getExe pkgs.brightnessctl} -s set 10";
|
||||
resumeCommand = "${lib.getExe pkgs.brightnessctl} -r";
|
||||
command = "brightnessctl -s set 10";
|
||||
resumeCommand = "brightnessctl -r";
|
||||
}
|
||||
]
|
||||
++ lib.optional cfg.desktop.autoSuspend {
|
||||
timeout = 600;
|
||||
command = "${lib.getExe' pkgs.systemd "systemctl"} suspend";
|
||||
command = "systemctl suspend";
|
||||
}
|
||||
++ lib.optional (!cfg.desktop.autoSuspend)
|
||||
{
|
||||
timeout = 600;
|
||||
command = "${lib.getExe pkgs.swaylock}";
|
||||
command = "swaylock";
|
||||
}
|
||||
++ lib.optional (!cfg.desktop.autoSuspend && cfg.desktop.hyprland.enable)
|
||||
{
|
||||
timeout = 630;
|
||||
command = "${hyprctl} dispatch dpms off";
|
||||
resumeCommand = "${hyprctl} dispatch dpms on";
|
||||
command = "hyprctl dispatch dpms off";
|
||||
resumeCommand = "hyprctl dispatch dpms on";
|
||||
}
|
||||
++ lib.optional (!cfg.desktop.autoSuspend && cfg.desktop.sway.enable)
|
||||
{
|
||||
timeout = 630;
|
||||
command = "${swaymsg} \"output * dpms off\"";
|
||||
resumeCommand = "${swaymsg} \"output * dpms on\"";
|
||||
command = "swaymsg \"output * dpms off\"";
|
||||
resumeCommand = "swaymsg \"output * dpms on\"";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.swayidle = {
|
||||
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";
|
||||
|
||||
Service = {
|
||||
Environment = lib.mkForce [
|
||||
"PATH=${
|
||||
pkgs.lib.makeBinPath ((with pkgs; [
|
||||
bash
|
||||
brightnessctl
|
||||
coreutils
|
||||
playerctl
|
||||
swaylock
|
||||
systemd
|
||||
])
|
||||
++ lib.optional (cfg.desktop.hyprland.enable) config.wayland.windowManager.hyprland.package
|
||||
++ lib.optional (cfg.desktop.sway.enable) config.wayland.windowManager.sway.package)
|
||||
}"
|
||||
];
|
||||
Restart = lib.mkForce "no";
|
||||
};
|
||||
|
||||
Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target";
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue