fuhsjr00 / bug.n

Tiling Window Manager for Windows
GNU General Public License v3.0
3.35k stars 212 forks source link

Unable to specify empty title for `Config_rule` #190

Closed djwf closed 5 years ago

djwf commented 5 years ago

I'm using WSL with X-Win32 as the x-windows server. When using Terminator, the "spacing" is sometimes off if I don't tell bug.n to maximize the X-Win32 Terminator window. To fix that problem, I generated the following rule.

Config_rule=X-Win32 Display 0 Window.*;^[a-zA-Z0-9]+@[^:]+:.*;;1;1;0;0;1;0;maximize

However, with that rule all context menus are treated like windows, and tiled by bug.n. My goal is to make sure that the context menus are not captured as windows by bug.n in any application that I run using X-Win32. In the extracts, below, I'm using Terminator under the Ubuntu 18.04 WSL distribution. It seems that context menus do not have titles, so the ideal solution would be to be able to specify that the title is empty, but my two attempts at rules with "empty" titles didn't work.

First I tried leaving the title blank:

Config_rule=X-Win32 Display 0 Window.*;;;0;0;0;0;0;0;

Next I tried specifying an empty "line" using a regexp:

Config_rule=X-Win32 Display 0 Window.*;^$;;0;0;0;0;0;0;

Neither worked, and I'm not sure what else to try, so, the questions:

  1. Is there a way to specify the empty title as a requirement?
  2. If not, how hard would it be to add that capability?
  3. If not that hard, where would I start looking to see if I could do that myself (and contribute a patch)?

I include the window information for X-Win32 Terminator window and context menu below.

The window information for the X-Win32 Terminator window is as follows.

ID: 0x904e8 class: X-Win32 Display 0 Window 0x00200003 title: dave@pooh:/home/dave [pts/0] process: xwin32.exe [15180] style: 0x17CF0000 metrics: x: -8, y: 15, width: 1935, height: 1022 tags: 4

Config_rule=X-Win32 Display 0 Window 0x00200003;dave@pooh:/home/dave [pts/0];;1;1;4;0;1;0;maximize

The window information for the X-Win32 Terminator window context menu is as follows.

ID: 0xc08f0 class: X-Win32 Display 0 Window 0x00800074 title:
process: xwin32.exe [15180] style: 0x97080000 metrics: x: 0, y: 15, width: 960, height: 1015 tags: 4

Config_rule=X-Win32 Display 0 Window 0x00800074;;;1;1;4;0;1;0;maximize

djwf commented 5 years ago

I found a work-around, for now: if I do not handle X-Win32 windows specifically (so I leave the Config_rule statements above out of my config file), but increase the layoutGapWidth on each view to 6, then the Terminator window is handled correctly. So, for the first three views, my configuration file has the following:

View_#1_#1_layoutGapWidth=6
View_#1_#2_layoutGapWidth=6
View_#1_#3_layoutGapWidth=6
joten commented 5 years ago

I had a look at the source (src/Manager.ahk -> Manager_applyRules); you may try one of the following (with the lines in the given order):

With the "empty line" you were nearly there, I think. But the regular expressions for class and title are combined; therefor the quirky syntax.

Config_rule=X-Win32 Display 0 Window.*;^[a-zA-Z0-9]+@[^:]+:.*;;1;1;0;0;1;0;maximize
Config_rule=X-Win32 Display 0 Window.*;$;;0;0;0;0;0;0;

The context menus seem to have the "WS_POPUP" style. Higher/ later rules take precedence.

Config_rule=X-Win32 Display 0 Window.*;^[a-zA-Z0-9]+@[^:]+:.*;;1;1;0;0;1;0;maximize
Config_rule=X-Win32 Display 0 Window.*;.*;Window_isPopup;0;0;0;1;0;1;
djwf commented 5 years ago

Thanks! That does answer my question, and enable me to modify the window of the Terminator instance without affecting the other terminator popups.

My original fix (maximizing the window) is also no longer working to fix the spacing, but I have my workaround. I'll get more information an file a separate issue, as the issue I filed about is answered.

Thanks again!