firefox でタブバーや URL バーを非表示にする


作ったものをアプリっぽい見た目にしたくなったので

  1. firefox -P で新しいプロファイルを作成して firefox -p ${profile_name} で起動
  2. url bar に about:config と入れて toolkit.legacyUserProfileCustomizations.stylesheetstrue にする
  3. url bar に about:profiles と入れて作ったプロファイルのディレクトリを開く。 linux なら ~/.mozilla/firefox/random.profile-name みたいなのになってるはず
  4. そこに chrome というディレクトリを作り以下のファイルを userChrome.css という名前で保存(内容は Firefox App Mode | Hummdis より)
  5. firefox -p ${profile_name} ${url}

linux 用

userChrome.css
/*
* Custom App Mode Settings for Firefox.
* This duplicates the effects of Chrome App mode.
*
*/
/* Hide the tabs bar. */
/* Hide solo tab */
#TabsToolbar {
    visibility: collapse !important;
}

/* Hide main toolbar contents EXCEPT Address bar */
#nav-bar toolbarbutton, #search-container, #stop-reload-button {
    display: none !important;
}
#nav-bar {
    min-height: 0px !important;
}

/* Hide Address bar when NOT focused (e.g., F6) */
#urlbar:not([focused]), #urlbar:not([focused]) * {
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

windows 用

userChrome.css
/*
* Custom App Mode Settings for Firefox.
* This duplicates the effects of Chrome App mode.
*
*/

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* Hide the Toolbars. */
#TabsToolbar,
#PersonalToolbar,
#BookmarksToolbar,
#MenuToolbar,
#tabbrowser-tabs {
    visibility: collapse !important;
}

/* Hide main toolbar contents EXCEPT Address bar */
/* leaves space for the window buttons */
#search-container,
#stop-reload-button {
    display: none !important;
}

#nav-bar {
    margin-top: -32px !important;
    margin-bottom: -4px !important;
}

/* Hide Address bar when NOT focused (e.g., F6) */
#urlbar:not([focused]),
#urlbar:not([focused]) * {
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

以下 gnome desktop でアプリにする方法

~/.local/share/applications 以下に .desktop ファイルを作る

sample.desktop
[Desktop Entry]
Name=Sample
Exec=firefox -P sample http://sample/
Terminal=false
Type=Application

参考