You are not logged in.
Hello everyone
I am having a bit of difficulty with pipe-menus which I cannot figure out the source of.
At the moment, I have a simple but slightly long menu structure for providing a set of applications to my users. In the future, parts of it are likely to become dynamic. Therefore, my immediate reaction was to create an XML template and have a Python script render it to stdout using jinja2.
So far so good. Now, the freaky part. If I render the template using
sys.stdout.write(myRenderedXMLContent)
, openbox complains that the script did not return a valid output. If i
print("<openbox_pipe_menu>")
(and so on), then the menu is rendered properly.
For more information, including an extensive list of things I have tried so far, please see this link
All the best
AA
Offline
Probably a problem with characters that need to be escaped:
See /usr/lib/bunsen/common/bl-include.cfg for how it is done in BL.
Offline
Thank you for the quick response. I have even added a bash script with
cat theTemplate.xml
and even
echo `cat theTemplate.xml`
and even that fails I have diffed the files produced by each version and they differ only in one extra linefeed. Is there anything else that could be going out through stdout when openbox runs the process?
Offline
Is there any difference in the way each method looks if the pipemenu is run on the commandline?
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Can you run your script on the command line, and post the output here or give us a link to a pasteboard?
Here is a snippet of the output of an BL pipemenu (bl-kb-pipemenu):
</action>
</item>
<item label="W-m bl-media-player">
<action name="Execute">
<command>
bl-media-player
</command>
</action>
</item>
<item label="W-h x-terminal-emulator -T 'htop task manager' -e htop">
<action name="Execute">
<command>
x-terminal-emulator -T 'htop task manager' -e htop
</command>
</action>
</item>
<item label="W-v pavucontrol">
<action name="Execute">
<command>
pavucontrol
</command>
</action>
</item>
<item label="W-x bl-exit">
<action name="Execute">
<command>
bl-exit
</command>
</action>
</item>
</menu>
</openbox_pipe_menu>
Notice that the [data] portions - e.g. thet data between <command> and </command> - needs to have some characters escaped. Like ' has to be '
Offline
Probably a problem with characters that need to be escaped:
See /usr/lib/bunsen/common/bl-include.cfg for how it is done in BL.
That file contains a couple of small bash functions for escaping special xml characters: XMLescape() and OBlabelEscape()
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Many thanks to everyone for your replies and pointers. Yes, I got that, no worries, I don't have "special" characters, just a few dummy strings (Not even "Execute"), which is what makes this whole thing so frustrating
(I am worried about control characters though).
Here are hex dumps of the outputs from the two different ways.
https://s31.postimg.org/yjye50bl7/trouble.png
Here is the "trigger" line from openbox' menu.
https://s31.postimg.org/6x6v5hq0b/menu.png
Just a note, the latest latest thing that I did, was to remove a nested menu that I had in there. So, there was the top level menu, submenu and then you came across this "blah" label. Doesn't work though, so the problem was not the extra menu level.
Any ideas?
Mod Note: Oversized images replaced with links, please limit images to ~250x250px.
-HoaS
Last edited by Head_on_a_Stick (2016-08-02 08:05:21)
Offline
Hah, simple..., but it had me puzzlzd too
In your script replace "./resourcesMenu.xml" by the absolute pathname to your xml file.
Offline
Hah, simple..., but it had me puzzlzd too
In your script replace "./resourcesMenu.xml" by the absolute pathname to your xml file.
LOL!...Thanks xaos52, I am framing a printout of this thread for the office.
Many thanks to everyone, madoromi thanks for the pointer to the xrandr script, might come handy later on.
Offline