@@ -161,6 +161,28 @@ usage() {
161161 exit 1
162162}
163163
164+ check_display () {
165+ consolemode=0
166+ if [ " ${DISPLAY} " ]
167+ then
168+ # First check if on a console screen
169+ have_tty=` type -p tty`
170+ [ " ${have_tty} " ] && {
171+ tty=$( tty)
172+ echo " ${tty} " | grep /dev/tty > /dev/null && consolemode=1
173+ echo " ${tty} " | grep /dev/con > /dev/null && consolemode=1
174+ }
175+ # Next check if this is an SSH session
176+ [ ${consolemode} -eq 0 ] && {
177+ # Check if this is an SSH session
178+ [ -n " $SSH_CLIENT " ] || [ -n " $SSH_TTY " ] && consolemode=1
179+ }
180+ else
181+ consolemode=1
182+ fi
183+ return ${consolemode}
184+ }
185+
164186kill_tmux_sessions () {
165187 SESSIONS=" asciiville asciisplash"
166188 for session in ${SESSIONS}
@@ -2610,15 +2632,17 @@ show_main_menu() {
26102632 [ " ${have_splash} " ] && options+=(" ASCII Animations" )
26112633 options+=(" Apps & Games" )
26122634 [ " ${have_bb} " ] && {
2613- [ " $DISPLAY " = " " ] || options+=(" AAlib Demo (X11 mode)" )
2635+ check_display
2636+ [ $? -eq 0 ] && options+=(" AAlib Demo (X11 mode)" )
26142637 }
26152638 [ " ${have_bb} " ] && options+=(" AAlib Demo (Curses mode)" )
26162639 [ " ${have_mapscii} " ] && options+=(" Mapscii World Map" )
26172640 [ " ${have_curl} " ] && options+=(" Phase of the Moon" )
26182641 options+=(" Run ${show_comm} in ${show_term} " )
26192642 [ " ${have_ddgr} " ] && options+=(" Search the Web" )
26202643 [ " ${have_curl} " ] && [ -x ${TOOLSBIN} /pokefetch ] && {
2621- options+=(" Show a Pokemon" )
2644+ check_display
2645+ [ $? -eq 0 ] && options+=(" Show a Pokemon" )
26222646 }
26232647 [ " ${have_speed} " ] && options+=(" Speed Test" )
26242648 [ " ${have_rainbow} " ] && options+=(" Twitter Client" )
@@ -3413,12 +3437,16 @@ while getopts "Aabc:CdD:E:fFgiIjJkKlL:mMn:NpP:rRSs:tTUvV:wWxXyYzZu" flag; do
34133437 break
34143438 ;;
34153439 pok* |Pok* )
3416- [ " ${have_curl} " ] && {
3417- [ -x ${TOOLSBIN} /pokefetch ] && {
3418- ${TOOLSBIN} /pokefetch
3440+ check_display
3441+ [ $? -eq 0 ] && {
3442+ [ " ${have_curl} " ] && {
3443+ [ -x ${TOOLSBIN} /pokefetch ] && {
3444+ ${TOOLSBIN} /pokefetch
3445+ exit 0
3446+ }
34193447 }
34203448 }
3421- exit 0
3449+ INTERACTIVE=1
34223450 ;;
34233451 reddit|Reddit)
34243452 [ " ${have_tuir} " ] && tuir
0 commit comments