Display X applications from virtual terminals

GNOME Session plugin
GNOME Session plugin (Photo credit: David Siegel)

Here is a script that can help you set the proper envirionment to start a gnome-shell from one of the terminals.

#!/bin/bash - 
#===============================================================================
#
# FILE: xenv.sh
# 
# USAGE: ./xenv.sh 
# 
# DESCRIPTION: http://live.gnome.org/GnomeShell/Debugging
#
# 
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Amit Agarwal (aka), amit.agarwal@roamware.com
# CREATED: 09/14/2011 04:45:31 PM IST
# Last modified: Wed Sep 14, 2011 04:45PM
# REVISION: ---
#===============================================================================

gnome_session=$(pgrep -u $USER gnome-session)
eval export$(sed's/\o000/\n/g;' < /proc/$gnome_session/environ |grep DISPLAY)
eval export$(sed's/\o000/\n/g;' < /proc/$gnome_session/environ |grep XAUTHORITY)
eval export$(sed's/\o000/\n/g;' < /proc/$gnome_session/environ |grep DBUS_SESSION_BUS_ADDRESS)

So, once you have done that you have the correct environment to use the X display and thus you can start the gnome-shell as well or do any other fancy thing that you want 🙂

Enhanced by Zemanta