You are not logged in.

#1 2021-07-07 18:47:43

goldmund
Member
Registered: 2021-02-15
Posts: 73

[SOLVED]How to switch off and redirect the output of my laptop screen?

Hi!

Most of the time I am using my laptop on the desk with an external monitor plugged in. I would like the laptop screen to switch off when it sees that the monitor is plugged in, but also stay on when I venture the world without the monitor.

I wrote this myself some time ago and have been using it as part of my .xprofile:

if [[ "$(xrandr --query | grep "HDMI-1 connected")" ]]; then
  autorandr monitor
else
  autorandr laptop
fi

I know this looks ugly and I am sure there exists something better. What would you recommend using? I would like to have a system which automatically recognizes what type of device gets plugged in (monitor, TV, projector), switches off the laptop display and directs the output to the device with the appropriate settings. And when unplugged, then the other way around of course.

Thanks!

Last edited by goldmund (2021-07-08 17:42:06)

Offline

#2 2021-07-07 19:30:20

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,523

Re: [SOLVED]How to switch off and redirect the output of my laptop screen?

Offline

#3 2021-07-07 19:49:16

goldmund
Member
Registered: 2021-02-15
Posts: 73

Re: [SOLVED]How to switch off and redirect the output of my laptop screen?

Apart from not being maintained any more, this looks great. I will go with that, unless anyone else has another idea...

Offline

#4 2021-07-07 20:08:35

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,523

Re: [SOLVED]How to switch off and redirect the output of my laptop screen?

What do you mean by "not being maintained any more"?
Also Keith is the Chuck Norris of X11 - his code doesn't need maintainance.

Offline

#5 2021-07-07 20:20:09

goldmund
Member
Registered: 2021-02-15
Posts: 73

Re: [SOLVED]How to switch off and redirect the output of my laptop screen?

seth wrote:

What do you mean by "not being maintained any more"?
Also Keith is the Chuck Norris of X11 - his code doesn't need maintainance.

Haha, all right then. I tend not to touch things which were last updated 9 years ago, but I'll go with that, it's actually just what I was looking for. Thank you!

Offline

Board footer

Powered by FluxBB