Toggle- dim a specific screen
The command to dim the screen (not switch off, but not "sleep" either) would be:
xrandr --output $monitor --brightness 0
You can however easily toggle- dim the targeted screen with a keyboard shortcut. Add the script below to a shortcut:
#!/bin/bash
# --- set your monitor below
monitor=VGA-0
# ---
if [ -z "$(xrandr --verbose | grep 'Brightness: 0.0')" ]; then
xrandr --output $monitor --brightness 0
else
xrandr --output $monitor --brightness 1
fi
To use
- Copy the script into an empty file, save it as
dim_screen.sh, and make it executable
- In the head of the script, set the name of your targeted screen. Run the command
xrandr to find out if you don't know.
- Add it to a shortut key: Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
/path/to/dim_screen.sh
Explanation
The test:
[ -z "$(xrandr --verbose | grep 'Brightness: 0.0')" ]
will see if the command xrandr --verbose | grep 'Brightness: 0.0' has an output, in other words, if your screen is dimmed. If so, it will set the targeted screen to "normal" brightness (1.0):
xrandr --output $monitor --brightness 1
...else it will dim the screen with the command:
xrandr --output $monitor --brightness 0
Note
It seems impossible to only put a specific screen to sleep. This answer is written, assuming you want the screen, dimmed, but switching it off, including the black out of both screens, is too much a fuzz.