bspwm icon indicating copy to clipboard operation
bspwm copied to clipboard

GNU Emacs (GTK GUI) starts off as floating

Open d125q opened this issue 8 years ago • 15 comments

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.

d125q avatar Oct 16 '16 15:10 d125q

What's the full xprop output?

baskerville avatar Oct 17 '16 08:10 baskerville

_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"

d125q avatar Oct 17 '16 12:10 d125q

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.

neeasade avatar Oct 17 '16 13:10 neeasade

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

baskerville avatar Oct 17 '16 14:10 baskerville

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.

d125q avatar Feb 07 '17 10:02 d125q

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.

violet-fish avatar Feb 23 '17 09:02 violet-fish

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 avatar Mar 12 '17 09:03 Custodia

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.

Custodia avatar Mar 12 '17 09:03 Custodia

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

violet-fish avatar Mar 12 '17 15:03 violet-fish

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

drobilla avatar Dec 10 '17 11:12 drobilla

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.

quadrupleslap avatar Feb 03 '18 23:02 quadrupleslap

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.

cyruseuros avatar Jan 16 '20 04:01 cyruseuros

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?

aleksfadini avatar Feb 06 '20 21:02 aleksfadini

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.

cyruseuros avatar Feb 07 '20 02:02 cyruseuros

I can confirm that adding

(setq frame-resize-pixelwise t)

to my emacs config fixed the issue for me.

Nan0Scho1ar avatar Jul 04 '21 07:07 Nan0Scho1ar