some gui programs like gparted (very nice harddisk partitioning program) won’t start as root.

hostnamectl; # tested on
  Operating System: Debian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.0-13-amd64
      Architecture: x86-64

su - root; # become root

gvim; # fails with
E233: cannot open display

gparted; # fails with
(gpartedbin:10160): Gtk-WARNING **: 22:38:52.297: cannot open display: 

# how to fix this
export DISPLAY=':0.0'
cp -v /home/user-running-x11-session/.Xauthority /root/.Xauthority

# then try to start it

# or