我曾经用 sublime 打开文本文件,而对于只读文件,我曾经这样做 :
sudo sublime。但现在突然sudo sublime命令给出以下错误:
(sublime:3931): Gtk-WARNING **: cannot open display:
虽然sublime命令工作正常。我尝试了相同的gedit操作,并且发生了同样的事情,显示了 gedit 的错误:
error: XDG_RUNTIME_DIR not set in the environment.
(gedit:3933): Gtk-WARNING **: cannot open display:
我安装了gtk,试过gksudo了,还是一样的错误!
我在网上搜索并找到了这些方法:
xhost +localhost:https ://askubuntu.com/questions/614387/gksu-gtk-warning-cannot-open-display-0export DISPLAY=:0.0:ssh username@hostname -Xssh username@hostname -Y- https://superuser.com/questions/310197/how-do-i-fix-a-cannot-open-display-error-when-opening-an-x-program-after-sshi
以上都没有奏效。
对我有用的是:
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sublime
我想知道为什么我会收到这个错误,太突然了!另外,我想回到那个sudo sublime版本,因为它很容易记住。我该如何解决?
此外,我最近对系统所做的更改是:
为 Ubuntu 安装的 Mac 主题:http ://www.noobslab.com/2014/04/macbuntu-1404-pack-is-released.html
已安装 gksu(用于 gksudo)
帮助将不胜感激!