Created
March 20, 2022 11:05
-
-
Save jeangjenq/cd2f9cee4d0043278c66aa0378ee8d45 to your computer and use it in GitHub Desktop.
Find terminal from any linux distro.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from distutils.spawn import find_executable | |
def isNot_exec(name): | |
#check whether terminal program exists | |
return find_executable(name) is None | |
def findTerminal(): | |
termList = ["x-terminal-emulator", "konsole", "gnome-terminal", "urxvt", "rxvt", "termit", "terminator", "Eterm", "aterm", "uxterm", "xterm", "roxterm", "xfce4-terminal", "termite", "lxterminal", "mate-terminal", "terminology", "st", "qterminal", "lilyterm", "tilix", "terminix", "kitty", "guake", "tilda", "alacritty", "hyper"] | |
#list taken from https://github.com/i3/i3/blob/next/i3-sensible-terminal | |
i = 0 | |
for term in termList: | |
if isNot_exec(term): | |
i += 1 | |
else: | |
break | |
return termList[i] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment