You could try the next solution if you use lightdm:
Modify /etc/lightdm/lightdm.conf
to add the following options:
display-setup-script > calls your mycustomloginvideo.sh
before the login screen appears
session-setup-script > calls your mycustomdesktopvideo.sh
before the user desktop session starts
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
# for your login screen, e.g. LightDM (Ubuntu 11.10) or GDM (11.04 or earlier)
display-setup-script=/usr/share/mycustomloginvideo.sh
# for your desktop session
session-setup-script=/usr/share/mycustomdesktopvideo.sh
You could also use a systemd service:
sudo vim.tiny /etc/systemd/system/xrandrd.service
[Unit]
Description=Run xrandr command
After=graphical.target
[Service]
Type=oneshot
KillMode=none
ExecStart=/home/user/.config/xrandr.sh
[Install]
WantedBy=multi-user.target
$ sudo systemctl enable xrandrd
$ sudo systemctl start xrandrd
$ sudo systemctl daemon-reload # after each xrandrd.service file modification
You could try display-manager.service
instead of graphical.target
Your script could be here:
$ nano ~/.config/xrandr.sh
#!/bin/bash
xrandr --output eDP-1 --scale 0.9x0.9
$ chmod +x ~/.config/xrandr.sh