Skip to content

Instantly share code, notes, and snippets.

@avallete
Created February 9, 2017 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avallete/e84dc3543ff58e29beace47b29fcf75a to your computer and use it in GitHub Desktop.
Save avallete/e84dc3543ff58e29beace47b29fcf75a to your computer and use it in GitHub Desktop.
A little script to toggle all window titlebar on ubuntu
#!/usr/bin/python
import argparse
from gi import require_version
require_version('Gdk', '3.0')
from gi.repository import Gdk
def check_args():
parser = argparse.ArgumentParser(description="Script to toggle the titlebar into Unity windows.")
parser.add_argument('-D', '--decorate', help='Decorate window.',
action='store_true', dest='decorate')
parser.add_argument('-F', '--focus', help='apply the decoration modification only on focused window.', action='store_true')
return parser.parse_args()
if __name__ == "__main__":
screen = Gdk.Screen.get_default()
args = check_args()
decorator = False
if args.decorate:
decorator = Gdk.WMDecoration.ALL
if args.focus:
windows = [screen.get_active_window()]
else:
windows = screen.get_window_stack()
for win in windows:
win.set_decorations(decorator)
Gdk.Window.process_all_updates()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment