「Chromium 設定」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(同期)
タグ: 新規リダイレクト
 
(5人の利用者による、間の11版が非表示)
1行目: 1行目:
  +
#REDIRECT[[Chromium#ヒントとテクニック_2]]
[[Category:ウェブブラウザ]]
 
[[en:Chromium/Tips and tricks]]
 
[[zh-hans:Chromium/Tips and tricks]]
 
{{Related articles start}}
 
{{Related|Chromium}}
 
{{Related|Firefox 設定}}
 
{{Related|Profile-sync-daemon}}
 
{{Related|Tmpfs}}
 
{{Related articles end}}
 
 
== ブラウズのエクスペリエンス ==
 
=== chrome://xxx ===
 
URL フィールドに ''chrome://xxx'' と入力することで様々な設定にアクセスすることができます。完全なリストは URL フィールドに '''chrome://chrome-urls''' と入力することで見ることが可能です。以下有名な URL のリスト:
 
 
* '''chrome://flags''' - WebGL などの実験的な機能や GPU によるウェブページのレンダリングなどにアクセスできます。
 
* '''chrome://plugins''' - 現在使用している Chromium プラグインを表示・有効化・無効化。
 
* '''chrome://gpu''' - 様々な GPU オプションの状態。
 
* '''chrome://sandbox''' - サンドボックスの状態を表示。
 
* '''chrome://version''' - バージョンや {{ic|/usr/bin/chromium}} を実行するときに使われたスイッチを表示。
 
 
自動的に更新される Chromium のスイッチのリストが [http://peter.sh/experiments/chromium-command-line-switches/ こちら] にあります。
 
 
=== Chromium タスクマネージャ ===
 
 
Shift+ESC でブラウザのタスクマネージャを立ち上げることができます。メモリや CPU、ネットワークの使用量が閲覧可能です。
 
 
=== ダウンロードタブのアイコンが表示されない ===
 
Chromium のダウンロードタブで適当なアイコンの代わりにアイコンのプレースホルダ (壊れたドキュメントを示すアイコン) が表示される場合、おそらく {{Pkg|adwaita-icon-theme}} がインストールされていません。
 
 
=== Chromium が Preferences ファイルを上書きしてしまう ===
 
 
Google アカウントの同期を有効にしている場合、{{ic|$HOME/.config/chromium/Default/Preferences}} 下の Preferences ファイルに直接編集を加えていても Chromium によって上書きされてしまいます。上書きされないようにするには、{{ic|--disable-sync-preferences}} スイッチを付けて Chromium を起動してください:
 
$ chromium --disable-sync-preferences
 
 
デスクトップ環境のログイン時にバックグラウンドで Chromium を起動する場合、デスクトップ環境から使用するコマンドを以下のようにしてください:
 
$ chromium --disable-sync-preferences --no-startup-window
 
 
=== 検索エンジン ===
 
[https://wiki.archlinux.org wiki.archlinux.org] や [https://en.wikipedia.org wikipedia.org] などのウェブサイトは検索を実行してから ''Settings > Search'' を選択して ''Manage search engines..'' ボタンをクリックすることで簡単に検索できるように設定できます。エントリを "Edit" してキーワードを '''w''' などに変更してください (ショートカットは自由に決めて下さい)。これでアドレスバーに "'''w arch linux'''" と入力するだけで "Arch Linux" で検索できるようになります。
 
 
{{Note| Google search is used automatically when typing something into the URL bar. A hard-coded keyword trigger is also available using the '''?''' prefix.}}
 
 
=== Tmpfs ===
 
==== tmpfs にキャッシュ ====
 
{{Note|Chromium actually keeps its cache directory '''separate''' from its browser profile directory.}}
 
 
物理ディスクに対する Chromium のキャッシュの書き込みを制限したい場合、{{ic|1=--disk-cache-dir=/foo/bar}} フラグでキャッシュの書き込み先を変更することができます:
 
$ chromium --disk-cache-dir=/tmp/cache
 
 
キャッシュは一時的になり、再起動したりハードロックすると消えます。もしくは、以下のように設定することもできます:
 
{{hc|/etc/fstab|2=
 
tmpfs /home/''username''/.cache tmpfs
 
noatime,nodev,nosuid,size=400M 0 0
 
}}
 
 
{{Warning|Adjust the size as needed and be careful. If the size is too large and you are using a sync daemon such as [[psd]] on a conventional HDD, it will likely result in very slow start-up times of your graphical system due to long sync back times of the daemon. }}
 
 
==== tmpfs にプロファイル ====
 
{{Ic|/tmp}} や {{Ic|/dev/shm}} などの [[tmpfs]] ファイルシステムにプロファイルを保存することで Chromium の応答性が改善されます。
 
 
プロファイルを動的に管理するスクリプトを使うことで信頼性と使いやすさを最大限高めることができます。
 
 
{{AUR|profile-sync-daemon}} はその目的で開発されているスクリプトであり [[AUR]] から直接インストールできます。profile-sync-daemon はブラウザプロファイルのディレクトリのシンボリックリンクを作成し、定期的にメモリと同期をとります。詳細については [[Profile-sync-daemon]] の記事を参照して下さい。
 
 
===新しいブラウザインスタンスを起動===
 
When you launch the browser, it first checks if another instance using the same profile is already running. If there is one, the new window is associated with the old instance. To prevent this, you can specifically ask the browser to run with a different profile.
 
 
$ chromium --user-data-dir=<PATH TO A PROFILE>
 
 
{{Note|It won't work if you specify a link or even a symlink to your regular chromium profile (typically {{ic|~/.config/chromium/Default}}). If you want to use the same profile as your current one for this new instance, first copy the folder {{ic|~/.config/chromium/Default}} to a directory of your choice, keeping the same {{ic|Default}} name, and launch the browser using the following command by specifying the parent folder of the {{ic|Default}} folder you have just copied.
 
For example, if you copied the Default folder to {{ic|~/Downloads}}: {{ic|1=$ chromium --user-data-dir=~/Downloads}}.
 
}}
 
 
===torrent クライアントで *.torrent ファイルやマグネットリンクを直接開く===
 
By default, Chromium downloads {{ic|*.torrent}} files directly and you need to click the notification from the bottom left corner of the screen in order for the file to be opened with your default torrent client. This can be avoided with the following method:
 
 
* Download a {{ic|*.torrent}} file.
 
* Right click the notification displayed at the bottom left corner of the screen.
 
* Check the "Always Open Files of This Type" checkbox.
 
 
デフォルトの関連付けの変更については [[xdg-open]] を見てください。
 
 
=== タッチスクリーンデバイスでタッチスクロール ===
 
Chrome と Chromium はデフォルトではタッチスクリーンをサポートしていません。chrome の 'flags' から変更できる設定がいくつかあり、あなたの使用しているデバイスで使うことができるかもしれません。公式リポジトリの {{Pkg|chromium}} や AUR の {{AUR|google-chrome}} でテスト済みです。
 
 
* Browse to '''chrome://flags''' and set everything to default
 
* Switch "''Enable Touch events''" to "''Enabled''" ('''chrome://flags/#touch-events''')
 
* Restart Chrome and touch scrolling should work. If it does not, it is worth trying the other modes that are available.
 
* You may need to specify which touch device to use. Find your touchscreen device with {{ic| xinput list}} then launch Chromium with the {{ic|1=--touch-devices='''x'''}} parameter, where "'''x'''" is the id of your device. {{Note|If the device is designated as a slave pointer, using this may not work, use the master pointer's ID instead.}}
 
 
=== メモリの使用量を減らす ===
 
 
デフォルトでは、Chromium は開いているウェブサイトの数だけ OS プロセスを作成します [https://www.chromium.org/developers/design-documents/process-models#Supported_Models]。Chromium の起動時にコマンドラインスイッチを指定することで挙動を変更することが可能です。
 
 
例えば、全てのウェブサイトでひとつのプロセスを共有するには:
 
 
$ chromium --process-per-site
 
 
シングルプロセスモデルを使うには:
 
 
$ chromium --single-process
 
 
{{Warning|While the single-process model is the default in [[Firefox]] [https://wiki.mozilla.org/Electrolysis] and other browsers, it may contain bugs not present in other models. [https://www.chromium.org/developers/design-documents/process-models#TOC-Single-process]}}
 
 
In addition, you can suspend or store inactive Tabs with extensions such as [https://chrome.google.com/webstore/detail/tab-suspender/fiabciakcmgepblmdkmemdbbkilneeeh?hl=en Tab Suspender] and [https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall?hl=en OneTab].
 
 
=== ユーザーエージェント ===
 
 
Chromium の起動時に {{Ic|<nowiki>--user-agent="[string]"</nowiki>}} パラメータを指定することでユーザーエージェントは任意に変更することができます。
 
 
==プロファイルのメンテナンス==
 
Chromium は [[Sqlite]] データベースを使用して履歴やお気に入りを管理しています。Sqlite データベースは使っているうちに断片化していきます。しかしながら、データベースをチェックしたり最適化するプロセスが存在しないため、断片化によって段々とパフォーマンスに影響が出て来ます。デフラグを行ってデータベースから未使用領域を削除することで、起動時間やブックマークや履歴に関連する作業を素早く実行することができます。
 
 
[[AUR]] の {{AUR|profile-cleaner}} と {{AUR|browser-vacuum}} でメンテナンスができます。
 
 
== セキュリティ ==
 
=== WebRTC ===
 
WebRTC は JavaScript を使用する通信プロトコルですが、VPN を使っている場合でもマシンの IP アドレスやハードウェアのハッシュ値が漏洩する可能性があります。VPN ソフトウェアによってはスクリプトの実行が阻止されることもありますが、プロトコルを直接ブロックしてしまう方が安全です。2016年10月現在、Chromium で WebRTC を無効化する方法はありませんが、ローカル IP アドレスの漏洩を阻止する拡張が存在します [https://chrome.google.com/webstore/detail/webrtc-network-limiter/npeicpdbkakmehahjeeohfdhnlpdklia]。
 
 
WebRTC は [https://www.privacytools.io/webrtc.html こちらのページ] でテストできます。
 
 
{{Warning|IP の漏洩は防げても、Chromium はユニークなハッシュを送信しており、それを止める方法はありません。詳しくは https://www.browserleaks.com/webrtc#webrtc-disable を読んでください。}}
 
 
=== SSL 証明書 ===
 
Chromium には SSL 証明書マネージャが存在しません。Chromium は NSS の共有 DB {{ic|~/.pki.nssdb}} を使用しています。データベースに SSL 証明書を追加するには、シェルを使う必要があります。
 
 
==== 自己署名証明書の CAcert 証明書を追加 ====
 
CAcerts を取得して {{ic|nssdb}} を作成してください (存在しない場合)。作成するには {{Pkg|nss}} パッケージをインストールして以下を実行する必要があります:
 
 
$ mkdir -p $HOME/.pki/nssdb
 
$ cd $HOME/.pki/nssdb
 
$ certutil -N -d sql:.
 
 
$ curl -k -o "cacert-root.crt" "http://www.cacert.org/certs/root.crt"
 
$ curl -k -o "cacert-class3.crt" "http://www.cacert.org/certs/class3.crt"
 
$ certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "CAcert.org" -i cacert-root.crt
 
$ certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "CAcert.org Class 3" -i cacert-class3.crt
 
 
{{Note|Users will need to create a password for the database, if it does not exist.}}
 
 
これでユーザーは手動で自己署名証明書をインポートできるようになります。
 
 
==== 例 1: シェルスクリプトを使って TomatoUSB から証明書を分離 ====
 
以下は証明書を展開してユーザーの {{ic|nssdb}} に追加するシンプルなスクリプトです:
 
 
#!/bin/sh
 
#
 
# usage: import-cert.sh remote.host.name [port]
 
#
 
REMHOST=$1
 
REMPORT=${2:-443}
 
exec 6>&1
 
exec > $REMHOST
 
echo | openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
 
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n "$REMHOST" -i $REMHOST
 
exec 1>&6 6>&-
 
 
使用方法はコメント化されている行を見てください。
 
 
参照:
 
*http://blog.avirtualhome.com/adding-ssl-certificates-to-google-chrome-linux-ubuntu
 
*https://chromium.googlesource.com/chromium/src/+/master/docs/linux_cert_management.md
 
 
==== 例 2: Firefox を使って TomatoUSB から証明書を分離 ====
 
{{Pkg|firefox}} ブラウザを使って証明書をファイルに保存してデータベースに手動でインポートすることができます。
 
 
firefox を使用:
 
#Browse to the target URL.
 
#Upon seeing the "This Connection is Untrusted" warning screen, click: ''I understand the Risks > Add Exception...''
 
#Click: ''View > Details > Export'' and save the certificate to a temporary location ({{ic|/tmp/easy.pem}} in this example).
 
 
Now import the certificate for use in Chromium:
 
$ certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "easy" -i /tmp/easy.pem
 
 
{{Note|Adjust the name to match that of the certificate. In the example above, "easy" is the name of the certificate.}}
 
 
=== Canvas Fingerprinting ===
 
Canvas Fingerprinting は HTML5 の canvas のレンダリング結果の差異を使ってユーザーを識別する技術です。{{ic|--disable-reading-from-canvas}} フラグを使うことで Canvas Fingerprinting を使えないようにすることができます。
 
 
フラグが機能しているかどうか確認するには [https://panopticlick.eff.org こちらのテスト] を実行して "hash of canvas fingerprint" の結果を確認してください。
 
 
{{Note|拡張の中には canvas からの読み込みを必要とするものがあり、{{ic|--disable-reading-from-canvas}} を設定すると機能しなくなることがあります。}}
 
 
== フラグを永続的に設定 ==
 
{{Note|{{ic|chromium-flags.conf}} は Arch Linux 固有のファイルで、カスタムランチャースクリプトによってサポートされています。{{ic|chromium 42.0.2311.90-1}} で追加されました。}}
 
 
{{ic|$HOME/.config/}} (あるいは環境変数を設定している場合 {{ic|$XDG_CONFIG_HOME}}) にある {{ic|chromium-flags.conf}} ファイルにフラグを記述できます。
 
 
特殊な構文はありません。ターミナルに書くのと同じようにフラグは定義します。
 
 
* The arguments are split on whitespace and shell quoting rules apply, but no further parsing is performed.
 
* In case of improper quoting anywhere in the file, a fatal error is raised.
 
* Flags can be placed in separate lines for readability, but this is not required.
 
* Lines starting with a hash symbol (#) are skipped.
 
 
以下は {{ic|chromium-flags.conf}} ファイルで {{ic|--start-maximized --incognito}} フラグを定義する例です:
 
 
# This line will be ignored.
 
--start-maximized
 
--incognito
 
 
== 参照 ==
 
 
* [https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt tmpfs の公式カーネルドキュメント]
 

2023年6月23日 (金) 22:37時点における最新版