Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# date: 2017-11-17
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
echo 'install: ~/.mozilla/native-messaging-hosts/hide_titlebar.json'
[[ -d ~/.mozilla/native-messaging-hosts ]] || mkdir -p ~/.mozilla/native-messaging-hosts
cat > ~/.mozilla/native-messaging-hosts/hide_titlebar.json << EOF
{
"name": "hide_titlebar",
"description": "Hide the Firefox titlebar.",
"path": "$HOME/.local/bin/hide-firefox-titlebar.sh",
"type": "stdio",
"allowed_extensions": ["hide-titlebar@nanpuyue.com"]
}
EOF
echo 'install: ~/.local/bin/hide-firefox-titlebar.sh'
[[ -d ~/.local/bin ]] || mkdir -p ~/.local/bin
cat > ~/.local/bin/hide-firefox-titlebar.sh << "EOF"
#!/bin/bash
# date: 2017-11-17
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
python3 -c "import gi; gi.require_version('Gdk', '3.0'); from gi.repository import Gdk, GdkX11;
default_display=GdkX11.X11Display.get_default();
$(for i in $(xdotool search --onlyvisible --class "Firefox|Nightly"); do
echo "GdkX11.X11Window.foreign_new_for_display(default_display, $i).set_decorations(Gdk.WMDecoration.BORDER);"
done)
Gdk.Window.process_all_updates();"
EOF
chmod +x ~/.local/bin/hide-firefox-titlebar.sh
echo 'done'
@nanpuyue

This comment has been minimized.

Copy link
Owner Author

nanpuyue commented Nov 16, 2017

  1. download
    download
  2. run:
bash ./install_hide_firefox_titlebar.sh
  1. install xdotool:
sudo apt install xdotool
  1. install addon: https://addons.mozilla.org/firefox/addon/hide-the-titlebar/
@AE-L

This comment has been minimized.

Copy link

AE-L commented Nov 16, 2017

Hey, there's an unwanted '\n' when the script writes the file:
"
gdk_window =
GdkX11.X11Window.foreign_new_for_display(GdkX11.X11Display.get_default(),
$i);'
"
However it's not working on my archlinux xfce. :/

@nanpuyue

This comment has been minimized.

Copy link
Owner Author

nanpuyue commented Nov 16, 2017

debug:

bash -x ~/.local/bin/hide-firefox-titlebar.sh
@AE-L

This comment has been minimized.

Copy link

AE-L commented Nov 17, 2017

➜ Desktop bash -x ~/.local/bin/hide-firefox-titlebar.sh

++ xdotool search --onlyvisible --class 'Firefox|Nightly'

  • for i in $(xdotool search --onlyvisible --class "Firefox|Nightly")
  • python3 -c 'import gi;gi.require_version('''Gdk''', '''3.0'''); from gi.repository import Gdk, GdkX11; gdk_window = GdkX11.X11Window.foreign_new_for_display(GdkX11.X11Display.get_default(), 54526072); Gdk.Window.set_decorations(gdk_window, Gdk.WMDecoration.BORDER); Gdk.Window.process_all_updates()'
  • for i in $(xdotool search --onlyvisible --class "Firefox|Nightly")
  • python3 -c 'import gi;gi.require_version('''Gdk''', '''3.0'''); from gi.repository import Gdk, GdkX11; gdk_window = GdkX11.X11Window.foreign_new_for_display(GdkX11.X11Display.get_default(), 54525968); Gdk.Window.set_decorations(gdk_window, Gdk.WMDecoration.BORDER); Gdk.Window.process_all_updates()'

'+' are replaced by • .

@JeleoRV

This comment has been minimized.

Copy link

JeleoRV commented Jan 6, 2018

Thanks a lot ! Worked perfectly for me (Ubuntu + Cinnamon).

@ecceccecc

This comment has been minimized.

Copy link

ecceccecc commented Feb 4, 2018

Great! It worked nicely on Lubuntu 17.10, helping to save vertical space on Firefox 58, as the good old Hide Caption Titlebar Plus did with Firefox 56 and before. Just one thing: is it possible to remove padding between tabs and the top of the screen?

EDIT: Nevermind, I solved it by editing the file /home/(myusername)/.config/openbox/lubuntu-rc.xml, adding the following lines under the <applications> section:

<application role="browser">
  <decor>no</decor>
</application>

then saving the file and running openbox --reconfigure. Also, I opened obconf, clicked on "Appearance" and unchecked "Windows retain a border when undecorated". Done.

@JonasCz

This comment has been minimized.

Copy link

JonasCz commented Feb 6, 2018

Thanks, works great, just using the window buttons extensions and not using this (since I can do I though my window manager).

Replaces the old "Hide caption titlebar plus" which died after firefox 56.

@simo98

This comment has been minimized.

Copy link

simo98 commented Feb 21, 2018

It doesn't work on Manjaro Cinnamon
problema_firefox

@SylveonBottle

This comment has been minimized.

Copy link

SylveonBottle commented Feb 22, 2018

Works, but am now completely unable to minimize or drag the window. ArchLinux with Deepin.

@Kayeeec

This comment has been minimized.

Copy link

Kayeeec commented Mar 6, 2018

@SylveonBottle How about draging it with Alt key pressed - this takes care of the minimizing and dragging part.

@danielfreittas

This comment has been minimized.

Copy link

danielfreittas commented Mar 12, 2018

@Bzzz

This comment has been minimized.

Copy link

Bzzz commented Mar 16, 2019

Not doing all that much.

bash -x ~/.local/bin/hide-firefox-titlebar.sh
+++ xdotool search --onlyvisible --class 'Firefox|Nightly'
++ for i in $(xdotool search --onlyvisible --class "Firefox|Nightly")
++ echo 'GdkX11.X11Window.foreign_new_for_display(default_display, 127926289).set_decorations(Gdk.WMDecoration.BORDER);'
+ python3 -c 'import gi; gi.require_version('\''Gdk'\'', '\''3.0'\''); from gi.repository import Gdk, GdkX11;
default_display=GdkX11.X11Display.get_default();
GdkX11.X11Window.foreign_new_for_display(default_display, 127926289).set_decorations(Gdk.WMDecoration.BORDER);
Gdk.Window.process_all_updates();'

Is this project still active?

@Zazcallabah

This comment has been minimized.

Copy link

Zazcallabah commented Apr 29, 2019

PSA: Anyone looking for this feature, before trying this script check if you have the option to disable the title bar down in the lower left corner of the firefox customization screen.

Right click Menu Button > Customize > Uncheck "Title Bar"

@emmandyar

This comment has been minimized.

Copy link

emmandyar commented Oct 10, 2019

Right click Menu Button > Customize > Uncheck "Title Bar"

Thanks!! I didin't knew they added this option!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.