Skip to content

Instantly share code, notes, and snippets.

@ludoo
Created October 28, 2014 08:18
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 ludoo/46d21a3161aad7c6588e to your computer and use it in GitHub Desktop.
Save ludoo/46d21a3161aad7c6588e to your computer and use it in GitHub Desktop.
Remove GTK window decorations for a named window
#!/usr/bin/env python
import sys
try:
from gtk import gdk
except ImportError:
raise SystemExit("You need to have python-gtk installed for this to work")
def remove_decorations(name):
root = gdk.get_default_root_window()
names = []
for id in root.property_get('_NET_CLIENT_LIST')[2]:
w = gdk.window_foreign_new(id)
names.append(w.property_get('WM_NAME')[2])
if w and names[-1].startswith(name):
if w.get_decorations() != 0 :
w.set_decorations(0)
else:
w.set_decorations(gdk.DECOR_ALL)
gdk.window_process_all_updates()
names = None
break
if names:
raise SystemExit("No window named '%s' found, names seen:\n %s" % (name, '\n '.join(names)))
if __name__ == '__main__':
if len(sys.argv) != 2:
raise SystemExit("Pass only the window name as a single argument")
remove_decorations(sys.argv[1])
@muzzol
Copy link

muzzol commented Jan 28, 2020

first time must be executed twice, is this intended?

@ludoo
Copy link
Author

ludoo commented Jan 29, 2020

I did not even remembered this existed, is it still working?

@muzzol
Copy link

muzzol commented Jan 29, 2020

yeah, I did a search about set_decorations and your result is the most polished.
:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment