robm / dzen

Dzen is a general purpose messaging, notification and menuing program for X11.
MIT License
607 stars 81 forks source link

Strange behavior of dzen2 menu stdout #49

Open Mesibov opened 5 years ago

Mesibov commented 5 years ago

This command generates a 3-item horizontal menu, with "menuprint" sending the left-click choice to stdout:

echo -e "xterm\nxeyes\nxfontsel" | dzen2 -x 450 -y 450 -w 250 -l 3 -m h -sa c -p -e "button1=menuprint;button3=exit:13"

If I left-click on each item in turn, I get

xterm xeyes xfontsel

In the following command, stdout is piped to sed:

echo -e "xterm\nxeyes\nxfontsel" | dzen2 -x 450 -y 450 -w 250 -l 3 -m h -sa c -p -e "button1=menuprint;button3=exit:13" | sed 's/xeyes/aaaaa/'

Clicking on each item in turn gives

xterm aaaaa xfontsel

But not all downstream processes accept stdout the way sed does in the example. Neither

echo -e "xterm\nxeyes\nxfontsel" | dzen2 -x 450 -y 450 -w 250 -l 3 -m h -sa c -p -e "button1=menuprint;button3=exit:13" | xclip

nor

echo -e "xterm\nxeyes\nxfontsel" | dzen2 -x 450 -y 450 -w 250 -l 3 -m h -sa c -p -e "button1=menuprint;button3=exit:13" | xsel

sends the menu choice to the X clipboard.

Any suggestions about what's going on here? Many thanks in advance.

Mesibov commented 5 years ago

I think what's happening is that dzen2 is "claiming" the X buffer while it's running, and blocking use by xclip and xsel!