0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ファイルマネージャー「ranger」で画像プレビューが表示されない問題の解決策

Posted at

簡単に結論から

画像プレビュー用パッケージとターミナルエディタの互換性がない可能性があります。

そのため、ターミナルまたはパッケージを互換性があるモノへ変更することで解消します。例えばわたしが使用しているターミナルのAlacrittyでは、ueberzugppパッケージが対応していたため、そちらに変更することで表示されるようになりました。

パッケージの例や、その設定方法はGithub上のWikiにあるImage Previewsから確認できます。

はじめに

この記事は、VIライクなコンソールファイルマネージャーであるrangerで画像プレビューが表示されない問題の解決策を紹介します。

環境

  • Alacritty: Version 0.12.3
  • ranger: ranger 1.9.3

不具合の内容

.config/ranger/rc.confファイルを編集し、以下の行を追加します。

~/.config/ranger/rc.conf
set preview_images true

画像の描画機能付きのw3mをインストールします。今回わたしはArch Linuxを使用しているため、w3mパッケージをpacmanコマンドでインストールしました。

$ sudo pacman -S w3m

rangerを再起動し、あらかじめ保存しておいた画像ファイルまで移動するも、画像プレビューが表示されませんでした。

rangerを閉じると、ターミナル上に以下のようなメッセージが表示されていました。

$ ranger
xdg-open: unexpected option '--'
Try 'xdg-open --help' for more information.

不具合の原因

画像プレビューが表示されない原因は、インストールしたw3mパッケージがターミナルエミュレーターのAlacrittyに対応していないためでした。

以下は、Image Previewsからの引用です。

Get a compatible terminal. Terminals that are known to work are rxvt-unicode, xterm and st (at least since st 0.6, besides if it doesn't work under st, you maybe use ueberzug).

w3mパッケージはxtermなどのターミナルと互換性があるそうなのですが、今回わたしが使用しているAlacrittyとは互換性がなかったようです。

解決策

互換性がなかったということで、ターミナルエミュレータかパッケージのどちらかを変更することで、画像プレビューが表示されるようになります。

今回はueberzugppパッケージに変更することで対応しました。
このパッケージはArch Linuxの場合、AURからインストールできます。

パッケージをインストール後、~/.config/ranger/rc.confファイルを以下のように編集します。

~/.config/ranger/rc.conf
set preview_images true
set preview_images_method ueberzug

rangerを再起動後、画像ファイルまで移動することでプレビューが表示されるようになりました。

参考

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?