mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-23 10:03:55 -05:00
desktop: set hyprland to use hypridle + hyprlock
This commit is contained in:
parent
35be127479
commit
fb97044847
|
@ -29,7 +29,7 @@ in {
|
||||||
[
|
[
|
||||||
''$mod,M,exec,${lib.getExe config.programs.rofi.package} -show power-menu -modi "power-menu:${lib.getExe pkgs.rofi-power-menu} --choices=logout/lockscreen/suspend/shutdown/reboot"''
|
''$mod,M,exec,${lib.getExe config.programs.rofi.package} -show power-menu -modi "power-menu:${lib.getExe pkgs.rofi-power-menu} --choices=logout/lockscreen/suspend/shutdown/reboot"''
|
||||||
",PRINT,exec,${helpers.screenshot}"
|
",PRINT,exec,${helpers.screenshot}"
|
||||||
"$mod CTRL,L,exec,${lib.getExe pkgs.swaylock}"
|
"$mod CTRL,L,exec,${lib.getExe' pkgs.systemd "loginctl"} lock-session"
|
||||||
"$mod SHIFT,backslash,togglesplit"
|
"$mod SHIFT,backslash,togglesplit"
|
||||||
"$mod SHIFT,comma,exec,${lib.getExe pkgs.hyprnome} --previous --move"
|
"$mod SHIFT,comma,exec,${lib.getExe pkgs.hyprnome} --previous --move"
|
||||||
"$mod SHIFT,G,togglegroup"
|
"$mod SHIFT,G,togglegroup"
|
||||||
|
|
|
@ -87,7 +87,7 @@ in {
|
||||||
"${modifier}+B" = "exec ${lib.getExe cfg.defaultApps.webBrowser}";
|
"${modifier}+B" = "exec ${lib.getExe cfg.defaultApps.webBrowser}";
|
||||||
"${modifier}+C" = "kill";
|
"${modifier}+C" = "kill";
|
||||||
"${modifier}+Comma" = "workspace prev";
|
"${modifier}+Comma" = "workspace prev";
|
||||||
"${modifier}+Control+L" = "exec ${lib.getExe pkgs.swaylock}";
|
"${modifier}+Control+L" = "exec ${lib.getExe' pkgs.systemd "loginctl"} lock-session";
|
||||||
"${modifier}+E" = "exec ${lib.getExe cfg.defaultApps.editor}";
|
"${modifier}+E" = "exec ${lib.getExe cfg.defaultApps.editor}";
|
||||||
"${modifier}+F" = "exec ${lib.getExe cfg.defaultApps.fileManager}";
|
"${modifier}+F" = "exec ${lib.getExe cfg.defaultApps.fileManager}";
|
||||||
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar"; # Show/hide waybar
|
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar"; # Show/hide waybar
|
||||||
|
|
|
@ -13,9 +13,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
hypridle.enable = lib.mkDefault config.ar.home.desktop.hyprland.enable;
|
||||||
mako.enable = lib.mkDefault true;
|
mako.enable = lib.mkDefault true;
|
||||||
pipewire-inhibit.enable = lib.mkDefault true;
|
pipewire-inhibit.enable = lib.mkDefault true;
|
||||||
swayidle.enable = lib.mkDefault true;
|
swayidle.enable = lib.mkDefault config.ar.home.desktop.sway.enable;
|
||||||
swayosd.enable = lib.mkDefault true;
|
swayosd.enable = lib.mkDefault true;
|
||||||
waybar.enable = lib.mkDefault true;
|
waybar.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,6 +186,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
gammastep.enable = lib.mkEnableOption "Gammastep redshift daemon.";
|
gammastep.enable = lib.mkEnableOption "Gammastep redshift daemon.";
|
||||||
|
hypridle.enable = lib.mkEnableOption "Hypridle idle daemon.";
|
||||||
mako.enable = lib.mkEnableOption "Mako notification daemon.";
|
mako.enable = lib.mkEnableOption "Mako notification daemon.";
|
||||||
|
|
||||||
mpd = {
|
mpd = {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./easyeffects
|
./easyeffects
|
||||||
./gammastep
|
./gammastep
|
||||||
|
./hypridle
|
||||||
./mako
|
./mako
|
||||||
./mpd
|
./mpd
|
||||||
./pipewire-inhibit
|
./pipewire-inhibit
|
||||||
|
|
81
homeManagerModules/services/hypridle/default.nix
Normal file
81
homeManagerModules/services/hypridle/default.nix
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.ar.home;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf cfg.services.hypridle.enable {
|
||||||
|
programs.hyprlock.enable = true;
|
||||||
|
|
||||||
|
services.hypridle = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||||
|
lock_cmd = "hyprlock";
|
||||||
|
before_sleep_cmd = "hyprlock --immediate --no-fade-in";
|
||||||
|
};
|
||||||
|
|
||||||
|
listener =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
timeout = 30;
|
||||||
|
on-timeout = "brightnessctl -sd chromeos::kbd_backlight set 0";
|
||||||
|
on-resume = "brightnessctl -rd chromeos::kbd_backlight";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 120;
|
||||||
|
on-timeout = "brightnessctl -s set 10";
|
||||||
|
on-resume = "brightnessctl -r";
|
||||||
|
}
|
||||||
|
]
|
||||||
|
++ lib.optional (!cfg.desktop.autoSuspend) {
|
||||||
|
timeout = 600;
|
||||||
|
on-timeout = "hyprlock";
|
||||||
|
}
|
||||||
|
++ lib.optional cfg.desktop.autoSuspend {
|
||||||
|
timeout = 600;
|
||||||
|
command = "systemctl suspend";
|
||||||
|
}
|
||||||
|
++ lib.optional
|
||||||
|
(!cfg.desktop.autoSuspend) {
|
||||||
|
timeout = 600;
|
||||||
|
on-timeout = "hyprlock";
|
||||||
|
}
|
||||||
|
++ lib.optional (!cfg.desktop.autoSuspend && cfg.desktop.hyprland.enable)
|
||||||
|
{
|
||||||
|
timeout = 630;
|
||||||
|
on-timeout = "hyprctl dispatch dpms off";
|
||||||
|
on-resume = "hyprctl dispatch dpms on";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.services.hypridle = {
|
||||||
|
Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target");
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
Environment = lib.mkForce [
|
||||||
|
"PATH=${
|
||||||
|
lib.makeBinPath (
|
||||||
|
(with pkgs; [
|
||||||
|
bash
|
||||||
|
brightnessctl
|
||||||
|
coreutils
|
||||||
|
hyprlock
|
||||||
|
systemd
|
||||||
|
])
|
||||||
|
++ lib.optional (cfg.desktop.hyprland.enable) config.wayland.windowManager.hyprland.package
|
||||||
|
)
|
||||||
|
}"
|
||||||
|
];
|
||||||
|
Restart = lib.mkForce "no";
|
||||||
|
};
|
||||||
|
|
||||||
|
Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -11,10 +11,6 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
events = [
|
events = [
|
||||||
{
|
|
||||||
event = "before-sleep";
|
|
||||||
command = "playerctl pause";
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
event = "before-sleep";
|
event = "before-sleep";
|
||||||
command = "swaylock && sleep 2";
|
command = "swaylock && sleep 2";
|
||||||
|
@ -27,6 +23,11 @@ in {
|
||||||
|
|
||||||
timeouts =
|
timeouts =
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
timeout = 30;
|
||||||
|
command = "brightnessctl -sd chromeos::kbd_backlight set 0";
|
||||||
|
resumeCommand = "brightnessctl -rd chromeos::kbd_backlight";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
timeout = 120;
|
timeout = 120;
|
||||||
command = "brightnessctl -s set 10";
|
command = "brightnessctl -s set 10";
|
||||||
|
@ -42,12 +43,6 @@ in {
|
||||||
timeout = 600;
|
timeout = 600;
|
||||||
command = "swaylock";
|
command = "swaylock";
|
||||||
}
|
}
|
||||||
++ lib.optional (!cfg.desktop.autoSuspend && cfg.desktop.hyprland.enable)
|
|
||||||
{
|
|
||||||
timeout = 630;
|
|
||||||
command = "hyprctl dispatch dpms off";
|
|
||||||
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;
|
||||||
|
@ -57,7 +52,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
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.sway.enable) "sway-session.target");
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Environment = lib.mkForce [
|
Environment = lib.mkForce [
|
||||||
|
@ -66,18 +61,16 @@ in {
|
||||||
bash
|
bash
|
||||||
brightnessctl
|
brightnessctl
|
||||||
coreutils
|
coreutils
|
||||||
playerctl
|
|
||||||
swaylock
|
swaylock
|
||||||
systemd
|
systemd
|
||||||
])
|
])
|
||||||
++ lib.optional (cfg.desktop.hyprland.enable) config.wayland.windowManager.hyprland.package
|
|
||||||
++ lib.optional (cfg.desktop.sway.enable) config.wayland.windowManager.sway.package)
|
++ lib.optional (cfg.desktop.sway.enable) config.wayland.windowManager.sway.package)
|
||||||
}"
|
}"
|
||||||
];
|
];
|
||||||
Restart = lib.mkForce "no";
|
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.sway.enable) "sway-session.target";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue