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