Forked from unhammer/window-toggle-decorations.py
Last active
April 22, 2022 11:47
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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