12

I have developed a program with glut library and want to remove its title bar.

Since its impossible to remove the title bar from glut library I have to use an external tool to remove its title bar.

Regarding the fact that it is possible to manipulate other windows decoration in Windows operating system I hope to find a similar remedy for this obstacle.

Do you have any Idea about how to remove specific window title bar with a script or a simple X11 application ?

2
  • Window managers can also manipulate the window decorations in certain degree. With IceWM you can put a line in ~/.icewm/winoptions yourWindow.dTitleBar: 0.
    – manatwork
    Dec 2, 2013 at 12:40
  • 1
    A window's title bar is drawn and managed by the window manager, not by applications. Window managers decide things like whether to display a title bar based on ICCCM hints or their modern derivatives. I don't think you can control this in a way that's independent of both the application and the window manager. Dec 2, 2013 at 23:32

4 Answers 4

12

Wmctrl

This is kind of related but you could change the text in the title bar of this mystery application using the command wmctrl.

Example

Say I ran the application gvim. It shows up as follows when I list the open windows.

$  wmctrl -l
0x04402eed -1 grinchy N/A
0x00c00003 -1 grinchy Bottom Expanded Edge Panel
0x00c00028 -1 grinchy Top Expanded Edge Panel
0x0120001e  0 grinchy x-nautilus-desktop
0x02a00004  0 grinchy saml@grinchy:~
0x06800003  0 grinchy [No Name] - GVIM

So the gvim window has the title "[No Name] - GVIM", we can change its name like so, again using wmctrl:

$ wmctrl -r "[No Name] - GVIM" -N "new name"

Running the -l switch again we can see the new name:

$ wmctrl -l
0x04402eed -1 grinchy N/A
0x00c00003 -1 grinchy Bottom Expanded Edge Panel
0x00c00028 -1 grinchy Top Expanded Edge Panel
0x0120001e  0 grinchy x-nautilus-desktop
0x02a00004  0 grinchy saml@grinchy:~
0x06800003  0 grinchy new name

All decorations

There is this method discussed in this AskUbuntu Q&A titled: Can I hide the title bar of MPlayer in gnome?.

There was this gist of Python - window-toggle-decorations.py that looked to do kind of what you wanted. It might be modifiable to suit your needs.

window-toggle-decorations.py

#! /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()

# now bind this to super-r or something 
3
  • Wow ! it worked ! It should be run in this way : python2 ./toggle.py. I haven't seen something like that and at least now I have a clue to the answer. Thank you Smart Looking Man(slm). Dec 3, 2013 at 5:27
  • I tested it with a system("python2 ./toggle.py") call and it worked too, however I'm sure its code is convertible to C++. Dec 3, 2013 at 6:09
  • Strange thing is that I have to call it two times to effect!!! system("python2 ./toggle.py"); system("python2 ./toggle.py"); it is ridiculous ! but it works for me and it is enough :D Dec 3, 2013 at 6:14
10

There is a simple C program that works, originally developed by Muktupavels.

I use it and it works very well. It's here

https://gist.github.com/cat-in-136/96ee8e96e81e0cc763d085ed697fe193

It lets you toggle the title bar on and off for any given application.

To use it, simply make sure you have the libx11-dev library installed

sudo apt-get install -y libx11-dev

then compile the code using this command

gcc toggle-decorations.c -Wall -o toggle-decorations `pkg-config --cflags --libs x11`

and run it with this command

./toggle-decorations $(wmctrl -lx | grep -E "name_of_your_application_here" | grep -oE "[0-9a-z]{10}")

where $(...) captures the --id of your application using wmctrl.

I did not do this great work and take no credit for it.

It was done by muktupavels.

2
  • 1
    the only thing that worked on Unity/compiz thx! Jan 11, 2019 at 18:46
  • 2
    This is the only thing I got to work on xfce/xubuntu for vlc
    – poleguy
    Jan 29, 2021 at 15:47
2

For those who don't want to compile anything and only use stock programs :

xprop -name 'My window name' -format _MOTIF_WM_HINTS 32c -set _MOTIF_WM_HINTS 2

Replace My window name with the name of your window, or you can omit the -name option, and the program will ask you to click on the window where you want the decorations removed.

In fact I didn't know how to do that, until I had a look at Muktupavels' C program ;)

EDIT : This isn’t guaranteed to work. It will work with all window managers accepting Motif-style hints, such as GNOME 3 (and probably 2 though I didn’t check), and mwm of course (anyone still using that ?), but for example, as a comment below pointed out, it doesn’t work with XFCE. Unfortunately, I don’t think there’s a method that works with all window managers.

I changed the property type in the command line from 32i to 32c (32-bit cardinal, i.e. positive integer), which is the correct type for that property.

3
  • This is it! works nicely on any X11 window, even when running under XWayland Feb 23, 2022 at 10:45
  • Doesn't work on Debian 11 XFCE Aug 7, 2022 at 15:05
  • @scrat.squirrel Good to know, thanks for the info. This obviously depends on the window manager, which has to be aware of Motif-style hints. It could be interesting to know if there’s an equivalent for XFCE, maybe another property name…
    – NovHak
    Aug 20, 2022 at 22:35
0

Way easier if you can use devilspie2 from your distro.

Example: I want the "Album Art" window from Audacious to not display the window title.

STEP 1. Install devilspie2, here is an example for Debian (if your distro is not based on Debian, use the required command for your distro):

# apt-get install devilspie2

STEP 2. Right after installing devilspie2, execute in terminal (it will create the ~/.config/devilspie2 folder):

$ devilspie2

STEP 3. Create a Lua code debug file, so you can find out your app and window names by creating a file called debug.lua under same ~/.config/devilspie2 folder, with his contents:

debug_print("Application: " .. get_application_name());
debug_print("Window: " .. get_window_name());

Run devilspie2 in debug mode with:

$ devilspie2 --debug

Now every time you start or activate an app, it will list, in the terminal, its app name and window name. You will need this for the next step. With that information, you can stop the devilspie2 process with CTRL+C.

STEP 4. Then, create a Lua code file, for example, in my case named:

$ touch $HOME/.config/devilspie2/audacious.lua

For me, the code which allows the respective window to have the window title decoration hidden is:

--[[
    Hide window title for audacious > Album Art window
]]

function isMatch(appName, windowName)
  if (string.match(get_application_name(), appName) and string.match(get_window_name(), windowName)) then
    return true;
  end
  return false;
end

if (isMatch("Audacious", "Album Art")) then
  undecorate_window();
end

Customize the application and/or window name in the code above.

Save the file.

To test: Close your app (in my case, audacious). Run devilspie2 in terminal. Open your app, see if everything works as expected.

If everything works fine, you can set up devilspie2 to auto-start when you login. In XFCE, that is done in "Session and Startup" settings, by adding a simple entry to call the executable devilspie2. Check the documentation for your DE / distro which is responsible for auto-starting apps on login.

Logout, and log back in. Start the app (audacious in my case) and check it out. The window decoration is gone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .