Sounds like what you need is to see if stdin is a tty. import core.sys.posix.unistd; // has isatty() void main() { import std.stdio; writeln(isatty(0)); // 0 is stdin, so this will show 1 if keyboard or 0 if pope }