Linux - Laptop and NetbookHaving a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).
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.
There may be a much better why to do what I'm trying to do.
In the windoze world, if your plug your monitor into your laptop, the display magically jumps over to it. Unplug your monitor, and it's back to your laptop.
I've tried many things to do that using debian squeeze, but can't get it.
In high spirits, i decided to be a good little linux user and make a simple script. I thought.
Code:
#/bin/bash
if [ "$(xrandr -q) | $(grep 'VGA1 disconnected')" ]
then
echo "disconnected"
fi
This doesn't do anything at all. I have to C-c to end the script.
The ultimate goal is to make it so I can run the same script to set the monitor resolution or turn my lcd back on.
This is what I have in mind, written in C-ish style:
I dont know if I should be proud, ashamed, or annoyed. This took just a minute, and works perfectly.
What kind of idiot can write a cpp to do this, but cant get a bash script to do it? All well!
Note to viewers: this program does raise security issues, because it assumes xrandr and screen have not been compromised. If anybody wants this for their system, let me know and I'll add a little more to it to make it safer.
You may be going about it the wrong way. I suggest looking into halevt, which uses hal to search for specified system events such as adding and removing hardware and runs arbitrary commands when it detects them.
i ran $ halevt -i to see what happens. It performs as advertised when i unplugged my mouse and plugged it back in. But, it didn't do that with my monitor. It's a nifty daemon though, and I won't forget it's existance. Thank you for the suggestion!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.