I am running Ubuntu 16.04. I want to undecorate (remove borders and title bar) of a window. I found an old posted scripts on the net claimed to be working but it doesn't work now.

To undecorate:

xprop -f _MOTIF_WM_HINTS 32c -set _MOTIF_WM_HINTS "0x2, 0x0, 0x0, 0x0, 0x0"

To redecorate:

xprop -f _MOTIF_WM_HINTS 32c -set _MOTIF_WM_HINTS "0x2, 0x0, 0x1, 0x0, 0x0"

Though this python script works

#! /usr/bin/python2
import gtk.gdk
w = gtk.gdk.window_foreign_new( gtk.gdk.get_default_root_window().property_get("_NET_ACTIVE_WINDOW")[2][0] )
w.set_decorations( (w.get_decorations()+1)%2 ) # toggle between 0 and 1

How can I toggle window decoration from terminal without python?


This will not work in compiz! Compiz expects that _MOTIF_WM_HINTS property type is _MOTIF_WM_HINTS, but xprop command sets it to CARDINAL. If you use xprop | grep _MOTIF_WM_HINTS you will see this:

_MOTIF_WM_HINTS(CARDINAL) = 2, 0, 0, 0, 0

It should be like this:

_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 2, 0, 0, 0, 0

Your python script works, because GTK+ properly sets this property. :)

  • Thank you for the answer. Would you post it as a whole liner? I got error with this xprop -f _MOTIF_WM_HINTS 32c -set _MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 2, 0, 0, 0, 0 – kenn Jul 4 '17 at 12:13
  • You can not change property type! This might be fixed in compiz, see merge proposal. – muktupavels Jul 4 '17 at 12:23
  • And here is bug report. :) Subscribe to get notified when this gets fixed. – muktupavels Jul 4 '17 at 13:01
  • Do you know any way to undecorate a window with other tools such as wmctrl – kenn Jul 4 '17 at 16:03
  • No, I don't... But what are you trying to do? Should not be hard to write small command-line app that can toggle decorations. My fix most likely will be available in 16.04. :) – muktupavels Jul 4 '17 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.