I run an asynchronous dual montior setup. My primary monitor is a 16:9 2560×1440 and my secondary is 10:16 1200×1920 setup. I use the primary for coding/gaming/videos and the secondary for browsing, and reference materials.I also prefer to keep the launcher on the secondary monitor as it is on the right hand side of my primary.
The problem is that some of my games seem to think that the monitor which the launcher is on is considered the primary monitor. Some games give me launch options where I can force it over to my preferred monitor but some I need to switch the launcher placement in the display settings.
I would like to script a solution that allows me to quickly toggle the settings rather than needing to go into the screen display ui every time. I found ~/.config/monitors.xml
and have tried swapping the primary monitor and then killing unity-settings-daemon
and restarting it but that seems like it's not without side effects. Does anyone know a better way?
Best Answer
Launcher positions
Launcher positions can be defined by two parameters:
1. Launcher on all screens, or just on one
is set by the commands:
to show on all screens, or
to show on a single screen
2. The screen where the Launcher is visible
In the latter case (launcher only on one screen), the launcher is only visible on the primary screen. In other words, we need to set (toggle) the primary screen. This can be done with the command:
What we need is a script to look up the currently set primary screen (from the output of the
xrandr
command), and choose "the other one", and so does the script below.The script:
If you also need to make sure the launcher is set to show on a single screen, use:
How to use
toggle_launcher.py
Test- run it by the command:
If all works fine, add it to a shortcut key: choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
to a shortcut key combination of your choice.