[not4n00bs] ...Automatic "display" setting

Post tutorials, HOWTO's and other useful resources here.
Post Reply
User avatar
n0ctilucient
Shogun
Shogun
Posts: 426
Joined: 21 Apr 2017, 15:59
Distribution: fullmoonremix
Location: 127.0.0.1
Contact:

[not4n00bs] ...Automatic "display" setting

Post#1 by n0ctilucient » 15 May 2018, 09:48

from... https://ubuntuforums.org/showthread.php?t=1151324

Code: Select all

# In your .bashrc file, assuming you use bash, if you include
# the following script, the DISPLAY variable can be set up
# automatically for you each time you log on.

# Set the DISPLAY variable handling remote logins
who am i | grep '(' > /dev/null
if [ $? -eq 0 ]; then
# remotely logged in
export DISPLAY=`who am i | sed 's/.*(\(.*\)).*/\1/'`
# Append ":0" or ":1" if not already there
echo $DISPLAY | grep : > /dev/null
if [ $? -eq 1 ]; then
export DISPLAY=${DISPLAY}:127.0.0.1.0
# or... export DISPLAY=${DISPLAY}:0.0
fi
fi
#echo DISPLAY=$DISPLAY
This .bashrc entry corrects the following cmdline errors if /etc/environment.conf (DISPLAY=":127.0.0.1.0") fails to...

... `:0.0': not a valid identifier

... cannot find display
:hmmm: I do NOT have the "right" to tell anyone what they should do...
but I reserve the "right" to tell them what they should "consider".

Post Reply