コンテンツにスキップ

「Sxiv」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
ページの作成:「Category:グラフィックとデスクトップパブリッシング en:Sxiv {{Lowercase title}} {{Related articles start}} {{Related|feh}} {{Related articles en...」
 
Zkn (トーク | 投稿記録)
恐らく翻訳時の語順ミスにより原文と意味が変わってしまっていた箇所を修正
 
(3人の利用者による、間の11版が非表示)
1行目: 1行目:
[[Category:グラフィックとデスクトップパブリッシング]]
[[en:Sxiv]]
{{Lowercase title}}
{{Lowercase title}}
[[Category:ラスタ画像]]
[[en:Sxiv]]
[[fi:Sxiv]]
[[uk:Sxiv]]
{{Related articles start}}
{{Related articles start}}
{{Related|feh}}
{{Related|feh}}
{{Related articles end}}
{{Related articles end}}


[http://github.com/muennich/sxiv sxiv] (Simple [[X]] Image Viewer) は C で書かれている軽量でスクリプト可能な画像ビューアです。
[https://github.com/muennich/sxiv sxiv] (Simple [[X]] Image Viewer) は C で書かれている軽量でスクリプト可能な画像ビューアです。


== インストール ==
== インストール ==


[[公式リポトリ]]{{Pkg|sxiv}} を[[インストール]]してください
次のパッケージのいずれかを [[インストール]] してさい:


* {{Pkg|nsxiv}} 現在メンテナンスされていない''sxiv'' のフォークであり、sxiv の (主に) ドロップイン代替としての目的を持ち、インターフェイスはそのままで、シンプルな機能を追加します。開発リリース版は、 {{AUR|nsxiv-git}} でインストールできます。
== sxiv にキーボードショートカットを設定 ==
* {{Pkg|sxiv}} オリジナルのパッケージ、現在メンテナンスされていません。
sxiv supports external key events. First you have to press {{ic|Ctrl-x}} to send the next key to the external key-handler. The external key-handler requires an executable file {{ic|~/.config/sxiv/exec/key-handler}} and passes the key combination pressed as well the name of the current image as arguments.


== 使い方 ==
In this example, we will add the bindings {{ic|Ctrl+d}} to execute {{ic|mv ''filename'' ~/.trash}}, {{ic|Ctrl+c}} to copy the current image's name to the clipboard with {{Pkg|xclip}}, and {{ic|Ctrl+w}} to set the current wallpaper with [[nitrogen]].

=== sxiv にキーボードショートカットを設定 ===

sxiv は特殊なキーイベントをサポートしています。まず {{ic|Ctrl-x}} を押してから外部のキーハンドラにキーを送信してください。外部のキーハンドラには実行可能ファイル {{ic|~/.config/sxiv/exec/key-handler}} が必要であり、押されたキーの組み合わせや現在の画像の名前が引数として渡されます。(何もマークされていない場合は、現在選択中の画像となります) sxiv をインストールすると、key-handler のサンプルが同梱されます: {{ic|/usr/share/sxiv/exec/key-handler}} この例は、ショートカットをカスタマイズするための素晴らしいスタートです。

$ mkdir -p ~/.config/sxiv/exec/
$ cp /usr/share/sxiv/exec/key-handler ~/.config/sxiv/exec/key-handler

必ずスクリプトに [[ヘルプ:読み方#実行可能属性の付与|実行可能属性を付与]] してください。

以下の例では、バインディング {{ic|Ctrl+d}} によって {{ic|mv ''filename'' ~/.trash}} を実行し、{{ic|Ctrl+c}} で現在の画像の名前を {{Pkg|xclip}} でクリップボードにコピーし、{{ic|Ctrl+w}} で [[nitrogen]] を使って現在の壁紙を設定します。


{{hc|~/.config/sxiv/exec/key-handler|<nowiki>
{{hc|~/.config/sxiv/exec/key-handler|<nowiki>
#!/bin/sh
#!/bin/sh
while read file

do
case "$1" in
case "$1" in
"C-d")
mv "$2" ~/.trash ;;
"C-d")
mv "$file" ~/.trash ;;
"C-r")
convert -rotate 90 "$2" "$2" ;;
"C-r")
convert -rotate 90 "$file" "$file" ;;
"C-c")
"C-c")
echo -n "$2" | xclip -selection clipboard ;;
echo -n "$file" | xclip -selection clipboard ;;
"C-w")
nitrogen --save --set-zoom-fill "$2" ;;
"C-w")
nitrogen --save --set-zoom-fill "$file" ;;
esac
esac
done
</nowiki>}}
</nowiki>}}


{{ic|.trash}} フォルダが存在しない場合は作成:
Be sure to mark the script as executable
$ chmod +x ~/.config/sxiv/exec/key-handler

Create {{ic|.trash}} folder if it does not exist:
$ mkdir ~/.trash
$ mkdir ~/.trash


{{Tip|{{ic|mv "$2" ~/.trash}} の代わりに ({{Pkg|trash-cli}} や {{AUR|bashtrash}} などの) [https://freedesktop.org/wiki/Specifications/trash-spec/ 標準互換のゴミ箱ツール] を使うこともできます。}}
{{Tip|You may want to use a [http://freedesktop.org/wiki/Specifications/trash-spec/ standards-compliant trashcan] (like {{AUR|trash-cli}} or {{AUR|bashtrash}}) rather than {{ic|mv "$2" ~/.trash}}.}}


== ヒントとテクニック ==
== Tips and tricks ==


=== ファイルを開いた後にディレクトリの画像をブラウズ ===
=== ファイルを開いた後にディレクトリの画像をブラウズ ===


''sxiv''<nowiki/> の開発者は、引数として指定されたファイル名のディレクトリ内のすべての画像をプログラムで参照するように要求されることが何度かありました ([https://github.com/muennich/sxiv/issues/352] および [https://github.com/muennich/sxiv/issues/105]) を参照、望ましい動作を特徴とするフォークがいくつかあります: [https://github.com/doronbehar/sxiv doronbehar's]、[https://github.com/qsmodo/sxiv qsmodo's]、[https://github.com/sammoth/sxiv sammoth's]
Place [http://git.savannah.gnu.org/cgit/ranger.git/tree/doc/examples/rifle_sxiv.sh this script] in {{ic|/usr/local/bin}} and call it like this:

あるいは、{{pkg|sxiv}} の公式バージョンを使用し、[https://github.com/ranger/ranger/blob/master/examples/rifle_sxiv.sh このスクリプト] を {{ic|/usr/local/bin}} に配置して、次のように呼び出します:

$ ''scriptname'' a_single_image.jpg
$ ''scriptname'' a_single_image.jpg


スクリプトの中のコメントに書かれているように、[[ranger]] の中から画像を開くときに使うことができます。
Alternatively you can also install the script as a package from the AUR: {{AUR|sxiv-rifle}}.


[https://github.com/muennich/sxiv/issues/365] のこのシェルスクリプトは、{{ic|sxiv}} を開始します。
As indicated in the comments of the script, it may be used to have this behavior when opening images from within [[ranger]].
渡されたファイル引数がフォルダである場合に限り、サムネイルモードになります:

{{hc|~/bin/sxiv.sh|<nowiki>
#!/bin/sh

if command -v sxiv >/dev/null 2>&1; then
if [ -d "${@: -1}" ] || [ -h "${@: -1}" ]; then
sxiv -t "$@"
else
sxiv "$@"
fi
elif command -v feh >/dev/null 2>&1; then
feh "$@"
else
echo "Please install SXIV or FEH!"
fi
</nowiki>}}


=== ステータスバーに画像サイズを表示 ===
=== ステータスバーに画像サイズを表示 ===


Place the following executable script in {{ic|~/.config/sxiv/exec/image-info}} and make sure that you have the {{Pkg|exiv2}} package installed:
以下の実行可能スクリプトを {{ic|~/.config/sxiv/exec/image-info}} に配置して {{Pkg|exiv2}} パッケージをインストールしてください:


{{hc|~/.config/sxiv/exec/image-info|<nowiki>
{{hc|~/.config/sxiv/exec/image-info|<nowiki>
68行目: 100行目:
filesize=$(du -Hh "$1" | cut -f 1)
filesize=$(du -Hh "$1" | cut -f 1)


geometry=$(identify -format '%wx%h' "$1[0]")
geometry=$(identify -format '%wx%h' "$1")


tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }')
tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }')
78行目: 110行目:
== 参照 ==
== 参照 ==


* Arch Linux [https://bbs.archlinux.org/viewtopic.php?id=112643 forum thread].
* Arch Linux [https://bbs.archlinux.org/viewtopic.php?id=112643 フォーラムスレッド]
* [[wikipedia:Keyboard_layout#B.C3.89PO|bépo]] キーボードレイアウト (フランス語話者のための [[Dvorak]] 派生キーボードレイアウト) 用の Sxiv: [https://bepo.fr/wiki/Vim#Visionneuse_d.27image_Sxiv Sxiv bépo]

2025年8月9日 (土) 20:09時点における最新版

関連記事

sxiv (Simple X Image Viewer) は C で書かれている軽量でスクリプト可能な画像ビューアです。

インストール

次のパッケージのいずれかを インストール して下さい:

  • nsxiv 現在メンテナンスされていないsxiv のフォークであり、sxiv の (主に) ドロップイン代替としての目的を持ち、インターフェイスはそのままで、シンプルな機能を追加します。開発リリース版は、 nsxiv-gitAUR でインストールできます。
  • sxiv オリジナルのパッケージ、現在メンテナンスされていません。

使い方

sxiv にキーボードショートカットを設定

sxiv は特殊なキーイベントをサポートしています。まず Ctrl-x を押してから外部のキーハンドラにキーを送信してください。外部のキーハンドラには実行可能ファイル ~/.config/sxiv/exec/key-handler が必要であり、押されたキーの組み合わせや現在の画像の名前が引数として渡されます。(何もマークされていない場合は、現在選択中の画像となります) sxiv をインストールすると、key-handler のサンプルが同梱されます: /usr/share/sxiv/exec/key-handler この例は、ショートカットをカスタマイズするための素晴らしいスタートです。

$ mkdir -p ~/.config/sxiv/exec/
$ cp /usr/share/sxiv/exec/key-handler ~/.config/sxiv/exec/key-handler

必ずスクリプトに 実行可能属性を付与 してください。

以下の例では、バインディング Ctrl+d によって mv filename ~/.trash を実行し、Ctrl+c で現在の画像の名前を xclip でクリップボードにコピーし、Ctrl+wnitrogen を使って現在の壁紙を設定します。

~/.config/sxiv/exec/key-handler
#!/bin/sh
while read file
do
        case "$1" in
        "C-d")
                mv "$file" ~/.trash ;;
        "C-r")
                convert -rotate 90 "$file" "$file" ;;
        "C-c")
                echo -n "$file" | xclip -selection clipboard ;;
        "C-w")
                nitrogen --save --set-zoom-fill "$file" ;;
        esac
done

.trash フォルダが存在しない場合は作成:

$ mkdir ~/.trash
ヒント mv "$2" ~/.trash の代わりに (trash-clibashtrashAUR などの) 標準互換のゴミ箱ツール を使うこともできます。

ヒントとテクニック

ファイルを開いた後にディレクトリの画像をブラウズ

sxiv の開発者は、引数として指定されたファイル名のディレクトリ内のすべての画像をプログラムで参照するように要求されることが何度かありました ([1] および [2]) を参照、望ましい動作を特徴とするフォークがいくつかあります: doronbehar'sqsmodo'ssammoth's

あるいは、sxiv の公式バージョンを使用し、このスクリプト/usr/local/bin に配置して、次のように呼び出します:

$ scriptname a_single_image.jpg

スクリプトの中のコメントに書かれているように、ranger の中から画像を開くときに使うことができます。

[3] のこのシェルスクリプトは、sxiv を開始します。 渡されたファイル引数がフォルダである場合に限り、サムネイルモードになります:

~/bin/sxiv.sh
#!/bin/sh

    if command -v sxiv >/dev/null 2>&1; then
      if [ -d "${@: -1}" ] || [ -h "${@: -1}" ]; then
        sxiv -t "$@"
      else
        sxiv    "$@"
      fi
    elif command -v feh >/dev/null 2>&1; then
      feh "$@"
    else
      echo "Please install SXIV or FEH!"
    fi

ステータスバーに画像サイズを表示

以下の実行可能スクリプトを ~/.config/sxiv/exec/image-info に配置して exiv2 パッケージをインストールしてください:

~/.config/sxiv/exec/image-info
#!/bin/sh

# Example for ~/.config/sxiv/exec/image-info
# Called by sxiv(1) whenever an image gets loaded,
# with the name of the image file as its first argument.
# The output is displayed in sxiv's status bar.

s=" | " # field separator

filename=$(basename "$1")
filesize=$(du -Hh "$1" | cut -f 1)

geometry=$(identify -format '%wx%h' "$1")

tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }')
tags=${tags%,}

echo "${filesize}${s}${geometry}${tags:+$s}${tags}${s}${filename}"

参照