新城@筑波大学です。こんにちは。
以前に、macOS で Firefox を複数起動した時に、どのプロファイルを使っている
かを Dock アイコンに文字列を入れて区別するという話を書きました。
From: Yasushi Shinjo <
y...@is.tsukuba.ac.jp>
Newsgroups: fj.net.www.browsers,fj.sys.mac.os-x
Subject: Firefox の MacOSX Dock アイコンに文字列を入れる Addon Custom Badge が便利
Date: Mon, 08 May 2017 18:04:49 +0900
Message-ID: <
85lgq7w...@maple.cs.tsukuba.ac.jp>
これは、Firefox の Extension、Firefox-on-OS-X Label を使うという話でした。
これが、Firefox 57 以降で、使えなくなって困っていました。でも、次の方法で、
Dock アイコンに文字列を入れることができました。基本的な考え方は、プロファ
イルごとに .app を作るということです。
(1) プロファイルごとに、
profilename.app のような .app を作る。
Contents/Info.plist
------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>core.sh</string>
<key>CFBundleIconFile</key>
<string>firefox.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
</dict>
------------------------------------------------------------------------
(2) core.sh の内容は、次のようなシンボリック・リンクにする。
((3)をコピーしても良いけれど、機能追加した時に追随させたいので。)
------------------------------------------------------------------------
$ ls -l Contents/MacOS/core.sh
lrwxr-xr-x 1 yas admin 30 4 5 10:49 Contents/MacOS/core.sh -> /Users/yas/lib/firefox/core.sh
$
------------------------------------------------------------------------
(3) シンボリックリンクの先は、こんな感じのシェルスクリプトにする。
------------------------------------------------------------------------
#!/bin/sh
profile=`echo $0 | sed -e 's/.*\/\(.*\).app.*/\1/'`
/Applications/Firefox.app/Contents/MacOS/firefox-bin -P "$profile" $@
------------------------------------------------------------------------
(4) Firefox を起動する時には、(1) のアプリケーションを起動する。
open
profilename.app
これで、Finder から見ると、
profilename.app のようなアプリケーション動いて
いるように見えます。実体は、/Applications/Firefox.app。Dock だけでなく、
Command+Tab でも profilename が出ます。
この方法で、1つ問題があります。Reeder のように、Firefox と連携するアプリ
ケーションが、このような
profilename.app を認識できません。なので、1つは、
普通に firefox-bin -ProfileManager で起動しないといけません。
あと、Little Snitch が複数の Firefox を区別できないというのがあります。
今後の課題ということで。