SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a laptop with suse 10.2 on it.
At work it's connected to a docking station with 2 external monitors.
I have 2 xorg.conf files I switch inbetween.
up until now I have been using a script to ckeck if the lid is open, if the lid is open I use the single xorg file, if the lid is closed the laptop is connected to the docking station and I use the dual-xorg.conf file.
I boot in to runlevel 5.
The problem is that recently I have been unplugging and re-plugging the laptop quite a bit from the docking station.
I want to add my script to the process that call the xorg.conf file so that I can just ctrl+alt+backspace to restart the xserver and in the restart process switch to the correct xorg.conf file.
The script is very simple but does the job:
Code:
if [ "`cat /proc/acpi/button/lid/LID/state`" = "state: closed" ];
then
# Dual screen setup
`cp /etc/X11/xorg.conf.dualscreen /etc/X11/xorg.conf`
fi
if [ "`cat /proc/acpi/button/lid/LID/state`" = "state: open" ];
then
# Laptop mode
`cp /etc/X11/xorg.conf.laptop /etc/X11/xorg.conf`
fi
My big question is where can I call this script from so that it will be run when I do ctrl+alt+backspace?
I also intend to remove it from my startup scripts so that it is only referenced from one location, from the line before the line where xorg.conf is first called.
I would suggest sticking it into /etc/rc.d/rc5.d in order for it to be executed when the system starts the X system when going to init level 5.
However, that said, I am NOT 100% certain this is the right place exactly, for your desire to have it read each time the CTRL-ALT-BACKSPACE is pressed. For CTRL-ALT-DELETE, perhaps YES, but again not sure for CTRL-ALT-BACKSPACE.
If possible, check into the scripts in /etc/X11/xinit/ and try to determine what exactly is the course of events to which that key-stroke is mapped. For example, it might be better to integrate your code into the file /etc/X11/xinit/xinitrc, which I think is the very script which starts X.
Yast CC ->security and users-> local security
opens a box to set Alt cntrl delete actions also but I don't think this is what you need . Might be useful to know if it keeps getting reset after you change it
Danraider, you say it works fine in rc5.d, but you need to reboot for it to take effect..
What if you were to simply telinit to level 1, and then log in again and telinit back to level 5 ? I'm not really sure this would save you any time or effort, but if it's avoiding rebooting you want, it will do that atleast.
All processes are killed when telinit'ing to level one, so to do this can't easily be made a one-shot deal.. And (at least on my system) telinit'ing to any other level other than one, isn't suffucient to cause X to restart.
If there's another method of killing X and restarting it from scratch, while NOT changing to level 1, I'd be keen on knowing what it is, 'cause it may be your answer; I simply don't have enough knowledge/experience yet to figure it out
To repeat what others have said, I'm not really sure if this is what you want but ...
I have used the profile management facility in SuSE. You can configure it to include X settings as part of what is profile specific. You can change profiles while logged in without rebooting.
telinit to level 1 and then back again would do the trick but then that's almost like rebooting anyway...
Why I don't want to reboot is because I run some apps in the background that aren't killed when I restart X. These guys take some time to close and initialize and they could be processing jobs...
statguy, I have seen the profile management facility but I'm not sure how to work it. I have recently migrated from slackware so the thing is I'm much more comfortable in an environment where all settings are governed in files rather than GUI's.
That said, could someone please point me into the right direction regarding setting up different profiles?
statguy, I have seen the profile management facility but I'm not sure how to work it. I have recently migrated from slackware so the thing is I'm much more comfortable in an environment where all settings are governed in files rather than GUI's.
That said, could someone please point me into the right direction regarding setting up different profiles?
thanks!
You set it up in YaST. I'm not posting from my SuSE machine at the moment and I haven't used this on version 10.2 (I'm waiting for a new laptop), only 9.2. This is from memory.
In the configuration screens you can set which services/systems can be changed by profile management. It includes such things as network (useful for me since I connect to multiple wired networks with static IP addresses), printers etc. IIRC, you can even include custom scripts of your own that are run when you change profiles. One of the services that can be included is X. You could opt for all settings or selected settings. Just explore the options before you deploy it. It is also described in the SuSE help system.
I use (and love) slackware as well on another computer. Probably one of the hardest things for a slacker in using SuSE is that it is usually best to use the admin tools you are provided rather than edit the individual config files. There are exceptions, of course.
If I get a chance over the weekend, I'll take a closer look at the profile management in SuSE to see if I forgot anything important.
Here's something to try and/or keep in mind incase it's useful or maybe even does the job:
Code:
killall -HUP X
It will kill all X processes and restart X. Again as before, I'm not certain it will run your script though, but I would *think* that if your script were pasted INTO the beginning of rc5.d, it would swap the xorg.conf file, then continue on to run X afresh.
I have had a look at the profiles.
I created myself a second profile, activated it, edited the setting files and then changed back to my other profile. For some reason the files did not change over when I changed profile. I did add these files and services to the list of files monitored by the profile manager.
When swapping profiles I'm asked to save or discard changes, however the system does not detect any changes. Suse being suse might want me to set up my screen in the gui, problem is that the gui can't set up my screens, xorg must be manually edited.
In regards to killing X, when X is killed -HUP only X is restarted, nothing is calling the runlevel scripts again, if that would have been the case it would have all been working already
This approach is a bit tedious as not even the regular starting-up-X scripts are run. I'm starting to think I might have to go to the source in order to succeed with this approach.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.