Skip to content

Instantly share code, notes, and snippets.

@valinet
Last active December 14, 2020 17:37
Show Gist options
  • Save valinet/20b0a0446307afb92f975b9283defb37 to your computer and use it in GitHub Desktop.
Save valinet/20b0a0446307afb92f975b9283defb37 to your computer and use it in GitHub Desktop.
Moves the menu bar bellow the address bar in Firefox.
// ==UserScript==
// @name menubar on bottom
// @include main
// @author valinet
// ==/UserScript==
UC.menubarbottom = {
resize: function() {
var elem = document.getElementById("TabsToolbar").getElementsByClassName("toolbar-items")[0];
if (window.windowState == 1) // 1 = maximized, 3 = normal
{
elem.style = "";
}
else
{
elem.style = "padding-top: var(--space-above-tabbar)";
}
},
init: function () {
let menubar = document.getElementById("toolbar-menubar");
let tbParent = document.getElementById("navigator-toolbox");
// hide Min, Max, Close buttons on the menu bar
menubar.getElementsByClassName("titlebar-buttonbox-container")[0].style = "display: none";
// style menu bar with semi-transparent overlay (same as address bar)
menubar.style = "background-color: var(--toolbar-bgcolor);";
// move menu bar bellow the address bar
tbParent.appendChild(menubar);
// add/remove top padding (drag space) according to window being normal/maximized
// https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XUL/Events#Window_events
UC.menubarbottom.resize();
window.addEventListener('sizemodechange', UC.menubarbottom.resize);
// move bookmarks bar bellow menu bar
tbParent.appendChild(document.getElementById("PersonalToolbar"));
}
}
UC.menubarbottom.init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment