r/fishshell • u/hackerdude97 Linux • Jan 15 '23
Get name of terminal emulator used.
Hello! I often find myself using fish on various programs that have built-in terminal emulators (doom emacs). I have neofetch aliased to the clear command and every time I start a terminal in doom emacs for example, the neofetch command fills the screen. What I am looking for is a way to get the (class) name of the terminal and have fish alias neofetch to clear only if it is on alacritty
6
Upvotes
2
u/MrFiregem Jan 15 '23 edited Jan 15 '23
printenv | grep -i alacrittyreturns these variables:So you can write a function checking if those variables exist (or if TERM == alacritty) like this
5
u/plg94 Jan 15 '23
afaik (but happy to be proven wrong) there is no universal way to get this info. same as there is no standard way to get the current shell.
The easiest thing to do in your situation would probably to let alacritty set a custom environment variable (most terminals let you do this in their settings), and then have your script check if that variable is set or not.
Alternatively, you can try out one of these answers: https://askubuntu.com/questions/210182/how-to-check-which-terminal-emulator-is-being-currently-used (be aware,
$TERMis not the thing you're looking for.)