While my previous post provided a method to manually specify 2+ docks, this was not ideal for situations where the number of monitors frequently changes. With that in mind I created a small app that automatically starts a new instance of plank for each monitor. It dynamically adds/removes planks as you add/remove monitors.
You can install the app from my PPA:
sudo apt-add-repository ppa:heathbar/multiplank sudo apt-get update sudo apt-get install multiplank
Once installed, enable multiplank by issuing the following command:
And to disable:
It’s worth noting that this app does not modify or replace plank. It simply configures and starts a new instance of plank for each of the monitors connected to your system.
I opted to create a full-blown compiled app (instead of an arguably simpler shell script) because I wanted an efficient solution. I did not want to have a script running that was wasting cycles by constantly counting the monitors. With this approach, I’m able to register with the OS to be notified whenever the number of monitors changes. Then, I can effectively have the app go to sleep until a monitor change occurs. At that time, the OS wakes up multiplank which re-configures all of the planks and promptly goes back to sleep. If you have a brilliant idea on how to use inotify in a bash script to watch some file and make all of this magic happen, please comment below.
Get the code here: https://code.launchpad.net/~heathbar/multiplank/trunk