Picom: Excluding focus on a specific window (dictionary text-translating pop-up)?

Created on 5 May 2019  路  12Comments  路  Source: yshui/picom

I use stardict with the scanning feature, that when I use mouse to highlight a piece of text somewhere (usually in Chrome), it will pop up a small window of the text translation. However, the text translating window is not focused by default. I've set inactive windows to be dimmed, but the text translating window should be excluded. Here's the xprop result of the text translating window:


WM_STATE(WM_STATE):
                window state: Withdrawn
                icon window: 0x0
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                window id # of group leader: 0x2400001
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 37748998
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_USER_TIME(CARDINAL) = 1139633
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x2400105
WM_CLIENT_LEADER(WINDOW): window id # 0x2400001
_NET_WM_PID(CARDINAL) = 13097
WM_LOCALE_NAME(STRING) = "C.UTF-8"
WM_CLIENT_MACHINE(STRING) = "schierke"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                program specified location: 0, 0
                program specified minimum size: 332 by 214
                window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "stardict", "Stardict"
WM_ICON_NAME(STRING) = "stardict"
_NET_WM_ICON_NAME(UTF8_STRING) = "stardict"
WM_NAME(STRING) = "stardict"
_NET_WM_NAME(UTF8_STRING) = "stardict"

The only prop I can find that make it (the translation window) different from other type of window is the window state: Withdrawn, but I don't know how to write that in the focus-exclude rules.

I can't use class_g = 'startdict' because that rule will include the main window of stardict, that I want it to be treated normally.

question

All 12 comments

I tried to find out what this "withdrawn" is about, and found this here:

WithdrawnState - Neither the client's top-level window nor its icon is visible.

I got that from here: https://tronche.com/gui/x/icccm/sec-4.html

Maybe there was a problem with the way you tried to get the window's properties, and maybe when the program is used normally it won't have this "withdrawn" state? This could mean you shouldn't try to match for it.

EDIT:

I remembered something about how to run xprop on things like tooltips of programs, maybe it'll help with this 'stardict' as well?

I ran the following in a terminal window when I was researching various popup windows of Firefox:

 sleep 5; pkill -STOP firefox

After running this, there's then five seconds of time to get the interesting window to display. The program then freezes and the window will just hang there unusable. You can then run 'xprop' and click on the interesting window.

To let the program run again, you send a "SIGCONT" signal:

pkill -CONT firefox

EDIT2:

I just installed 'stardict' here and then used this SIGSTOP method I described. I get the following xprop output for the stardict popup window. It does not have the "withdrawn" state:

WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        Initial state is Normal State.
        window id # of group leader: 0x4e00001
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 81789130
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x4e000c9
WM_CLIENT_LEADER(WINDOW): window id # 0x4e00001
_NET_WM_PID(CARDINAL) = 19698
WM_LOCALE_NAME(STRING) = "en_IE.UTF-8"
WM_CLIENT_MACHINE(STRING) = "hrhr"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified location: 0, 0
        program specified minimum size: 97 by 54
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "stardict", "Stardict"
WM_ICON_NAME(STRING) = "stardict"
_NET_WM_ICON_NAME(UTF8_STRING) = "stardict"
WM_NAME(STRING) = "stardict"
_NET_WM_NAME(UTF8_STRING) = "stardict"

@Ropid thank for your help
I've already had mark-wmwin-focused set to true, and even if I set it to false, nothing seems to change. Currently I have these lines in my compton.conf:

mark-wmwin-focused = true;
mark-ovredir-focused = false;

Interestingly, I can't even focus on the popup window when I click on it (Chrome remains active and the popup remains dimmed), but I can have it being active when I use keyboard shortcut to focus on the main program stardict window, both the main window and the popup are active.

Also, I tried your method, my xprop result of the popup is still the same.

@buitrung what's the xwininfo result of the translation window? I think we might be able to match it with override_redirect

@yshui here's the xwininfo result of it:

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x2c00180 "stardict"

  Absolute upper-left X:  726
  Absolute upper-left Y:  619
  Relative upper-left X:  726
  Relative upper-left Y:  619
  Width: 351
  Height: 252
  Depth: 24
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: yes
  Map State: IsViewable
  Override Redirect State: yes
  Corners:  +726+619  -843+619  -843-209  +726-209
  -geometry 351x252+726+619

Can you please give me an example of matching rule for this?


BTW, I've just tried to print xprop of it again on my another computer which has the same setup, and there's no more the lines of WM_STATE, perhaps it's really not a thing to be considered here.

~Try focus-exclude = [ "override_redirect" ]~

Thanks, it works like a charm! I'm closing the issue now.

@buitrung Hmm, doing that just breaks inactive dim for me.

@buitrung Please use mark-ovredir-focused = true instead

I'm not sure how it works but mark-ovredir-focused = true also just breaks my inactive dim.

@buitrung What WM do you use?

I'm using bspwm, ubuntu 18.04

OK.

The focus-exclude = [ "override_redirect" ] solution is not perfect, but if it works for you I will close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheConfuZzledDude picture TheConfuZzledDude  路  6Comments

zezic picture zezic  路  12Comments

Anarky picture Anarky  路  6Comments

lanrat picture lanrat  路  14Comments

btstream picture btstream  路  7Comments