4

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
gtk.gdk.window_process_all_updates()
gtk.gdk.flush()

How can I toggle window decoration from terminal without python?

kenn
  • 5,074
  • 12
  • 55
  • 94

1 Answers1

5

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. :)

DK Bose
  • 41,240
  • 22
  • 121
  • 214
muktupavels
  • 1,366
  • 1
  • 11
  • 23
  • 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 04 '17 at 12:13
  • You can not change property type! This might be fixed in compiz, see [merge proposal](https://code.launchpad.net/~muktupavels/compiz/motif-wm-hints/+merge/326777). – muktupavels Jul 04 '17 at 12:23
  • And [here](https://bugs.launchpad.net/compiz/+bug/1702297) is bug report. :) Subscribe to get notified when this gets fixed. – muktupavels Jul 04 '17 at 13:01
  • Do you know any way to undecorate a window with other tools such as `wmctrl` – kenn Jul 04 '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 04 '17 at 16:29
  • It would be satisfactory for me if there was a `c` program which accepts `process id` or `window id` to toggle the decoration – kenn Jul 04 '17 at 16:47
  • [Here](https://gist.github.com/muktupavels/d03bb14ea6042b779df89b4c87df975d) is small program that will do that, you need to compile it first. – muktupavels Jul 04 '17 at 20:00
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/61602/discussion-between-kenn-and-muktupavels). – kenn Jul 05 '17 at 14:02