0

I'm using a laptop running Ubuntu 19.04, moving it between two different desks, both with docking station. On each desk I use external display as primary, laptop screen as secondary. I'm hibernating the laptop when moving between desks.

My setup is following:

  • Desk one - older monitor, FullHD resolution, sound is coming from monitor (audio over HDMI)
  • Desk two - newer monitor, higher resolution, sound from the laptop dock.

I have two issues:

1) If I move from desk one to desk two, laptop uses low resolution on the screen which is bit ugly. I can fix the resolution after I log in, I just open "Display Settings" and resolution fixes itself.

I also need to switch sound output from HDMI to laptop speakers.

2) If I move from desk two to desk one the monitor actually can't handle the resolution at all. That means I have issue with logging in - login screen is on primary monitor which does not have any picture (resolution too high). I have to either:

  • log in without actually seeing login screen then open "Display Setting" from secondary display (it's just right mouse on desktop so it's doable) or
  • remove laptop from dock, log in and put it back.

I also need to switch sound output from HDMI to laptop.

The second issue is obviously more annoying because I don't see the login screen at all.


My question: Is there some way to configure Ubuntu to update the display setting automatically, when moving between desks?

  • really you're talking about automation that's incredibly specific to you. Ubuntu is not meant to be able to automagically know which sound output and video resolution you want. maybe in the future... anyways a good start here would be scripting resetting sound output and video out going back to a default every time an undock is detected. but this would also require diligence on your part : you'd have to never do things in the following order : 1.) close lid 2.) undock. It would have to always be 1.) undock 2.) close lid / hibernate. If you don't respect that order would mess things up again. – tatsu Jun 14 at 8:27
  • this is because an undock can theoretically be detected and serve as a crontab event or other script event. hybernate on the other hand shuts the system of and while you probably can detect it's happening, there's probably no way to garantee a task will be executed before hibernate completes rather than after the session resumes (E.G. too late). so first task is detecting undocking. maybe lsusb -v ca nhelp us here. can you edit to include the output of that command 1.) when the laptop is unplugged 2.) when the laptop is docked to desk 1 3.) when the laptop is docked to desk 2 ? use pastebin. – tatsu Jun 14 at 8:30
  • all things considered the way you have things right now sounds real comfortable to me. I doubt windows would fare any better. a lazyman's approach would be to find out which terminal commands make your sound output the right thing on each dock same for resolution. make these into two seperate shell script files you place on your desktop. and you can double click arrived_at_dock_two.sh when you just docked into dock two and double click about_to_undock_from_dock_two.sh when you're about to go to dock one (because that one can't be run on arrival), and there you have it. – tatsu Jun 14 at 8:38
  • I can deal with with it, it's just bit annoying. What is the problematic part is that when I switch from "better" to "worse" external display I don't see a login screen at all. I just press esc and type my password in because that's how I rembember the login screen works. But it can look like laptop is dead if you are not aware of the situation. – Arnost Valicek Jun 14 at 12:08
  • And btw Windows actually do handle better when I go from high resolution better external display to less capable display. I got this laptop with windows so I can confirm it works fine (but not an option for me now :) – Arnost Valicek Jun 14 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.