Hyprland: switch from swayidle to hypridle
this has some cool things including media inhibits by default
This commit is contained in:
parent
067557b72f
commit
2a5744d45f
@ -93,6 +93,8 @@
|
|||||||
inputs.rust-overlay.overlays.default
|
inputs.rust-overlay.overlays.default
|
||||||
inputs.nixfiles-assets.overlays.default
|
inputs.nixfiles-assets.overlays.default
|
||||||
inputs.nix-minecraft.overlays.default
|
inputs.nix-minecraft.overlays.default
|
||||||
|
# inputs.hypridle.overlays.default
|
||||||
|
(final: prev: { inherit (inputs.hypridle.packages.${prev.system}) hypridle; })
|
||||||
];
|
];
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ pkgs, config, lib, options, osConfig ? { }, nixpkgs, home-manager, ... }@args:
|
{ pkgs, config, lib, options, osConfig ? { }, nixpkgs, home-manager, inputs, ... }@args:
|
||||||
let
|
let
|
||||||
isStandalone = with builtins; !( (typeOf osConfig == "set") && hasAttr "home-manager" osConfig );
|
isStandalone = with builtins; !( (typeOf osConfig == "set") && hasAttr "home-manager" osConfig );
|
||||||
cfg = config.nixfiles;
|
cfg = config.nixfiles;
|
||||||
@ -11,6 +11,8 @@ in
|
|||||||
./profile
|
./profile
|
||||||
./programs
|
./programs
|
||||||
./sessions
|
./sessions
|
||||||
|
|
||||||
|
inputs.hypridle.homeManagerModules.default
|
||||||
];
|
];
|
||||||
config = {};
|
config = {};
|
||||||
options.nixfiles = {
|
options.nixfiles = {
|
||||||
|
@ -3,5 +3,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./comma.nix
|
./comma.nix
|
||||||
./mopidy.nix
|
./mopidy.nix
|
||||||
|
./hypridle.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
90
home/programs/hypridle.nix
Normal file
90
home/programs/hypridle.nix
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.nixfiles.services.hypridle;
|
||||||
|
inherit (lib.types) str int;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.nixfiles.services.hypridle = {
|
||||||
|
enable = lib.mkEnableOption "the hypridle configuration";
|
||||||
|
timeouts = let
|
||||||
|
mkTimeout = timeout: desc: lib.mkOption {
|
||||||
|
description = "${desc}";
|
||||||
|
type = int;
|
||||||
|
default = timeout;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
dpms = mkTimeout (300) "DPMS timeout";
|
||||||
|
lock = mkTimeout (360) "Lock timeout";
|
||||||
|
locked-dpms = mkTimeout (10) "DPMS timeout while locked";
|
||||||
|
};
|
||||||
|
commands = {
|
||||||
|
dpms-off = lib.mkOption {
|
||||||
|
description = "DPMS off command";
|
||||||
|
default = "hyprctl dispatch dpms off";
|
||||||
|
type = str;
|
||||||
|
};
|
||||||
|
dpms-on = lib.mkOption {
|
||||||
|
description = "DPMS on command";
|
||||||
|
default = "hyprctl dispatch dpms on";
|
||||||
|
type = str;
|
||||||
|
};
|
||||||
|
|
||||||
|
# lock = lib.mkOption {
|
||||||
|
# description = "Lock command";
|
||||||
|
# default = "${pkgs.swaylock}/bin/swaylock";
|
||||||
|
# type = str;
|
||||||
|
# };
|
||||||
|
# unlock = lib.mkOption {
|
||||||
|
# description = "Unlock command";
|
||||||
|
# default = "${pkgs.procps}/bin/pkill -USR1 swaylock";
|
||||||
|
# type = str;
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf cfg.enable {
|
||||||
|
services.hypridle = {
|
||||||
|
enable = true;
|
||||||
|
listeners = let
|
||||||
|
dpms-wrapped = pkgs.writeShellScript "dpms-wrapped" ''
|
||||||
|
exec ${cfg.commands.dpms-off}
|
||||||
|
'';
|
||||||
|
lock-dpms = pkgs.writeShellScript "lock-dpms" ''
|
||||||
|
${pkgs.procps}/bin/pgrep swaylock > /dev/null && "${dpms-wrapped}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
in [
|
||||||
|
{
|
||||||
|
timeout = cfg.timeouts.dpms;
|
||||||
|
onTimeout = cfg.commands.dpms-off;
|
||||||
|
onResume = cfg.commands.dpms-on;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = cfg.timeouts.locked-dpms;
|
||||||
|
onTimeout = "${lock-dpms}";
|
||||||
|
onResume = cfg.commands.dpms-on;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = cfg.timeouts.lock;
|
||||||
|
onTimeout = "${config.programs.swaylock.package}/bin/swaylock";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = cfg.timeouts.lock + cfg.timeouts.locked-dpms;
|
||||||
|
onTimeout = cfg.commands.dpms-off;
|
||||||
|
onResume = cfg.commands.dpms-on;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
lockCmd = "${config.programs.swaylock.package}";
|
||||||
|
unlockCmd = "${pkgs.procps}/bin/pkill -x -USR1 swaylock";
|
||||||
|
beforeSleepCmd = "${config.programs.swaylock.package}";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
# why isn't this handled automatically??
|
||||||
|
(lib.mkIf config.services.hypridle.enable {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
hypridle
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
@ -13,23 +13,26 @@ let
|
|||||||
polkit-agent = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
|
polkit-agent = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
|
||||||
grimblast = "${inputs.hyprwm-contrib.packages.${pkgs.system}.grimblast}/bin/grimblast";
|
grimblast = "${inputs.hyprwm-contrib.packages.${pkgs.system}.grimblast}/bin/grimblast";
|
||||||
swayidle = "${pkgs.swayidle}/bin/swayidle";
|
swayidle = "${pkgs.swayidle}/bin/swayidle";
|
||||||
swaylock = "${pkgs.swaylock}/bin/swaylock";
|
swaylock = "${config.programs.swaylock.package}/bin/swaylock";
|
||||||
hyprctl = "${hyprland-pkg}/bin/hyprctl";
|
hyprctl = "${hyprland-pkg}/bin/hyprctl";
|
||||||
pkill = "${pkgs.procps}/bin/pkill";
|
pkill = "${pkgs.procps}/bin/pkill";
|
||||||
swaybg = "${pkgs.swaybg}/bin/swaybg";
|
swaybg = "${pkgs.swaybg}/bin/swaybg";
|
||||||
|
hypridle = "${config.services.hypridle.package}/bin/hypridle";
|
||||||
|
|
||||||
# lock-cmd = "${swaylock}";
|
lock-cmd = "${swaylock}";
|
||||||
|
|
||||||
lock-cmd = let
|
|
||||||
cmd = pkgs.writeShellScript "lock-script" ''
|
# lock-cmd = let
|
||||||
${swayidle} -w timeout 10 '${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on' &
|
# cmd = pkgs.writeShellScript "lock-script" ''
|
||||||
${swaylock}
|
# ${swayidle} -w timeout 10 '${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on' &
|
||||||
kill %%
|
# ${swaylock}
|
||||||
'';
|
# kill %%
|
||||||
in "${cmd}";
|
# '';
|
||||||
|
# in "${cmd}";
|
||||||
|
|
||||||
# idle-cmd = "${swayidle} -w timeout 315 '${lock-cmd}' timeout 300 '${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on' before-sleep '${lock-cmd}' lock '${lock-cmd}' unlock '${pkill} -USR1 -x swaylock'";
|
# idle-cmd = "${swayidle} -w timeout 315 '${lock-cmd}' timeout 300 '${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on' before-sleep '${lock-cmd}' lock '${lock-cmd}' unlock '${pkill} -USR1 -x swaylock'";
|
||||||
idle-cmd = "${swayidle} -w timeout 300 '${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on'";
|
# idle-cmd = "${swayidle} -w timeout 300 '${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on'";
|
||||||
|
idle-cmd = "${hypridle}";
|
||||||
|
|
||||||
hypr-dispatcher-package = pkgs.callPackage ./dispatcher { hyprland = hyprland-pkg; };
|
hypr-dispatcher-package = pkgs.callPackage ./dispatcher { hyprland = hyprland-pkg; };
|
||||||
hypr-dispatcher = "${hypr-dispatcher-package}/bin/hypr-dispatcher";
|
hypr-dispatcher = "${hypr-dispatcher-package}/bin/hypr-dispatcher";
|
||||||
@ -76,6 +79,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
nixfiles.services.hypridle.enable = true;
|
||||||
nixfiles.common.wm.enable = true;
|
nixfiles.common.wm.enable = true;
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
kitty
|
kitty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user