Xprop setting multiple atom property fields

I searched the Internet and found examples with setting only one property field:

xprop -id "$windowid" -f _NET_WM_STATE 32a -set _NET_WM_STATE _NET_WM_STATE_ABOVE 

but how to set multiple fields? I tried:

 xprop -id "$windowid" -f _NET_WM_STATE 32a -set _NET_WM_STATE '_NET_WM_STATE_ABOVE, _NET_WM_STATE_SKIP_TASKBAR' 

and

 xprop -id "$windowid" -f _NET_WM_STATE 32aa -set _NET_WM_STATE _NET_WM_STATE_ABOVE,_NET_WM_STATE_SKIP_TASKBAR 

and many other options without luck. Is it possible?:)


Ok ....

I wrote a patch for xprop to fix this, and it works, but I don’t know if this is correct. Thanks @ MichałGórny.
(xprop.c, v 1.6)

 --- xprop.c 2012-07-31 11:24:01.178117974 +0400 +++ xprop.mod 2012-07-31 11:23:19.434784430 +0400 @@ -1487,11 +1487,20 @@ break; } case 'a': { - static Atom avalue; - avalue = Parse_Atom(value, False); - type = XA_ATOM; - data = (unsigned char *) &avalue; - nelements = 1; + static unsigned long data32[MAXELEMENTS]; + char * value2 = strdup(value); + char * tmp = strtok(value2,","); + nelements = 0; + while( NULL != tmp ){ + data32[nelements] = Parse_Atom(tmp, False); + nelements +=1; + if(nelements >= MAXELEMENTS) + break; + tmp = strtok(NULL,","); + } + type = XA_ATOM; + data = (unsigned char *) data32; + free(value2); break; } case 'm': 
+6
source share
1 answer

Looking at the xprop code is not possible.

 case 'a': { static Atom avalue; avalue = Parse_Atom(value, False); type = XA_ATOM; data = (unsigned char *) &avalue; nelements = 1; break; } 

This is code analyzing the value of -set .

 static Atom Parse_Atom (const char *name, int only_if_exists) { /* may return None = 0 */ return XInternAtom(dpy, name, only_if_exists); } 

Thus, he analyzes only one atom.


I also discovered an error ; maybe they will add it.

+10
source

Source: https://habr.com/ru/post/921562/


All Articles