3

In my new laptop in Xubuntu 16.04 toggle screen Fn button is not working so I need to write a script that will toggle the display, for this to work I need to check if screen is on or off, how can I do that from command line?

I can use:

sudo vbetool dpms off/on

but I need to know which command to execute, I didn't test it yet because will need to turn my display on after I turn in off.

jcubic
  • 914
  • 6
  • 16
  • 31

2 Answers2

1

I've ended up with this script:

#!/bin/bash

file=/tmp/display

if [ -e $file ]; then
    rm $file
    sudo vbetool dpms on

else
    touch $file
    sudo vbetool dpms off
fi
jcubic
  • 914
  • 6
  • 16
  • 31
0

xrandr can list the on screens for you. You can then grep any or all of their id's from there:

xrandr --listmonitors

I wrote a bash screen toggle script using it and mentioned it in a similar question: Lubuntu: hotkey to toggle displays