I updated to Ubuntu 18.04 a few weeks ago with little to no problems until now. After an update I installed and a reboot, my sidebar (Ubuntu dock) shows on the secondary screen, which is my Laptop, while my HDMI monitor is saved as the primary and has the top bar with time, battery and so on.
How can I get the sidebar back to my primary screen?
In Ubuntu 20.04 Focal Fossa, there's a simple setting you can configure in Appearance -> Dock -> Show on:
CLI method:
You can disable the multiple monitors option for the dock by running the following command in Terminal:
Then you can set your preferred monitor by running
(Put
-1
in place of<monitor-number>
for the primary monitor)GUI method:
See the answer by singrium and the answer by Dan Dascalescu.
(GUI method may not work in special cases)
You can get the sidebar back to your primary screen by doing the following.
An example (Ubuntu 18.04):
CLI Method 2022
pomsky's solution doesn't work anymore, as the
preferred-monitor
setting is now deprecated according to the dconf editor.Luckily they point to the new responsible setting:
preferred-monitor-by-connector
, which now uses not numbers but monitor names as used in output of:which in my case is:
Monitor with the index
0
is my primary one. But I need it on the second monitor. So I grab the last field of the row with the index 1 and run this:done.
Why I need a command line solution at all? Because after upgrade to 22.04 my monitor settings get reset each time one or both of the displays get turned off and on again. It's totally annoying to set everything back again manually (by mouse) in the settings. Therefore I wrote a script where I set everything I need back again. I then call the script easily by a ulauncher shortcut after one of my displays gets disconnected or when I login after a suspension of the session. It's (probably) easier then to figure out what actually causes the reset of the settings again and again - I've just recently (a couple of months ago) switched to Ubuntu from macOS, so I think such kind of quick hacks are totally legit.