1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.programs.bash.undistractMe;
7in
8{
9 options = {
10 programs.bash.undistractMe = {
11 enable = mkEnableOption (lib.mdDoc "notifications when long-running terminal commands complete");
12
13 playSound = mkEnableOption (lib.mdDoc "notification sounds when long-running terminal commands complete");
14
15 timeout = mkOption {
16 default = 10;
17 description = lib.mdDoc ''
18 Number of seconds it would take for a command to be considered long-running.
19 '';
20 type = types.int;
21 };
22 };
23 };
24
25 config = mkIf cfg.enable {
26 programs.bash.promptPluginInit = ''
27 export LONG_RUNNING_COMMAND_TIMEOUT=${toString cfg.timeout}
28 export UDM_PLAY_SOUND=${if cfg.playSound then "1" else "0"}
29 . "${pkgs.undistract-me}/etc/profile.d/undistract-me.sh"
30 '';
31 };
32
33 meta = {
34 maintainers = with maintainers; [ kira-bruneau ];
35 };
36}