LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2012, 11:09 AM   #1
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Rep: Reputation: 3
Re-starting/initializing XServer Without Loosing Session?


Hello All,

I'm trying to solve a little problem I'm having with my Laptop.

Here's some general info:
Code:
# uname -a
    Linux localhost 2.6.37.6-0.11-default #1 SMP 2011-12-19 23:39:38 +0100 i686 i686 i386 GNU/Linux

# cat SuSE-release
    openSUSE 11.4 (i586)
    VERSION = 11.4
    CODENAME = Celadon

# Xorg -version

    X.Org X Server 1.9.3
    Release Date: 2010-12-13
    X Protocol Version 11, Revision 0
    Build Operating System: openSUSE SUSE LINUX
    Current Operating System: Linux localhost 2.6.37.6-0.11-default #1 SMP 2011-12-19 23:39:38 +0100 i686
    Kernel command line: root=/dev/disk/by-id/ata-ST9250410AS_5VG9JNPG-part7 resume=/dev/disk/by-id/ata-ST9250410AS_5VG9JNPG-part6    splash=silent quiet vga=0x314
    Build Date: 07 February 2012  04:33:35PM
 
    Current version of pixman: 0.20.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
When I'm using my laptop at work I keep it in a Docking Station which has my monitor, keyboard, mouse, etc...
And the problem I'm running into is that whenever I have to go to a meeting or anything like that where I may
need to bring it with me I need to either restart to whole computer all together or take it out of the Docking
Station and issue "CTR+ALT+Backspace". Or go into "nvidia-settings" and 'enable' my laptop screen then issue a
restart of X.


All of those options above are kind of a pain in the butt..!!

And obviously when you do either of these things you will have to close everything out first and start over
again after the reboot...

Does anyone know if when for instance, if I put the laptop to "sleep" or "hibernate", would it "re-read" the
xorg.conf file..? In other words does Xserver sort of "restart" when you come back after putting it to sleep/hibernate?
Because I'm thinking about scripting this out, where I might possibly replace the config file before putting it
to sleep, then upon awakening it would re-read the config file.

I got this idea from this link here (http://www.geekwisdom.com/dyn/node/241), but it doesn't work for my laptop even though it is also a Dell Latitude Laptop. I believe that he used xrandr and a bash script to accomplish it.
Must be have been done on an older version.

Any suggestions would be great...


Thanks in Advance,
Matt

Last edited by mrm5102; 04-12-2012 at 11:43 AM.
 
Old 05-25-2012, 07:57 PM   #2
VDP76
Member
 
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111

Rep: Reputation: 19
Hi Matt,

ok, this is an old thread and I don't know if in the mean while you have came up with a solution, but I'll give it a try..
Quote:
Originally Posted by mrm5102 View Post
In other words does Xserver sort of "restart" when you come back after putting it to sleep/hibernate?
It is my understanding that hibernation is a sort of shut down, so I guess Xorg.conf should be read again at resume, I am not sure if the same applies to sleeping.

At the beginning, the script that you have linked in your post did not work for me as well. The problem was with a function supposed to check if the screen resolution adopted was actually supported by the monitor; after commenting that out, it worked!
Here it is the modified version:
Code:
#!/bin/bash

# Created: 20110908
# Author: Steve Moitozo <god at zilla dot us> -- geekwisdom.com
# License: MIT License (see below)
# Description: 
#  This script does the heavy lifting of switching
#  display settings for various types of configurations:
#    Dualhead (laptop and dock-attached monitor)
#    Monitor only
#    Laptop only
#
# ---------------------------------------------------------------
# Copyright (c) 2006 Steve Moitozo <god at zilla dot us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
#   The above copyright notice and this permission notice shall
# be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
# AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.
#---------------------------------------------------------------

# Configuration
## Edit the following lines with the required outputs and modes.
## Be sure to use parameters which are supported by your monitors.
## Check it opening a terminal and typing "xrandr" without quotes.
LAPTOP_OUTPUT=eDP1
LAPTOP_OUTPUT_MODE=1440x900
MONITOR_OUTPUT=HDMI1
MONITOR_OUTPUT_MODE=1680x1050

case "$1" in
  dualhead)
    ### DOCKED DUAL HEAD
            # Activate the monitor
            xrandr --output $MONITOR_OUTPUT --mode $MONITOR_OUTPUT_MODE
            # Activate the laptop
            xrandr --output $LAPTOP_OUTPUT --mode $LAPTOP_OUTPUT_MODE
            # Monitor primary
            xrandr --output $MONITOR_OUTPUT --primary
            # Position the laptop to the right of the monitor
            xrandr --output $LAPTOP_OUTPUT --right-of $MONITOR_OUTPUT
    ;;
  monitor-only)
    ### DOCKED MONITOR ONLY
        # Monitor primary
        xrandr --output $MONITOR_OUTPUT --primary
        # Turn off laptop
        xrandr --output $LAPTOP_OUTPUT --off
        # Activate the monitor
        xrandr --output $MONITOR_OUTPUT --mode $MONITOR_OUTPUT_MODE
    ;;
  laptop-only)
    ### DOCKED LAPTOP ONLY
        # First, turn off monitor
        xrandr --output $MONITOR_OUTPUT --off
        # Activate the laptop
        xrandr --output $LAPTOP_OUTPUT --mode $LAPTOP_OUTPUT_MODE
    ;;
  *)
    echo "Usage: tweakdisp [dualhead|monitor-only|laptop-only]"
    ;;
esac
exit $?
Try this one and let's see how it goes...

Anyway, talking about automation at startup, I have realized that xrandx is a powerful tool for scripting, check this out: http://crunchbanglinux.org/forums/post/214037/#p214037.

Good luck

Last edited by VDP76; 05-25-2012 at 07:58 PM. Reason: typo
 
1 members found this post helpful.
Old 05-29-2012, 09:40 AM   #3
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
Hey VDP76, thanks for your reply...

Na, I never found a solution to this problem. I kinda just gave up after a while, I felt like I was just going in circles with it and not getting much closer to the goal.

Cool, I'll give your changes to the script a try and see how it goes.
Also, I'll check out that link you posted for any other good info.

Thanks again for your suggestions, I appreciate your help!

Thanks Again,
Matt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
loosing internet connection via firewall when starting skype from ubuntu jake.smeden@gmail.com Linux - Networking 0 09-21-2011 06:22 PM
Starting and stopping rsync without loosing a lot of data bixbyr Linux - Networking 3 08-09-2011 03:32 PM
SSH Session loosing connection Cloudthumper Linux - Networking 1 10-04-2007 04:21 AM
xserver not starting locke105 Slackware 4 03-25-2005 07:56 AM


All times are GMT -5. The time now is 03:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration