baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.73k stars 414 forks source link

GNU Emacs (GTK GUI) starts off as floating #551

Open d125q opened 7 years ago

d125q commented 7 years ago

Why is it that the launching the GTK version of GNU Emacs (25.1.1) gives me a floating window? xprop says _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL, which should make it tiling by default, no?

I know I can bypass this by adding a rule, but I found it weird.

baskerville commented 7 years ago

What's the full xprop output?

d125q commented 7 years ago
_MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
_NET_WM_DESKTOP(CARDINAL) = 2
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        Initial state is Normal State.
        bitmap id # to use for icon: 0x1200139
        bitmap id # of mask for icon: 0x120013f
        window id # of group leader: 0x1200001
_GTK_THEME_VARIANT(UTF8_STRING) = 
_NET_WM_ICON(CARDINAL) =    Icon (48 x 48):

                       ░░░▒▒▒░░░                    
                    ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒░                
                  ░▒▒▒▒░░░░░░░░░▒▒▒▒▒░              
                ░▒▒▒░░░░░░░░░░░░░░░▒▒▒▒░            
               ▒▒▒░░░░░░░░░░░░░░░░░░░▒▒▒▒           
             ░▒▒░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒░         
            ░▒▒░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒░        
           ░▒▒░░░░░░░░░░░░░░░       ░▒▒▒▒▒▒▓░       
          ░▒▒░░░░░░░░░░░░░           ░▒▒▒▒▒▒▒       
          ▒▒░░░░░░░░░░░░░░░░░░░░░    ░▒▒▒▒▒▒▒▒      
         ▒▒░░░░░░░░░░░░░░░░░░░░░      ▒▒▒▒▒▒▒▒▒     
        ░▒░░░░░░░░░░░░░░░            ░▒▒▒▒▒▒▒▒▓░    
        ▒▒░░░░░░░░░                  ░▒▒▒▒▒▒▒▒▒▒    
       ░▒░░░░░░░░░                 ░▒▒▒▒▒▒▒▒▒▒▒▓░   
       ▒▒░░░░░░░░         ░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   
      ░▒░░░░░░░░░░      ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓   
      ▒▒░░░░░░░░░░░     ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░  
      ▒▒░░░░░░░░░░░░     ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  
      ▒▒░░░░░░░░░░░░░      ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  
     ░▒░░░░░░░░░░░▒▒▒▒░      ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓  
     ░▒░░░░░░░░░░▒▒▒▒▒▒▒░      ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░ 
     ░▒░░░░░░░░░▒▒▒▒▒▒▒░░░░      ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░ 
     ▒▒░░░░░░░▒▒▒▒▒░░             ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░ 
     ▒▒░░░░░░▒▒▒▒░             ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░ 
     ░▒░░░░░▒▒▒░           ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░ 
     ░▒░░░▒▒▒▒░          ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░ 
     ░▒░░▒▒▒▒░         ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓  
      ▓▒▒▒▒▒▒░        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓  
      ▒▒▒▒▒▒▒░       ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  
      ▒▒▒▒▒▒▒░       ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░  
      ░▒▒▒▒▒▒▒        ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓   
       ▒▒▒▒▒▒▒▒░         ░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   
       ░▒▒▒▒▒▒▒▒░                     ░░▒▒▒▒▒▒▒▓░   
        ▒▒▒▒▒▒▒▒▒▒░░                    ░▒▒▒▒▒▒▒    
        ░▒▒▒▒▒▒▒▒▒▒▒▒▒░░                ▒▒▒▒▒▒▓░    
         ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░     ░▒▒▒▒▒▒▓▒     
         ░▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░      ░░▒▒▒▒▒▒▒▒▓      
          ░▓▒▒▒▒▒▒▒▒▒▒▒░░      ░░▒▒▒▒▒▒▒▒▒▒▒▓░      
           ░▓▒▒▒▒▒▒▒▒░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░       
            ▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░        
             ░▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓░         
              ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒           
                ▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓░            
                 ░▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒              
                    ░▒▓▓▒▒▒▒▒▒▒▓▓▓▒░                
                       ░░▒▒▒▒▒▒░░                   

XdndAware(ATOM) = BITMAP
_NET_WM_OPAQUE_REGION(CARDINAL) = 7, 0, 578, 7, 0, 7, 592, 491
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 18874657, 18874658
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x1200120
WM_CLIENT_LEADER(WINDOW): window id # 0x1200001
_NET_WM_PID(CARDINAL) = 13108
WM_LOCALE_NAME(STRING) = "en_US.utf8"
WM_CLIENT_MACHINE(STRING) = "d125q-PC"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified minimum size: 39 by 78
        program specified resize increment: 7 by 12
        program specified base size: 39 by 78
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "emacs", "Emacs"
WM_ICON_NAME(STRING) = "emacs@d125q-PC"
_NET_WM_ICON_NAME(UTF8_STRING) = "emacs@d125q-PC"
WM_NAME(STRING) = "emacs@d125q-PC"
_NET_WM_NAME(UTF8_STRING) = "emacs@d125q-PC"
neeasade commented 7 years ago

I am seeing this intermittently. If I open a terminal, and launch then quit emacs several times, sometimes it will launch floating, sometimes it will launch tiling. I diffed xprop's in both instances, and the only difference was the _NET_WM_OPAQUE_REGION and _NET_WM_PID.

baskerville commented 7 years ago

@d125q This is expected (cf. https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#NORESIZE).

d125q commented 7 years ago

A problem I see is that both the Emacs windows which are tiled and those which are floated have minheight = maxheight and minwidth = maxwidth. I don't see how that can be intended, as it's completely inconsistent.

mrlinuxfish commented 7 years ago

I added the line bspc rule -a emacs state=tiled to my bspwmrc and noticed when closing emacs with an sxhkd hotkey subsequent sessions will load floating. Whereas using M-x M-c to close emacs causes the next session to be loaded tiled. I'm not sure if this is particularly helpful in resolving this issue, but I did find it interesting and it may point to the solution.

Custodia commented 7 years ago

My emacs is always starting in floating mode, even after I added bspc rule -a emacs state=tiled. I have to set it to tiled with a hotkey after it has opened.

Custodia commented 7 years ago

Actually it had to be bspc rule -a Emacs state=tiled, now it always starts as tiled. @mrlinuxfish I wonder if it's the same for you.

mrlinuxfish commented 7 years ago

I did change that line in my bspwmrc to Emacs state=tiled and it fixed the problem for me too. It's strange that emacs wants to start in a floating state. Also, as an anecdote which may be relevant, I had to set a similar rule for zathura (a PDF viewer).

drobilla commented 6 years ago

This only started happening to me after upgrading from 0.9 to 0.9.2

quadrupleslap commented 6 years ago

With GTK, this seems to only happen when I don't call gtk_widget_set_size_request, or if I call it with the values -1, -1, which is the same as leaving it unset. I haven't actually read any of the code, but maybe this section is the relevant one.

cyruseuros commented 4 years ago

In the latest release, the fix no longer works. It just freezes bspwm. You need to add (setq frame-resize-pixelwise t) somewhere in your config to prevent this.

aleksfadini commented 4 years ago

I am having the same problem, and bspwm freezes. It is so bad that I am thinking of reverting to i3. Where would you add

(setq frame-resize-pixelwise t)

somewhere in a new line in bspwmrc?

cyruseuros commented 4 years ago

No, no. In your .emacs. This is an Emacs issue, not a bspwm issue. Emacs does not obey size hints because it wants to preserve a whole number of characters height and width wise. The reason other wms work is that they eventually give up. Bspwm is just being insistent on giving you what you asked for.

Nan0Scho1ar commented 3 years ago

I can confirm that adding

(setq frame-resize-pixelwise t)

to my emacs config fixed the issue for me.