I know, but that's rather an advantage. We may not need the extra check for the Shift status:SFR wrote:Yeah, KEY_SYM/KEY_VAL might be indeed a better choice, just note that if SHIFT is pressed, the output values/characters reflect the difference (unlike KEY_RAW)
Code: Select all
<action signal="key-press-event"> [ $KEY_SYM = A ] && xmessage " Shift+A pressed"</action>
<action signal="key-press-event"> [ $KEY_SYM = a ] && xmessage " A pressed"</action>
Thanks for this hint. I seldom load devx_xxx.sfs and I haven't noticed, but I swear I downloaded it from somewhere else.../usr/share/doc/gtkdialog/examples should be in devx_xxx.sfs, but here's the online version:
Reading the reference online is OK, but having the examples only online is a bit cumbersome. I found a slightly old package which might be worth downloading just for the examples it includes. I'm sure there are others: https://www.archlinux.org/packages/comm ... gtkdialog/
EDIT 1
Well, finally it seemed to be clear, but unfortunately it doesn't produce the expected result. $(( $KEY_MOD & 1)) = 1 checks it the Shift bit is set and and judging from the formula it doesn't care about the other modifier bits, but when running your example with this condition the variable is refreshed in cases of Shift+R, Ctrl+Shift+R, Alt+Shift+R etc. , likewise your original example refreshes in case of Crtl+Shift+Alt+RIf we would want SHIFT alone, it would be $(( $KEY_MOD & 1)) = 1, only CTRL - $(( $KEY_MOD & 4 )) = 4 and so on.
(I hope it's clear enough?)
Compare this to the rock solid behavior of my usual menubar approach:
Code: Select all
#!/bin/sh
# Shift+R to refresh the date
export MAIN='
<window>
<vbox>
<hbox>
<menubar width-request="1" height-request="1">
<menu>
<menuitem accel-key="0x52" accel-mods="1">
<action>Refresh:varDATE</action>
</menuitem>
</menu>
</menubar>
</hbox>
<text>
<variable>varDATE</variable>
<input>date</input>
</text>
</vbox>
</window>'
gtkdialog -cp MAIN
2) Of course the variable refreshes only when Shift+R was pressed
3) Needs a bit more boxes, but makes multiple actions and functions easy. With the condition set in <menuitem> and therefore out of the way, all following actions are easy to read and maintain.
4) Usually I set <menu use-underline="true"> and add <label>"_M"</label> to the menu section. Then upon hitting Alt+M the menu pops out of nowhere. At least during development useful for testing the correct assignment of the accel-keys .
There are some downsides...that's why I'm still very much interested in making the key-press-event solution work