「St」の版間の差分
(同期) |
|||
| 5行目: | 5行目: | ||
== インストール == |
== インストール == |
||
| − | + | {{Pkg|st}} または {{AUR|st-git}} パッケージを[[インストール]]してください。 |
|
| − | |||
| − | ''zsh'' が予め設定された ''st'' の {{AUR|st-git-zsh}}{{Broken package link|{{aur-mirror|st-git-zsh}}}} パッケージも存在します。 |
||
== 設定 == |
== 設定 == |
||
| 18行目: | 16行目: | ||
''st'' のデフォルトシェルを変更するには、以下の行を編集: |
''st'' のデフォルトシェルを変更するには、以下の行を編集: |
||
| − | + | static char shell[] = "/bin/sh"; |
|
=== ターミナル === |
=== ターミナル === |
||
| 24行目: | 22行目: | ||
ターミナルのタイプを変更するには、以下の行を編集: |
ターミナルのタイプを変更するには、以下の行を編集: |
||
| − | + | static char termname[] = "st-256color"; |
|
''st'' は {{ic|termname}} の値を {{ic|TERM}} 変数に設定します。 |
''st'' は {{ic|termname}} の値を {{ic|TERM}} 変数に設定します。 |
||
| 34行目: | 32行目: | ||
以下の行を自由に編集してください: |
以下の行を自由に編集してください: |
||
| − | + | static char font[] = "Liberation Mono:pixelsize=12:antialias=false:autohint=false"; |
|
コマンドラインでフォントの名前を指定することもできます: |
コマンドラインでフォントの名前を指定することもできます: |
||
| − | + | $ st -f "Liberation Mono:size=12" |
|
=== カラー === |
=== カラー === |
||
| 44行目: | 42行目: | ||
以下の行を編集することで''前景''・''背景''・''カーソル''の色を設定できます: |
以下の行を編集することで''前景''・''背景''・''カーソル''の色を設定できます: |
||
| − | + | static unsigned int defaultfg = 7; |
|
| − | + | static unsigned int defaultbg = 0; |
|
| − | + | static unsigned int defaultcs = 256; |
|
上記の値は同一ファイルの {{ic|*colorname[]}} 配列を参照します。デフォルトの色を使うことも {{ic|#rrggbb}} という形式で色を追加することもできます。例: |
上記の値は同一ファイルの {{ic|*colorname[]}} 配列を参照します。デフォルトの色を使うことも {{ic|#rrggbb}} という形式で色を追加することもできます。例: |
||
| − | + | static const char *colorname[] = { |
|
| − | + | /* 8 normal colors */ |
|
| − | + | "black", |
|
| − | + | "red3", |
|
| − | + | "green3", |
|
| − | + | "yellow3", |
|
| − | + | "blue2", |
|
| − | + | "magenta3", |
|
| − | + | "cyan3", |
|
| − | + | "gray90", |
|
| + | |||
| − | |||
| − | + | /* 8 bright colors */ |
|
| − | + | "gray50", |
|
| − | + | "red", |
|
| − | + | "green", |
|
| − | + | "yellow", |
|
| − | + | "#5c5cff", |
|
| − | + | "magenta", |
|
| − | + | "cyan", |
|
| − | + | "white", |
|
| + | |||
| − | |||
| − | + | [255] = 0, |
|
| + | |||
| − | |||
| − | + | /* more colors can be added after 255 to use with DefaultXX */ |
|
| − | + | "#cccccc", |
|
| − | + | "#eeeeee", |
|
| − | + | "#111111", |
|
| − | + | }; |
|
| + | |||
| − | |||
| − | + | /* |
|
| − | + | * Default colors (colorname index) |
|
| − | + | * foreground, background, cursor |
|
| − | + | */ |
|
| − | + | static unsigned int defaultfg = 257; |
|
| − | + | static unsigned int defaultbg = 258; |
|
| − | + | static unsigned int defaultcs = 256; |
|
| − | == ト |
+ | === デスクトップエントリ === |
| + | 以下のような[[デスクトップエントリ]]を作成することで、指定したフォントで ''st'' を簡単に起動できます (例: {{Pkg|adobe-source-code-pro-fonts}}): |
||
| + | {{hc|~/.local/share/applications/simple-terminal.desktop|2= |
||
| − | === キーボード === |
||
| + | [Desktop Entry] |
||
| − | ==== Backspace が正しく機能しない ==== |
||
| + | Name=Simple Terminal |
||
| + | GenericName=Terminal |
||
| + | Comment=standard terminal emulator for the X window system |
||
| + | Exec=st -t "Suckless Terminal" -f "Source Code Pro:style=Semibold:size=12" -g "80x24" |
||
| + | Terminal=false |
||
| + | Type=Application |
||
| + | Encoding=UTF-8 |
||
| + | Icon=terminal |
||
| + | Categories=System;TerminalEmulator; |
||
| + | Keywords=shell;prompt;command;commandline;cmd; |
||
| + | }} |
||
| + | 上記のメニューエントリはアプリケーションリストのシステムツールに ''Simple Terminal'' として表示されます。 |
||
| − | {{Note|[http://git.suckless.org/st/tree/FAQ FAQ] によれば、この挙動は上流で変更されてたということで、最新版にアップグレードすれば問題は解決するようです。}} |
||
| + | == トラブルシューティング == |
||
| − | 仮想端末や有名な X のターミナルエミュレータは {{ic|backscape}} キーを {{ic|^?}} エスケープシーケンスにバインドしていますが、{{ic|st}} の古いバージョンでは {{ic|^H}} にバインドされています (FAQ の旧版を参照)。 |
||
| − | |||
| − | ({{ic|read}} など) プログラムによっては標準入力で {{ic|backspace}} キーを押すと、文字が消去されずに {{ic|^H}} が出力されることがあります。以下を設定することで解決できます: |
||
| − | |||
| − | stty erase '^H' |
||
| − | |||
| − | 上記の設定でターミナルは {{ic|^H}} を消去コマンドとして認識するようになります。 |
||
| + | ==== アプリケーションによっては DEL キーが正しく機能しない ==== |
||
| − | シェルのプロファイルに上記のコマンドを記述したい場合、シェルを起動する前に {{ic|$TERM}} を確認してください。 |
||
| + | 以下の行を {{ic|~/.inputrc}} または {{ic|/etc/inputrc}} に追加してください: |
||
| + | set enable-keypad on |
||
| − | === Vim === |
||
==== ''vim'' のテキストの背景色が文字でない部分に表示されない ==== |
==== ''vim'' のテキストの背景色が文字でない部分に表示されない ==== |
||
{{ic|config.h}} の {{ic|termname}} を {{ic|st-256color}} に設定して再コンパイルしてみてください。シェルの中で {{ic|TERM}} 変数は設定しないでください。{{ic|st-256color}} に設定すると問題が発生します。 |
{{ic|config.h}} の {{ic|termname}} を {{ic|st-256color}} に設定して再コンパイルしてみてください。シェルの中で {{ic|TERM}} 変数は設定しないでください。{{ic|st-256color}} に設定すると問題が発生します。 |
||
2017年2月19日 (日) 02:15時点における版
st は suckless による X 向けのシンプルなターミナル実装です。xterm や urxvt を置き換える軽量なターミナルとして作られました。st は現在、256色、ほとんどの VT10X エスケープシーケンス、UTF-8、X11 コピー/ペースト、フォントのアンチエイリアス (fontconfig を使用)、フォールバックフォント、リサイズ、config.h によるショートカット、線画をサポートしています。
目次
インストール
st または st-gitAUR パッケージをインストールしてください。
設定
st は config.h ファイルで設定します。コンパイル時に config.h からコピーされます。デフォルトの config.def.h はソースに含まれています。
PKGBUILD と config.h を自分でメンテナンスするようにしてください。
シェル
st のデフォルトシェルを変更するには、以下の行を編集:
static char shell[] = "/bin/sh";
ターミナル
ターミナルのタイプを変更するには、以下の行を編集:
static char termname[] = "st-256color";
st は termname の値を TERM 変数に設定します。
フォント
以下の行を自由に編集してください:
static char font[] = "Liberation Mono:pixelsize=12:antialias=false:autohint=false";
コマンドラインでフォントの名前を指定することもできます:
$ st -f "Liberation Mono:size=12"
カラー
以下の行を編集することで前景・背景・カーソルの色を設定できます:
static unsigned int defaultfg = 7; static unsigned int defaultbg = 0; static unsigned int defaultcs = 256;
上記の値は同一ファイルの *colorname[] 配列を参照します。デフォルトの色を使うことも #rrggbb という形式で色を追加することもできます。例:
static const char *colorname[] = {
/* 8 normal colors */
"black",
"red3",
"green3",
"yellow3",
"blue2",
"magenta3",
"cyan3",
"gray90",
/* 8 bright colors */
"gray50",
"red",
"green",
"yellow",
"#5c5cff",
"magenta",
"cyan",
"white",
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#cccccc",
"#eeeeee",
"#111111",
};
/*
* Default colors (colorname index)
* foreground, background, cursor
*/
static unsigned int defaultfg = 257;
static unsigned int defaultbg = 258;
static unsigned int defaultcs = 256;
デスクトップエントリ
以下のようなデスクトップエントリを作成することで、指定したフォントで st を簡単に起動できます (例: adobe-source-code-pro-fonts):
~/.local/share/applications/simple-terminal.desktop
[Desktop Entry] Name=Simple Terminal GenericName=Terminal Comment=standard terminal emulator for the X window system Exec=st -t "Suckless Terminal" -f "Source Code Pro:style=Semibold:size=12" -g "80x24" Terminal=false Type=Application Encoding=UTF-8 Icon=terminal Categories=System;TerminalEmulator; Keywords=shell;prompt;command;commandline;cmd;
上記のメニューエントリはアプリケーションリストのシステムツールに Simple Terminal として表示されます。
トラブルシューティング
アプリケーションによっては DEL キーが正しく機能しない
以下の行を ~/.inputrc または /etc/inputrc に追加してください:
set enable-keypad on
vim のテキストの背景色が文字でない部分に表示されない
config.h の termname を st-256color に設定して再コンパイルしてみてください。シェルの中で TERM 変数は設定しないでください。st-256color に設定すると問題が発生します。
.vimrc ファイルに以下の行を記述するという解決方法もあります:
if &term =~ '256color'
" disable Background Color Erase (BCE) so that color schemes
" render properly when inside 256-color tmux and GNU screen.
" see also http://sunaku.github.io/vim-256color-bce.html
set t_ut=
endif