desktop: set hyprland to use hypridle + hyprlock (#170)
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / adjustor-build (push) Waiting to run
nix-build / clean-install-build (push) Waiting to run
nix-build / hhd-ui-build (push) Waiting to run
nix-build / rofi-bluetooth-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / pacifidlog-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run

This commit is contained in:
Aly Raffauf 2024-11-23 08:26:21 -05:00 committed by GitHub
parent 35be127479
commit e499eb159f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 94 additions and 17 deletions

View file

@ -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"''
",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,comma,exec,${lib.getExe pkgs.hyprnome} --previous --move"
"$mod SHIFT,G,togglegroup"

View file

@ -87,7 +87,7 @@ in {
"${modifier}+B" = "exec ${lib.getExe cfg.defaultApps.webBrowser}";
"${modifier}+C" = "kill";
"${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}+F" = "exec ${lib.getExe cfg.defaultApps.fileManager}";
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar"; # Show/hide waybar

View file

@ -13,9 +13,10 @@
};
services = {
hypridle.enable = lib.mkDefault config.ar.home.desktop.hyprland.enable;
mako.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;
waybar.enable = lib.mkDefault true;
};

View file

@ -186,6 +186,7 @@ in {
};
gammastep.enable = lib.mkEnableOption "Gammastep redshift daemon.";
hypridle.enable = lib.mkEnableOption "Hypridle idle daemon.";
mako.enable = lib.mkEnableOption "Mako notification daemon.";
mpd = {

View file

@ -2,6 +2,7 @@
imports = [
./easyeffects
./gammastep
./hypridle
./mako
./mpd
./pipewire-inhibit

View 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";
};
};
}

View file

@ -11,10 +11,6 @@ in {
enable = true;
events = [
{
event = "before-sleep";
command = "playerctl pause";
}
{
event = "before-sleep";
command = "swaylock && sleep 2";
@ -27,6 +23,11 @@ in {
timeouts =
[
{
timeout = 30;
command = "brightnessctl -sd chromeos::kbd_backlight set 0";
resumeCommand = "brightnessctl -rd chromeos::kbd_backlight";
}
{
timeout = 120;
command = "brightnessctl -s set 10";
@ -42,12 +43,6 @@ in {
timeout = 600;
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)
{
timeout = 630;
@ -57,7 +52,7 @@ in {
};
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 = {
Environment = lib.mkForce [
@ -66,18 +61,16 @@ in {
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.sway.enable) "sway-session.target";
};
};
}