Closed mustaqimM closed 4 years ago
sx
itself can't possibly set DISPLAY
to :0
so somewhere this value has been hardcoded.
If you're using a system where the tty you log in on is actually returning tty0
from ps -o tty= -p $$
then check to see if the environment (both DISPLAY
and XAUTHORITY
) are being inherited correctly.
I set in my .profile
:
export XAUTHORITY=~/.local/share/sx/xauthority
And $DISPLAY
shows as :1
. I think I have to manually set certain applications to use :1
as they default to :0
. This includes emacs, xclip(sometimes) and the racket interpreter
It would be very odd if they default DISPLAY
to anything. If you find out where they do this, please share as I'd be interested to see this.
Also you need not export XAUTHORITY
manually as sx
does that unless you use software that needs to be aware of XAUTHORITY
of which aren't started in an environment inherited from sx
.
Since I started using sx, I have to specify the display in emacs daemon mode like this:
/bin/emacs --display=void:1.0 --daemon --no-x-resources
And the racket repl exits with this error:
; On-demand, one-time instantiation of racket/gui/base.
Unable to init server: Could not connect: Connection refused
; Gtk initialization failed for display ":0"
; Context:
; "/usr/share/racket/pkgs/gui-lib/mred/private/wx/gtk/queue.rkt":1:1 [running body]
; "/usr/share/racket/pkgs/gui-lib/mred/private/wx/platform.rkt":1:1 [running body]
Process Racket REPL exited abnormally with code 1
Unfortunately I can't reproduce those issues with either emacs or racket.
Why are you specifying the hostname and screen number in the --display
argument to emacs? I.e. why are you using void:1.0
instead of just :1
? Perhaps knowing more about how you're using sx
might be more helpful.
I saw in the man pages that that's how you specify the display for emacs (I tried :1 and it's the same. I don't normally use the display flag, only because I was getting errors when starting with sx).
I linked above my .profile
and .xinitrc
. I run sx from the .profile
like this:
sx sh ~/.xinitrc 2> .xsession-errors
. I don't do anything else then when running xinit
I can't see anything in your .profile
or .xinitrc
which would prevent sx
from working as expected. I can't reproduce any of this when using awesome
either.
Find out what environment the parent process of emacs
as within it, specifically if DISPLAY
is present. E.g.
# Changing awesome for whatever actually starts emacs
$ tr \\0 \\n < /proc/"$(pgrep -x awesome)"/environ | grep DISPLAY
DISPLAY=:2
I get:
$❯ tr \\0 \\n < /proc/"$(pgrep -x awesome)"/environ | grep DISPLAY
DISPLAY=:1
If awesome is the parent of emacs then it should inherit it without issue. I think you'll have to investigate more thoroughly to find out where you're either overriding DISPLAY
or unsetting it.
I can't think of any reason why Xlib software should be attempting to try :0
unless DISPLAY
has been set to that value. I can't replicate any of your conditions either, even from empty environments.
Any updates on this @mustaqimM or can it be closed?
@Earnestly I'm currently using it as is. I still don't know what's setting DISPLAY
to :1
but it works fine.
(sorry for not responding earlier, I didn't see/get a notification)
I get this is terminal emacs when trying to copy something. I think the error comes from xclip. I'm starting sx from
.profile
: