I am using Ubuntu 17.04 on my laptop and I am using an additional monitor with a optimal resolution of 1600x900 and since Ubuntu doesn't have this resolution by default I managed to write a script with a bun ch of commands to add the new resolution and affect it to the monitor but sometimes even though the script runs and the resolution changes an error window pops up that I cannot see because it's black and it's flickering and every time this problem happens my custom theme restores to default along with the custom icons and cursor and can't change them even if I select the theme from Unity Tweak Tool. As a result the font becomes thinner and shortcuts such as Ctrl+Alt+T to open terminal don't work.
Here is the script I run at the start of every session:
xrandr --newmode "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
xrandr --addmode HDMI-1 1600x900_60.00
xrandr --output HDMI-1 --mode 1600x900_60.00
xrandr --output HDMI-1 --left-of eDP-1
xrandr --output eDP-1 --pos 1600x236