Created
October 28, 2014 08:18
-
-
Save ludoo/46d21a3161aad7c6588e to your computer and use it in GitHub Desktop.
Remove GTK window decorations for a named window
This file contains hidden or 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/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]) |
I did not even remembered this existed, is it still working?
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
first time must be executed twice, is this intended?