My computer requires me to use ARandR every time I start a new session with my TV hooked up with HDMI

Every time I have to log out or restart my computer, I have to run my command:
xrandr --output HDMI-A-0 --set underscan on --set “underscan hborder” 95 --set “underscan vborder” 54
…to fix the overscan on my Panasonic TC-L32X2 that cannot be fixed in the TV’s settings. Is there any way to let my computer know to run this command only when I connect my Computer to my TV?

On my notebook I used arandr to make the settings that I wanted (the monitor, screen res’, duplication & such). Then told arandr to make a config file which on my system (I use MX, but that doesn’t matter here) allowed me to create the following:

~/.screenlayout/dual.displays.Clevo.sh

Which looks like this:

#!/bin/sh
xrandr --output eDP-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --primary --mode 1920x1200 --pos 0x0 --rotate normal --output HDMI-1 --off --output DP-2 --off --output DP-1 --off

Then I call that script every time that Openbox starts in the ~/.config/openbox/autostart file with the following:

 ## Run an arandr executable script with custom dual monitor config:
## ~/.config/autostart/conky.desktop is starting late (due to it reading IP address)
## this causes it to start as if 1080p on the 1200p external display. So I try delay:
sleep 4 && ~/.screenlayout/only.external.display.Clevo.sh &

Because you are using systemd & I don’t expect that you are using Openbox, you will have to call this file elsewhere. If you have an ~/.xinitrc file you can do it there, if you don’t then you’ll have to ferret out where to start it from these days in Manjaro (I’ve been away for more than a couple of years now. :slight_smile:

Anyway, you CAN do what you want, it is very reliable once you have set it up, & it really isn’t very hard to do.

Someone here will tell you where/how to autostart your arandr settings file in Manjaro.

Note: I expect that arandr (wonderful little GUI for doing all of this stuff) is part of the initial install of Manjaro, if it isn’t, then install it, it will definitely be in the repo.

1 Like

Hi!
What @handy explained will work if you always use that config, if you don’t, make the config in arandr, create the script, it’ll save in ~/screenlayout/your.script.sh, make it executable with
chmod +x ~/screenyaout/your.script.sh.
From here, you have a couple ways to launch it. This is the way I do it.
Add this line to the ~/.bashrc or ~/.zshrc if you’re using zsh

## Dual-monitor config
alias dmonitor='sh ~/screenlayout/your.script.sh'

Then do source .bahsrc or source .zshrc to reload de bash config.
Now, you just need to launch in a terminal dmonitor and it’ll lauch your script and you’ll have your config.
You can change ```dmonitor`` to whatever word you choose