Yeah, systemd-run
was one of the key words I used when I bookmarked your post in that topic for myself for later,
but honestly I’m still not sure I’m following you completely…
Thanks for telling me about systemctl --user show-environment
!
The fish equivalent for that line is:
export (systemctl --user show-environment | command grep '^XAUTHORITY=')
(
fish just drops the $
from $()
,
and I know I should make sure to use the default grep
to avoid any weird alias tweaks I might do to it.
)
But yeah, you’re saying I should use that line in my “fishrc” instead of using xhost +
?
Like, what I currently have in my fishrc
(in the section that runs when the host is the opensuse computer)
is this:
if test -z "$SSH_CLIENT" # -z (String length is zero)
xhost +LOCAL: &>/dev/null
end
(
So that runs on the opensuse computer when it’s not over ssh
– I’m not sure using "$SSH_CLIENT"
like that is the “correct” way to do it,
but that’s just what I picked up years ago, no idea where.
)
But you’re saying I should try instead this?:
if test -n "$SSH_CLIENT" # -n (String length is non-zero)
export (systemctl --user show-environment | command grep '^XAUTHORITY=')
end
(So it runs on the opensuse computer only when it is over ssh.)
I just tested it and…
yup, it works!
And that certainly does seem superior
in at least that:
- it doesn’t require
xhost
to be installed, - it’s only being run for ssh when needed,
rather than for every non-ssh shell
And I suspect it’s likely better for other reasons I don’t understand yet.
Thank you!
(
Technically it’s “config.fish” not “fishrc”
but it just occurred to me I may as well do:
ln -s ~/.config/fish/config.fish ~/.fishrc
)