Re: [dev] [dwm] Obtain focused monitor

From: Gauthier Östervall <gauthier_AT_ostervall.se>
Date: Thu, 12 Jan 2023 11:35:28 +0100

On Sun, 8 Jan 2023 at 11:21, A Farzat <a_AT_farzat.xyz> wrote:
>
> Is there a way to obtain the currently focused monitor in dwm? I want to
> use it in my script to control which monitor gets its brightness
> modified.

Do you mean obtain from outside the dwm process? Not directly, that I
am aware of. But you could try and query X for that. This SO answer
might be of interest: https://unix.stackexchange.com/a/677884

selmon is not a command, it's a global variable. It's not accessible
outside the dwm process, if you don't make it accessible by modifying
dwm. It also points to a dwm monitor struct, it holds data for the
internals of dwm. You could probably use it to find out what you need,
but I'm not sure it would be the simplest way.

What's not clear is what format you need for your script. What does
the script need, in order to work? If you only need stuff from X,
asking X directly is probably simpler, there's already an API. It also
would make your tool more agnostic, it would probably work with other
WM using X.
Received on Thu Jan 12 2023 - 11:35:28 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 13 2023 - 02:48:07 CET