home: move swayidle and swayosd to services

This commit is contained in:
Aly Raffauf 2024-08-02 14:42:35 -04:00
parent e469d1e0cf
commit 011565307f
6 changed files with 17 additions and 84 deletions

View file

@ -15,9 +15,7 @@
./mako
./nemo
./rofi
./swayidle
./swaylock
./swayosd
./thunar
./tmux
./vsCodium

View file

@ -1,63 +0,0 @@
{
config,
lib,
pkgs,
...
}: 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.apps.swayidle.enable {
services.swayidle = {
enable = true;
events = [
{
event = "before-sleep";
command = "${lib.getExe pkgs.playerctl} pause";
}
{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock";
}
{
event = "lock";
command = "${pkgs.swaylock}/bin/swaylock";
}
];
timeouts =
[
{
timeout = 120;
command = "${lib.getExe pkgs.brightnessctl} -s set 10' resume '${lib.getExe pkgs.brightnessctl} -r";
}
{
timeout = 600;
command = "${pkgs.swaylock}/bin/swaylock";
}
]
++ lib.optional cfg.desktop.autoSuspend {
timeout = 600;
command = "sleep 2 && ${lib.getExe' pkgs.systemd "systemctl"} suspend'";
}
++ lib.optional (!cfg.desktop.autoSuspend)
{
timeout = 600;
command = "${pkgs.swaylock}/bin/swaylock";
}
++ lib.optional (!cfg.desktop.autoSuspend && cfg.desktop.hyprland.enable)
{
timeout = 630;
command = "${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on'";
}
++ lib.optional (!cfg.desktop.autoSuspend && cfg.desktop.sway.enable)
{
timeout = 630;
command = "${swaymsg} \"output * dpms off\"' resume '${swaymsg} \"output * dpms on\"";
};
};
};
}

View file

@ -1,9 +0,0 @@
{
config,
lib,
...
}: {
config = lib.mkIf config.ar.home.apps.swayosd.enable {
services.swayosd.enable = true;
};
}

View file

@ -5,15 +5,19 @@
...
}: {
config = lib.mkIf (config.ar.home.desktop.hyprland.enable || config.ar.home.desktop.sway.enable) {
ar.home.apps = {
ar.home = {
apps = {
kitty.enable = lib.mkDefault true;
mako.enable = lib.mkDefault true;
rofi.enable = lib.mkDefault true;
swayidle.enable = lib.mkDefault true;
swaylock.enable = lib.mkDefault true;
swayosd.enable = lib.mkDefault true;
waybar.enable = lib.mkDefault true;
};
services = {
swayidle.enable = lib.mkDefault true;
swayosd.enable = lib.mkDefault true;
};
};
dconf = {
enable = true;

View file

@ -62,9 +62,7 @@ in {
};
rofi.enable = lib.mkEnableOption "Rofi launcher.";
swayidle.enable = lib.mkEnableOption "Swayidle idle daemon.";
swaylock.enable = lib.mkEnableOption "Swaylock screen locker.";
swayosd.enable = lib.mkEnableOption "On Screen Display (OSD) for volume/brightness/etc.";
thunar.enable = lib.mkOption {
description = "Thunar file manager.";
@ -217,6 +215,9 @@ in {
type = lib.types.str;
};
};
swayidle.enable = lib.mkEnableOption "Swayidle idle daemon.";
swayosd.enable = lib.mkEnableOption "On Screen Display (OSD) for volume/brightness/etc.";
};
theme = {

View file

@ -2,5 +2,7 @@
imports = [
./easyeffects
./mpd
./swayidle
./swayosd
];
}