ch11ng / exwm

Emacs X Window Manager
2.85k stars 134 forks source link

Add support for _NET_WM_WINDOW_OPACITY #594

Closed pestctrl closed 5 years ago

pestctrl commented 5 years ago

Hi! I have recently come across a command line utility called transSet to set the opacity of a specific window, but I wanted to do that through xelb. transSet sets the value _NET_WM_WINDOW_OPACITY, and then compton will change the opacity appropriately. I found the xcb:ChangeProperty class, but I wasn't able to find an atom for _NET_WM_WINDOW_OPACITY. Could that be added to the list of supported atoms?

Thanks for this amazing project!

pestctrl commented 5 years ago

Huh. So, I added _NET_WM_WINDOW_OPACITY to xcb:ewmh:-atoms, and called xcb:ewmh:init, and the atom initialized just fine. I guess my only other question is, is there a function to convert an unsigned integer into an unsigned char array? When I make a request, my code looks like this:

(xcb:+request exwm--connection
      (make-instance
       xcb:ChangeProperty
       :mode xcb:PropMode:Replace :window window-id
       :property xcb:Atom:_NET_WM_WINDOW_OPACITY :type xcb:Atom:CARDINAL
       :format 32 :data-len 1 :data '(255 255 255 255)))

Is there a function to convert the integer value of 4294967295 to the corresponding character array representation '(255 255 255 255) for the :data field?

ch11ng commented 5 years ago

We actually had such function which was removed later. See https://github.com/ch11ng/exwm/blob/83c0a2db3448091e44cded075104a0b7df636431/exwm-cm.el#L149-L168 .

pestctrl commented 5 years ago

Alright, I'll look through the old code. Thanks!