Borderless windows on Linux
Asked Answered
C

3

7

Is their a standard way to make a particular window borderless on Linux? I believe that the window border is drawn by your window manager, so it may be that I just need to use a particular window manager (that would be find, I'd just need to know which one)... My hope is that all the window managers might follow some standard that allows me to do this programatically...

Conduplicate answered 15/12, 2009 at 0:15 Comment(0)
Q
26

Using Xlib and old _MOTIF_WM_HINTS:

struct MwmHints {
    unsigned long flags;
    unsigned long functions;
    unsigned long decorations;
    long input_mode;
    unsigned long status;
};
enum {
    MWM_HINTS_FUNCTIONS = (1L << 0),
    MWM_HINTS_DECORATIONS =  (1L << 1),

    MWM_FUNC_ALL = (1L << 0),
    MWM_FUNC_RESIZE = (1L << 1),
    MWM_FUNC_MOVE = (1L << 2),
    MWM_FUNC_MINIMIZE = (1L << 3),
    MWM_FUNC_MAXIMIZE = (1L << 4),
    MWM_FUNC_CLOSE = (1L << 5)
};

Atom mwmHintsProperty = XInternAtom(display, "_MOTIF_WM_HINTS", 0);
struct MwmHints hints;
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = 0;
XChangeProperty(display, window, mwmHintsProperty, mwmHintsProperty, 32,
        PropModeReplace, (unsigned char *)&hints, 5);

These days NetWM/EWMH hints are preferred, but as far as I know all modern window managers still support this.

Quadruplex answered 15/12, 2009 at 19:17 Comment(3)
Awesome... :) Exactly what I was looking for, and better than what I went with because it's more portable... :) I'll be using this instead later today...Conduplicate
I'm working on an app that needs a borderless window that can still be resized with the Alt-dragging shortcuts. Looking at this almost 11 years later, none of the EWMH window types (_NET_WM_WINDOW_TYPE_SPLASH, *_DOCK, etc.) seem to have the same effect without also changing window focus and resize behavior, and even Google Chrome uses the Motif hints to remove its borders. So it seems like the Motif hints are still the way to go in 2020.Radtke
I'll also point out that XChangeProperty specifies that when format is 32, the value is an array of long, not int32_t. This cost me a few hours of debugging on a 64-bit system.Radtke
W
1

With GTK+ you can call gtk_window_set_decorated().

Wing answered 15/12, 2009 at 0:24 Comment(1)
I couldn't use this, because I needed to talk right to the Window manager, but I accept it as the answer because for most people, this is probably the solution they are looking for.Conduplicate
A
1

After a sad farewell to Compiz "window rules" I found devilspie

A totally crack-ridden program for freaks and weirdos who want precise control over what windows do when they appear. If you want all XChat windows to be on desktop 3, in the lower-left, at 40% transparency, you can do it.

I use it to have a borderless, sticky, task-skipped terminal on my desktop.

There's also a devilspie 2 which uses Lua instead of s-expressions and claims to be better maintained.

https://live.gnome.org/DevilsPie http://www.burtonini.com/blog/computers/devilspie

Autotomy answered 12/6, 2013 at 0:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.