From 1babfbebdd7ea9f566dd0ab6e03f60a4808d6cba Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Mon, 9 Sep 2024 13:32:56 -0300 Subject: [PATCH] Add InhibitLidActionWhenExternalMonitorPresent option to powerdevil module (#361) --- modules/powerdevil.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/powerdevil.nix b/modules/powerdevil.nix index bfdf07df..b55841da 100644 --- a/modules/powerdevil.nix +++ b/modules/powerdevil.nix @@ -85,6 +85,14 @@ let ''; apply = action: if (action == null) then null else whenLaptopLidClosedActions."${action}"; }; + inhibitLidActionWhenExternalMonitorConnected = lib.mkOption { + type = with lib.types; nullOr bool; + default = null; + example = true; + description = '' + If enabled, the lid action will be inhibited when an external monitor is connected. + ''; + }; turnOffDisplay = { idleTimeout = lib.mkOption { type = with lib.types; nullOr (either (enum [ "never" ]) (ints.between 30 600000)); @@ -144,6 +152,7 @@ let AutoSuspendIdleTimeoutSec = cfg.powerdevil.${optionsName}.autoSuspend.idleTimeout; SleepMode = cfg.powerdevil.${optionsName}.whenSleepingEnter; LidAction = cfg.powerdevil.${optionsName}.whenLaptopLidClosed; + InhibitLidActionWhenExternalMonitorPresent = cfg.powerdevil.${optionsName}.inhibitLidActionWhenExternalMonitorConnected; }; "${cfgSectName}/Display" = { TurnOffDisplayIdleTimeoutSec = cfg.powerdevil.${optionsName}.turnOffDisplay.idleTimeout;