modules/programs/bash: add support for undistract-me
This commit is contained in:
parent
62a78fc361
commit
a24d0ab51b
|
@ -116,6 +116,7 @@
|
||||||
./programs/bash/bash.nix
|
./programs/bash/bash.nix
|
||||||
./programs/bash/bash-completion.nix
|
./programs/bash/bash-completion.nix
|
||||||
./programs/bash/ls-colors.nix
|
./programs/bash/ls-colors.nix
|
||||||
|
./programs/bash/undistract-me.nix
|
||||||
./programs/bash-my-aws.nix
|
./programs/bash-my-aws.nix
|
||||||
./programs/bcc.nix
|
./programs/bcc.nix
|
||||||
./programs/browserpass.nix
|
./programs/browserpass.nix
|
||||||
|
|
36
nixos/modules/programs/bash/undistract-me.nix
Normal file
36
nixos/modules/programs/bash/undistract-me.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.programs.bash.undistractMe;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
programs.bash.undistractMe = {
|
||||||
|
enable = mkEnableOption "notifications when long-running terminal commands complete";
|
||||||
|
|
||||||
|
playSound = mkEnableOption "notification sounds when long-running terminal commands complete";
|
||||||
|
|
||||||
|
timeout = mkOption {
|
||||||
|
default = 10;
|
||||||
|
description = ''
|
||||||
|
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 = {
|
||||||
|
maintainers = with maintainers; [ metadark ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue