33

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?

4 Answers 4

49

In Ubuntu 20.04 Focal Fossa, there's a simple setting you can configure in Appearance -> Dock -> Show on:

Change Dock settings in Ubuntu 20 Focal Fossa

3
  • there actually a bug. it is either on all monitor or just primary monitor, it cannot be on non-primary monitor only.
    – Wang
    Commented Jul 11, 2020 at 21:20
  • Thanks, this had bugged out suddenly on my 20.04 so very annoyingly the foldout dock activated every time my mouse was going between the monitors as it was magically moved to the non-primary monitor on my right :)
    – BjornW
    Commented Jan 7, 2021 at 15:32
  • This option now seems to be found under the "Ubuntu Desktop" section of the settings.
    – nedned
    Commented Aug 5, 2023 at 4:00
24

CLI method:

You can disable the multiple monitors option for the dock by running the following command in Terminal:

gsettings set org.gnome.shell.extensions.dash-to-dock multi-monitor false

Then you can set your preferred monitor by running

gsettings set org.gnome.shell.extensions.dash-to-dock preferred-monitor <monitor-number>

(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)

0
8

You can get the sidebar back to your primary screen by doing the following.

  1. Open Settings.
  2. Go to Dock.
  3. On the section Show on, choose the screen you want to display the Dock in.

An example (Ubuntu 18.04):

enter image description here

0
0

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:

xrandr --listactivemonitors

which in my case is:

 0: +*DP-0 3840/600x2160/340+3840+0  DP-0
 1: +HDMI-1 3840/600x2160/340+0+0  HDMI-1

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:

gsettings set org.gnome.shell.extensions.dash-to-dock preferred-monitor-by-connector HDMI-1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .