[SOLVED] Execute disper second time doesn't take effect
Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
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 use disper to auto detect the event when my external monitor is plugged again.
The problem is if the command gets executed once it won't take effect at the second time (I believe it's because I don't understand its or its backend xrandr behavior).
For instance,
1. Unplug the external monitor.
2. Plug the external monitor again.
3. Execute `disper -d auto -e` takes effect because the external monitor is back displaying window manager's workspace.
4. Do 1.
5. Do 2.
6. Do 3 again (execute `disper -d auto -e` again), but this time the external monitor stays black without displaying workspace.
If executing command that basically swaps the position of monitors (e.g. first time inner monitor is at left, external monitor is at right; then swap to inner monitor is at right, external monitor is at left) like `disper -e -t left`. Then the monitor would display window manager's workspace without a problem.
My questions - why the command being executed the second doesn't take effect? And more importantly what steps should I follow so that monitors plug/unplug events auto detection can be done without a problem?
Last edited by shogun1234; 02-20-2018 at 10:40 AM.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
I think disper parses a command line for xrandr. After xrandr is run and the monitor is working, and then you unplug it, disper might not undo the xrandr command. So, when you run the program again it's trying to add a mode that's already been added.
OK, usually laptops have a button along the top to toggle between video devices, or ports. gnome-control-center will allow you to configure your displays persistently, so they won't change. When you unplug the ext. monitor, it will shut off the port.
When you plug it back in, use the key on your keyboard to toggle it back on.
I think disper parses a command line for xrandr. After xrandr is run and the monitor is working, and then you unplug it, disper might not undo the xrandr command. So, when you run the program again it's trying to add a mode that's already been added.
OK, usually laptops have a button along the top to toggle between video devices, or ports. gnome-control-center will allow you to configure your displays persistently, so they won't change. When you unplug the ext. monitor, it will shut off the port.
When you plug it back in, use the key on your keyboard to toggle it back on.
Thanks for the explanation. That helps me a lot! I then switch to run `disper -e` when unplug. Then `disper -e` again once the external monitor is plugged. This solves my problem. The procedure is:
1. write udev rule to detect plug/ unplug event.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.