Your first command has a typo. It should be eDP1 not DP1. I suspect if you try it again, it will work. We need to verify that the opposite command works so try xrandr --auto --output DP2 --off and see if works. We also need to verify that xrandr --auto turns both on at once. Assuming these both work try this:
Open kate and copy this into it:
then save it as "setmon" in your home directory (or anywhere - just remember where!). Now open a terminal console (konsole) and navigate to where ever you saved setmon and make it executable with: chmod +x setmon then, with both monitos on and the laptop docked, run it with ./setmon and any option after it. You can see from the file that "both" "main" and "dock" should switch back and forth. For example ./setmon main should turn off the external and leave the laptop monitor on. Try all the options several times in different orders so we know this works. Then we'll figure out how to invoke it automatically.
NOTE: Be sure and have a final empty line in the above file when you save it. The forum CODE tags strip off the trailing empty lines, but in most cases with Linux you need a final carriage return at the end of a file.
Open kate and copy this into it:
Code:
#!/bin/bash # setmon # valid arguments = both main dock case "$1" in both) xrandr --auto ;; dock) xrandr --auto --output eDP1 --off ;; main) xrandr --auto --output DP2 --off ;; *) echo $"Usage: $0 {both|main|dock}" ;; esac exit 0
NOTE: Be sure and have a final empty line in the above file when you save it. The forum CODE tags strip off the trailing empty lines, but in most cases with Linux you need a final carriage return at the end of a file.
Comment