Display X applications from virtual terminals

2012-05-03 177 words 1 min read

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

author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it