1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

tmux上でX11のアプリやツールなどを使えなくなった!(例:feh, xclip, xinputなど)

Last updated at Posted at 2025-08-22

このようなエラー

~ $ xinput list
Unable to connect to X server
~ $ feh ~/Pictures/005_electric_ray.jpg
feh ERROR: Can't open X display. It *is* running, yeah?
 ~ $ lxinput

(lxinput:1220471): Gtk-WARNING **: 05:05:16.462: cannot open display: :0
 ~ $ echo ~/notes/van.js | xclip
xclip: Error: Can't open display: :0

に対し、この設定で直ります。
~/.tmux.conf に以下の設定を追加してみてください。

set -g update-environment "DISPLAY XAUTHORITY"

そして tmux kill-server でtmuxサーバを終了させる。
💡TIP: tmux-resurrectでtmuxサーバの状態(セッション、ウィンドウ、ペーンなど)を復活できますよ!

次にtmuxを起動するとき、X11のツールをtmux上でも動かせるはずです。

このupdate-environment のtmuxコマンドで、tmuxを呼び出した環境から環境変数をアタッチすることができます。

ここで、2つの環境変数をtmuxにアタッチします。

  • $DISPLAY: X11によるディスプレイ番号
  • $XAUTHORITY: X11の認証情報ファイル
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?