「Rxvt-unicode/ヒントとテクニック」の版間の差分
(→Openbox の設定: 翻訳) |
(→他の設定: 翻訳) |
||
| 116行目: | 116行目: | ||
=== 他の設定 === |
=== 他の設定 === |
||
| − | + | この設定が urxvt kuake Perl スクリプトより優れている点は、Openbox が修飾キーなど、より多くのキーバインドオプションを提供していることです。kuake スクリプトは、修飾キーの組み合わせに関係なく、物理キー全体をハイジャックします。すべての可能性については、[http://openbox.org/wiki/Help:Bindings Openbox bindings documentation] を参照してください。 |
|
| − | + | [http://openbox.org/wiki/Help:Applications Openbox per-app settings] を使って、kuake-like console の動作(画面位置やレイヤーなど)をさらに設定することができます。コンソールの高さを調整するために {{ic|urxvtq}} スクリプトレットで ''geometry'' パラメータを変更する必要があるかもしれません。 |
|
=== 関連スクリプト === |
=== 関連スクリプト === |
||
2022年2月6日 (日) 20:30時点における版
メインの記事は rxvt-unicode を見てください。
目次
Openbox で Kuake ライクな挙動を改善する
以下は元は Xyne によってフォーラムに投稿されたもの [1] で、公式リポジトリにある xdotool に依存しています。
スクリプトレット
urxvtc の man ページにある以下のスクリプトレットをシステム上 (例: ~/.config/openbox) に urxvtc と保存してください:
#!/bin/sh urxvtc "$@" if [ $? -eq 2 ]; then urxvtd -q -o -f urxvtc "$@" fi
そして以下を urxvtq と保存してください:
#!/bin/bash
wid=$(xdotool search --classname urxvtq)
if [ -z "$wid" ]; then
/path/to/urxvtc -name urxvtq -geometry 80x28
wid=$(xdotool search --classname urxvtq | head -1)
xdotool windowfocus "$wid"
xdotool key Control_L+l
else
if [ -z "$(xdotool search --onlyvisible --classname urxvtq 2>/dev/null)" ]; then
xdotool windowmap "$wid"
xdotool windowfocus "$wid"
else
xdotool windowunmap "$wid"
fi
fi
上記で保存した urxvtc を /path/to/urxvtc スクリプトレットへの実際のパスに変更することを確認してください。urxvt の通常のインスタンスと kuake のようなインスタンスの両方を起動するために urxvtc を使用する予定です。
urxvtq とタブ
kuake-like urxvtc (ここでは urxvtq) でタブを使いたい場合は、 urxvtq の3行目を置き換えるだけでよいです。
wid=$(xdotool search --classname urxvtq)
一緒に:
wid=$(xdotool search --classname urxvtq | grep -m 1 "" )
タブサポートを有効にするには、urxvtq の5行目を置き換えるかのどちらかです。
/path/to/urxvtc -name urxvtq -geometry 80x28
一緒に:
/path/to/urxvtc -name urxvtq -pe tabbed -geometry 80x28
または、~/.Xresources ファイルのこの行を置き換えます。
URxvt.perl-ext-common: default,matcher
一緒に:
URxvt.perl-ext-common: default,matcher,tabbed
タブの操作
| キー | 説明 |
|---|---|
| Shift+Left | 左側のタブに切り替える。 |
| Shift+Right | 右側のタブに切り替える。 |
| Shift+Down | 新しいタブを作成。 |
また、マウスで希望のタブをクリックして切り替えることもできますし、[NEW].\\ をクリックすれば新しいタブを作ることもできます。
タブを閉じるには、通常の端末を閉じるのと同じように exit を入力するだけです。
Openbox の設定
~/.config/openbox/rc.xml の <applications> セクションに以下の行を追加:
<application name="urxvtq">
<decor>no</decor>
<position force="yes">
<x>center</x>
<y>0</y>
</position>
<desktop>all</desktop>
<layer>above</layer>
<skip_pager>yes</skip_pager>
<skip_taskbar>yes</skip_taskbar>
<maximized>Horizontal</maximized>
</application>
という行を追加し、<keyboard> セクションに追加してください。
<keybind key="W-t">
<action name="Execute">
<command>/path/to/urxvtc</command>
</action>
</keybind>
<keybind key="W-grave">
<action name="Execute">
<execute>/path/to/urxvtq</execute>
</action>
</keybind>
ここでも、/path/to/* の行を、上記で保存したスクリプトを指すように変更する必要があります。ファイルを保存して、Openbox を再設定します。これで、通常の urxvt インスタンスを Super+T で起動し、kuake 風コンソールを Super+` で切り替えられるようになったはずです。(グレイヴキー、バックティックとも呼ばれる)
他の設定
この設定が urxvt kuake Perl スクリプトより優れている点は、Openbox が修飾キーなど、より多くのキーバインドオプションを提供していることです。kuake スクリプトは、修飾キーの組み合わせに関係なく、物理キー全体をハイジャックします。すべての可能性については、Openbox bindings documentation を参照してください。
Openbox per-app settings を使って、kuake-like console の動作(画面位置やレイヤーなど)をさらに設定することができます。コンソールの高さを調整するために urxvtq スクリプトレットで geometry パラメータを変更する必要があるかもしれません。
関連スクリプト
- hbekel has posted a generalized version of the
urxvtqhere which can be used to toggle any application using xdotool. - http://www.jukie.net/~bart/blog/20070503013555 - A script for opening URLs with your keyboard instead of mouse with urxvt.
パフォーマンスの改善
- Xft フォントは使わないでください。どうしても Xft フォントを使う必要がある場合、設定値に
:antialias=falseを追加してください [2]。 - Build rxvt-unicode with disabled support for unnecessary features,
--disable-xftand--disable-unicode3in particular.[3] - Limit the number of
saveLines(option-sl) in the scrollback buffer to reduce memory usage. [4]- Use tmux for scrollback buffer and set saveLines to 0
- perl の無効化
- Consider running
urxvtdas a daemon accepting connections fromurxvtcclients.
デーモンクライアント
Xinitrc
urxvtd(1) の Examples セクションを見てください。
systemd
システムサービス:
/etc/systemd/system/urxvtd@.service
[Unit] Description=RXVT-Unicode Daemon [Service] User=%i ExecStart=/usr/bin/urxvtd -q -o [Install] WantedBy=multi-user.target
サービスを起動するときにユーザー名を指定します:
urxvtd@username.service
systemd/ユーザーサービスの場合、以下のユニットファイルを ~/.config/systemd/user に配置してください:
urxvtd.service
[Unit] Description=Urxvt Terminal Daemon Requires=urxvtd.socket [Service] ExecStart=/usr/bin/urxvtd -o -q Environment=RXVT_SOCKET=%t/urxvtd-%H [Install] WantedBy=MyTarget.target
urxvtd.socket
[Unit] Description=urxvt daemon (socket activation) Documentation=man:urxvtd(1) man:urxvt(1) [Socket] ListenStream=%t/urxvtd-%H [Install] WantedBy=sockets.target
高度なタブの管理
AUR から urxvt-tabbedexAUR パッケージをインストールして、~/.Xresources の URxvt.perl-ext-common X リソースに tabbedex を追加してください:
URxvt.perl-ext-common: ...,tabbedex,...
"[NEW]" ボタン (めったに使用されず、マウスでのみ使用可能) は、tabbedex のデフォルトでは無効になっています。この機能を再び有効にするには、new-button を true に設定します。
URxvt.tabbed.new-button: true
Tabs can be named with Shift+ ↑ (Enter to confirm, Escape to cancel).
To automatically hide the tabs bar when only one tab is present, enable the following resource:
URxvt.tabbed.autohide: true
To prevent the last tab from closing Urxvt, enable the following resource:
URxvt.tabbed.reopen-on-close: yes
To start a new tab or cycle through tabs, use the following user commands: tabbedex:(new|next|prev)_tab. Example of mappings:
URxvt.keysym.Control-t: perl:tabbedex:new_tab URxvt.keysym.Control-Tab: perl:tabbedex:next_tab URxvt.keysym.Control-Shift-Tab: perl:tabbedex:prev_tab
To define your own key bindings to rename a tab or move a tab to the right or to the left, use the following commands: tabbedex:move_tab_(left|right) and tabbedex:rename_tab. Example of mappings:
URxvt.keysym.Control-Shift-Left: perl:tabbedex:move_tab_left URxvt.keysym.Control-Shift-Right: perl:tabbedex:move_tab_right URxvt.keysym.Control-Shift-R: perl:tabbedex:rename_tab
透過
完全透過
完全透過を使用するには、コンポジタによるコンポジットをサポートしているウィンドウマネージャを使っている必要があります。
コマンドラインから:
$ urxvt -depth 32 -bg rgba:3f00/3f00/3f00/dddd
設定ファイルを使用:
~/.Xresources
URxvt.depth: 32 URxvt.background: rgba:1111/1111/1111/dddd
または:
~/.Xresources
URxvt.depth: 32 URxvt.background: [95]#000000
'95' は透過レベル (パーセンテージ)、'#000000' は背景色に置き換えて下さい。
To use a color i.e. #302351 with the rgba:rrrr/gggg/bbbb/aaaa syntax it would be rgba:3000/2300/5100/ee00. "ee00" (the alpha value) to make it nicely transparent.
疑似透過
完全透過の必要がない場合、もしくはコンポジットによるシステムリソースの消費が多すぎるという場合、以下のようにして透過を使うことができます:
~/.Xresources
! Xresources file URxvt*inheritPixmap: true URxvt*.transparent: true ! URxvt*.shading: 0 to 99 darkens, 101 to 200 lightens URxvt*.shading: 110
上記の URxvt*.shading の代わりに URxvt*background を使うこともできます。
アイコンの設定
デフォルトでは URxvt にはタスクバーアイコンがありません。~/.Xresources に以下の行を追加してアイコンを指定することで簡単に変更することができます:
URxvt.iconFile: /usr/share/icons/Clarity/scalable/apps/terminal.svg
urxvt をアプリケーションランチャーとして使う
urxvt は gmrun などのアプリケーションの代わりとして使うことができます。以下の設定で urxvt を実行するとアプリケーションランチャーのように使用できます。もしくはコマンドをカスタムエイリアスに割り当ててください:
$ urxvt -geometry 80x3 -name 'bashrun' -e sh -c "/bin/bash -i -t"
Xterm のエスケープシーケンス
rxvt-unicode で Xterm のエスケープシーケンスを使うことができます。xterm の中で cat -v を実行してキーの組み合わせを確認したらキーシムを使って urxvt の設定を行います。
単語移動のバインドは以下のようになります:
~/.Xresources
!Xterm escapes, word by word movement URxvt.keysym.Control-Left: \033[1;5D URxvt.keysym.Control-Right: \033[1;5C
詳しくは ascii(7) や urxvt(1) の man ページのキーシムセクションを見てください。
双方向言語のサポート
bidi extension を使用して、ヘブライ語やアラビア語などの双方向言語のサポートを追加することができます。
ベルコマンド
ターミナルでベルが鳴ったときにシェルコマンドを実行することができます。最初に ~/.Xresources ファイルで bell-command 拡張を有効にしてください:
URxvt.perl-ext-common: ...,bell-command,...
以下の例は ALSA の aplay コマンドを使って .wav ファイルを再生します:
URxvt.bell-command: aplay /path/to/a/file.wav
The following example will use libcanberra's canberra-gtk-play command to play the bell sound of your current sound theme:
URxvt.bell-command: canberra-gtk-play -i bell
And the next setting will pop a visual notification:
URxvt.bell-command: notify-send "rxvt-unicode: bell!"