I’m using xmacro to record keyboard shortcuts, which requires a $DISPLAY to replay on. But, sometimes my $DISPLAY is :0 and sometimes :1, so every time that happens I have to change the value manually. Why does it keep changing, and is there a way to set the $DISPLAY value to either :0 or :1 permanently? (I can export DISPLAY=:0 in one terminal, but that doesn’t change the value of $DISPLAY in new terminals.)
I’m using xmacro to record keyboard shortcuts, which requires a $DISPLAY to replay on.
Share
The number identifies the display (“a collection of monitors that share a keyboard and mouse”)
:0is usually the local display (i.e. the main display of the computer when you sit in front of it).:1is often used by services like SSH when you enable display forwarding and log into a remote computer.It can also be modified by startup scripts which try to “fix” it. To find out whether this is happening, run
.??*is a trick to get all dot files without..and.(parent and current folder).If that doesn’t print anything, check
/etc/profile,/etc/bash*and/etc/bash*/*in a similar manner.I couldn’t find a useful manual for xmacro but most X11 application support the option
-dor-displayto override$DISPLAY.If this doesn’t work, create
xmacro.shwith this content:Now invoke the tool with
xmacro.shand it should always work.