mRandr is a small utility with limited use for those with multiple monitors and exactly HDMI, DVI, DisplayPort as options, using a arandr generated script, it can set the monitors that change numbers after boot.
proc sleep {time} { after $time set end 1 vwait end }
proc timestamp { } { return "\[[clock format [clock seconds] -format {%m/%d %H:%M:%S}]\] " }
I simply run this in my ~/.profile. I use this simple bash script to launch it wherever I keep it.
#!/bin/bash #/home/marc/bin/xsaver_turn_Off_HDMI_pi cd /speedy/spark/xsaver_turnOffHDMI_pi/ tclsh main.tcl
#/speedy/spark/xsaver_turnOffHDMI_pi/main.tcl set debug FALSE set verbose FALSE proc verbose:puts { args } { if {$::verbose} { puts {*}$args } } proc debug:puts { args } { if {$::debug} { puts {*}$args } } proc cmd:run { args } { set cmd [eval concat $args] if { [catch {open |$cmd r+} pipe] } { verbose:puts "cmd:run\[$pipe\]<<ERROR \[$::errorCode\]" } else { verbose:puts "cmd:run\[$pipe\]>>\[$cmd\]" fconfigure $pipe -buffering none -blocking 1 fileevent $pipe readable [list cmd:read $pipe] } } proc cmd:read { pipe } { set chars [gets $pipe line] if { [eof $pipe] || $chars == -1} { fileevent $pipe readable {} if { [catch {close $pipe} code] } { puts "cmd:read\[$pipe\]>>Error \[$::errorCode\] $code" } else { debug:puts "cmd:read\[$pipe\]>>pipe closed." } set _(done) 1 return } else { verbose:puts "cmd:read\[$pipe\]<<\[$line\] ($chars chars)" } if {[string first "BLANK" $line] == 0 } { puts "cmd:read\[$pipe\]>>Turning off HDMI" cmd:run [list "/opt/vc/bin/tvservice" "-o"] } elseif {[string first "UNBLANK" $line] == 0 } { puts "cmd:read\[$pipe\]>>Turning on HDMI" cmd:run [list "/opt/vc/bin/tvservice" "-p"] } } cmd:run "xscreensaver-command -watch" vwait forever