Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lukestanley/5922793 to your computer and use it in GitHub Desktop.
Save lukestanley/5922793 to your computer and use it in GitHub Desktop.
A quick script to hide the window decoration for Firefox, for on Ubuntu systems like Xubunu, where Firefox can look ugly compared to Chrome/Chromium, taking up unneeded space with it's title bar.
#! /usr/bin/python
"""
To install, you may paste this at your terminal command prompt:
mkdir ~/bin
wget https://gist.github.com/lukestanley/5922793/raw/hide_firefox_titlebar_on_ubuntu_linux.py
mv hide_firefox_titlebar_on_ubuntu_linux.py fixfox; chmod +x fixfox
Then, you may simple enter fixfox, to run it.
"""
from os import path
from os import system as run
if path.exists('/usr/bin/wmctrl') == False: run('sudo apt-get install wmctrl')
try:
import gtk.gdk
except ImportError:
run('sudo apt-get install python-gtk2')
import gtk.gdk
import subprocess #from commands import getstatusoutput
def getstatusoutput(cmd):
"""Return (status, output) of executing cmd in a shell."""
"""This new implementation should work on all platforms."""
pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, universal_newlines=True)
output = "".join(pipe.stdout.readlines())
sts = pipe.returncode
if sts is None: sts = 0
return sts, output
id = getstatusoutput('wmctrl -l | grep Firefox')[1].split(' ')[0]
id=int(id,0)#get integer from hex ID
w = gtk.gdk.window_foreign_new( id)
w.set_decorations(0) # 0 disables decoration, 1 enables
gtk.gdk.window_process_all_updates()
gtk.gdk.flush()
print ('Firefox should now no longer have window decoration')
"""now bind this to super-r or something
credits to: https://gist.github.com/unhammer/1815146
and http://stackoverflow.com/a/1198935/122364 for helping make code more portable
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment