2021-05-03 20:48:10 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.bash.undistractMe;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.bash.undistractMe = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "notifications when long-running terminal commands complete");
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
playSound = mkEnableOption (lib.mdDoc "notification sounds when long-running terminal commands complete");
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
timeout = mkOption {
|
|
|
|
default = 10;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2021-05-03 20:48:10 +00:00
|
|
|
Number of seconds it would take for a command to be considered long-running.
|
|
|
|
'';
|
|
|
|
type = types.int;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
programs.bash.promptPluginInit = ''
|
|
|
|
export LONG_RUNNING_COMMAND_TIMEOUT=${toString cfg.timeout}
|
|
|
|
export UDM_PLAY_SOUND=${if cfg.playSound then "1" else "0"}
|
|
|
|
. "${pkgs.undistract-me}/etc/profile.d/undistract-me.sh"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
2021-05-28 09:39:13 +00:00
|
|
|
maintainers = with maintainers; [ kira-bruneau ];
|
2021-05-03 20:48:10 +00:00
|
|
|
};
|
|
|
|
}
|