emacs-exwm / exwm

Emacs X Window Manager
https://elpa.gnu.org/packages/exwm.html
GNU General Public License v3.0
189 stars 7 forks source link

Apply shader selectively using picom #33

Open theottm opened 3 months ago

theottm commented 3 months ago

Hi,

picom allows one to apply a shader to a specific window using a matching pattern, including name, window type, window state, etc. I am having a hard time finding how to match things properly in EXWM and I probably need a lower level understanding of how EXWM works. Maybe you can help me ?

It seems like what appears as a window is made of different layers. First the proper X window, then appearing under it, an emacs frame. It looks like the X window is associated to a buffer of that frame. Now I more or less see how I can manipulate these things in emacs, though I am not sure how I can access them from picom.

How can I match the emacs frame that is behind a window ? How can I match all the X windows without matching the underneath emacs frame ? Is there some attribute that distinguishes them, like _NET_WM_WINDOW_TYPE, or is one the child of the other, or any other way I could distinguish them ?

For example if I do picom --backend glx --window-shader-fg-rule invisible.glsl:'_NET_WM_WINDOW_TYPE@:a *= "NORMAL"' I can match all the X windows and the emacs frames, which seems to boil down to everything apart from polybar in my setting.

Cheers,

Théo

theottm commented 2 months ago

I found a way thanks to xprop.

It seems that the X windows consistently have this property _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE while emacs frames have _EMACS_SERVER_TIME_PROP(ATOM) = _EMACS_SERVER_TIME_PROP. Assuming this is enough to characterize them, we can use these props to match.

So to match all emacs frames: '_EMACS_SERVER_TIME_PROP@:a %= "*EMACS*"' and to match all X windows: '_NET_WM_ALLOWED_ACTIONS@[*]:a = "_NET_WM_ACTION_MINIMIZE"'.

Stebalien commented 2 months ago

You should match Emacs on the WM_CLASS ("emacs", "Emacs"), but the shader will apply to the entire frame, not individual windows.

Other windows are basically just windows without that WM_CLASS, although you likely want to restrict your matches to WM_STATE "normal".

theottm commented 2 months ago

That would work but I also run other emacs processes, so they will also get matched. I just want the emacs running exwm to get matched.

On Thu, Apr 4, 2024, 15:23 Steven Allen @.***> wrote:

You should match Emacs on the WM_CLASS ("emacs", "Emacs"), but the shader will apply to the entire frame, not individual windows.

Other windows are basically just windows without that WM_CLASS, although you likely want to restrict your matches to WM_STATE "normal".

— Reply to this email directly, view it on GitHub https://github.com/emacs-exwm/exwm/issues/33#issuecomment-2037215636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKQJUJTOJ6RJKJFKWSBAQTY3VH6ZAVCNFSM6AAAAABFW5NLP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZXGIYTKNRTGY . You are receiving this because you authored the thread.Message ID: @.***>

Stebalien commented 2 months ago

You can probably give your EXWM windows a custom frame title.