「Rofi」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(英語版より4、5章を転載)
(設定の項目を英語版に追従)
14行目: 14行目:
 
== 設定 ==
 
== 設定 ==
   
  +
現在、オプションを設定する方法が三つあります。
===カスタムテーマ===
 
   
  +
* ローカル設定。通常、XDGにより {{ic|~/.config/rofi/config.rasi}} にあります。
====公式テーマジェネレータ====
 
  +
* Xresources: X サーバーにキー値を格納する方法です。
  +
* コマンドラインオプション
   
  +
{{Note|Xresources 形式は rofi 1.6.0 より廃止されており、いつでも動作しなくなる可能性があります。}}
[https://davedavenport.github.io/rofi/p11-Generator.html 公式テーマジェネレータ] からテーマを生成できます。
 
   
  +
そのため、
====ユーザーテーマ====
 
   
  +
$ rofi -combi-modi window,drun,ssh -theme solarized -font "hack 10" -show combi
公式の [https://github.com/DaveDavenport/rofi-themes rofi-themes] リポジトリにカスタムテーマが収集されています。
 
   
  +
は、このような設定ファイルで表せます(新しいテーマ形式):
====ロード====
 
  +
{{Pkg|xorg-xrdb}} のインストールが必要です。好きな [https://davedavenport.github.io/rofi/p05-Themes.html Rofi Theme] を選択してコードを {{ic|~/.Xresources}} にコピーしてください。{{ic|xrdb -load ~/.Xresources}} を実行するかコンピュータを再起動することで {{ic|.Xresources}} ファイルがリロードされます。
 
  +
configuration {
  +
modi: "window,drun,ssh,combi";
  +
theme: "solarized";
  +
font: "hack 10";
  +
combi-modi: "window,drun,ssh";
  +
}
  +
  +
{{ic|config.rasi}} ファイルのオプション一覧を取得するには {{ic|rofi -dump-config}} を実行してください。{{ic|rofi -dump-config > ~/.config/rofi/config.rasi}} を実行し、直接あなたの {{ic|config}} ファイルに書き込むことができます。
  +
  +
{{Note|i3 の設定にカンマを入れると問題が発生する可能性があるので注意してください。キーをバインドして rofi を起動するには、設定ファイルを使用するか、カンマを {{ic|#}} で置き換えてください。例:{{ic|rofi -combi-modi window#drun#ssh}}}}
   
 
==Rofi を dmenu の代替として使う==
 
==Rofi を dmenu の代替として使う==

2020年10月7日 (水) 00:54時点における版

関連記事

Rofisimpleswitcher のクローンとして Sean Pringle によって開発が始まり Dave Davenport によって拡張されたウィンドウスイッチャ・実行ダイアログ・SSH ランチャです。dmenu を置き換えることができます。

インストール

公式リポジトリから rofiインストールしてください。

設定

現在、オプションを設定する方法が三つあります。

  • ローカル設定。通常、XDGにより ~/.config/rofi/config.rasi にあります。
  • Xresources: X サーバーにキー値を格納する方法です。
  • コマンドラインオプション
ノート: Xresources 形式は rofi 1.6.0 より廃止されており、いつでも動作しなくなる可能性があります。

そのため、

$ rofi -combi-modi window,drun,ssh -theme solarized -font "hack 10" -show combi

は、このような設定ファイルで表せます(新しいテーマ形式):

configuration {
 modi: "window,drun,ssh,combi";
 theme: "solarized";
 font: "hack 10";
 combi-modi: "window,drun,ssh";
 }

config.rasi ファイルのオプション一覧を取得するには rofi -dump-config を実行してください。rofi -dump-config > ~/.config/rofi/config.rasi を実行し、直接あなたの config ファイルに書き込むことができます。

ノート: i3 の設定にカンマを入れると問題が発生する可能性があるので注意してください。キーをバインドして rofi を起動するには、設定ファイルを使用するか、カンマを # で置き換えてください。例:rofi -combi-modi window#drun#ssh

Rofi を dmenu の代替として使う

Rofi を dmenu の代わりとして使いたい場合、以下のコマンドを使用します:

rofi -show run -modi run -location 1 -width 100 \
		 -lines 2 -line-margin 0 -line-padding 1 \
		 -separator-style none -font "mono 10" -columns 9 -bw 0 \
		 -disable-history \
		 -hide-scrollbar \
		 -color-window "#222222, #222222, #b1b4b3" \
		 -color-normal "#222222, #b1b4b3, #222222, #005577, #b1b4b3" \
		 -color-active "#222222, #b1b4b3, #222222, #007763, #b1b4b3" \
		 -color-urgent "#222222, #b1b4b3, #222222, #77003d, #b1b4b3" \
		 -kb-row-select "Tab" -kb-row-tab ""
ヒント: 上記のコマンドに -dump-xresources フラグを追加して、出力されたテキストをファイルに保存して 公式テーマジェネレータ にアップロードすることでさらなるカスタマイズができます。
ノート: コマンドラインオプションの -show run-modi run によって Rofi は dmenu によって提供されている dmenu_run と同じように動作しますが、Rofi の機能は制限されます。モードについて詳しくは man rofi公式のプロジェクトの説明 を見てください。

Execute shell commands from rofi

If you want the ability to run shell commands or use your own scripts directly from rofi with seeing the output, then ensure following:

  • configure the PATH variable in ~/.profile (instead of e.g. ~/.bashrc) and then logout and re-login to your window manager/desktop environment
  • define -run-shell-command '{terminal} -e \\"{cmd}; read -n 1 -s"'. This allows you to enter the command on the inputbar followed by SHIFT+ENTER. The terminal stays open until the next keypress.

This is an example with the recommended escaping sequence for i3:

 bindsym $mod+d exec --no-startup-id "rofi -show drun -font \\"DejaVu 9\\" -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"

Custom Themes

You can preview and apply themes for rofi with

 rofi-theme-selector

Customizations may be saved to your .Xresources file (requires the xorg-xrdb package). To apply changes reload .Xresources with xrdb -load ~/.Xresources.

Contributed Themes

See the official rofi-themes repository for a list of custom themes.

Download one of the .rasi themes and place it in ~/.config/rofi/example.rasi. Then load up the theme on the command line or in a config file:

 rofi <options> -theme example

or in your configuration file

 rofi.theme:    example