Bug 4033 - unable to turn off tilde expandsion in commands
Status: RESOLVED FIXED
Alias: None
Product: Openbox
Classification: Unclassified
Component: general
Version: 3.4.7.2
Hardware: PC Linux
: P3 normal
Assignee: Dana Jansens
QA Contact: Anthony Thyssen
URL:
Depends on:
Blocks:
 
Reported: 2009-04-05 22:01 EDT by Anthony Thyssen
Modified: 2009-07-05 21:40:56 EDT
1 user (show)

See Also:



Description Anthony Thyssen 2009-04-05 22:01:42 EDT
I have been adding keyboard macros expandsions in openbox with great success, but find that if I want a '~' in the arguments to a command  Openbox expands that character when it should not do so.

For example in the openbox rc.xml  I have...

    <keybind key="W-F2">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Keyboard Macro: Web Page</name>
        </startupnotify>
        <command>xte 'usleep 500000' \
                     'str http://www.cit.gu.edu.au/~anthony/'</command>
      </action>
    </keybind>

When the user presses  Super-F2  (and releases it) Openbox will
wait 1/2 (for user to release the modifiers) then output the string
  "http://www.cit.gu.edu.au/~anthony/"
as if the user actually typed it into whatever the current input box is

THIS IS VERY USEFUL!

But openbox actually expands the '~' with  "/home/anthony" which
means the above keyboard macro expands to
   http://www.cit.gu.edu.au//home/anthony/"

That is WRONG!

A '~' character should only be expanded when....
  * Not in quotes
  * and has white space in front of it.

Any other '~' should not be expanded as it DOES NOT MAKE SENSE!

THIS IS A SERIOUS, if minor  BUG.

I attempted to use the standard XML handling for  &tilde;  or   &#7E;  but these also do not work!

  That could be regarded as another posible bug!

How can I get Openbox to give a command a '~' without expanding it!
Comment 1 Mikachu 2009-07-05 11:37:56 EDT
(In reply to comment #0)
> I have been adding keyboard macros expandsions in openbox with great success,
> but find that if I want a '~' in the arguments to a command  Openbox expands
> that character when it should not do so.
> 
> For example in the openbox rc.xml  I have...
> 
>     <keybind key="W-F2">
>       <action name="Execute">
>         <startupnotify>
>           <enabled>true</enabled>
>           <name>Keyboard Macro: Web Page</name>
>         </startupnotify>
>         <command>xte 'usleep 500000' \
>                      'str http://www.cit.gu.edu.au/~anthony/'</command>
>       </action>
>     </keybind>
> 
> When the user presses  Super-F2  (and releases it) Openbox will
> wait 1/2 (for user to release the modifiers) then output the string
>   "http://www.cit.gu.edu.au/~anthony/"
> as if the user actually typed it into whatever the current input box is
> 
> THIS IS VERY USEFUL!

No need to shout :)

> But openbox actually expands the '~' with  "/home/anthony" which
> means the above keyboard macro expands to
>    http://www.cit.gu.edu.au//home/anthony/"
> 
> That is WRONG!
> 
> A '~' character should only be expanded when....
>   * Not in quotes
>   * and has white space in front of it.
      or is at the start of a string

> Any other '~' should not be expanded as it DOES NOT MAKE SENSE!
> 
> THIS IS A SERIOUS, if minor  BUG.

These are mutually exclusive last i checked. :)

> I attempted to use the standard XML handling for  &tilde;  or   &#7E;  but
> these also do not work!
> 
>   That could be regarded as another posible bug!

No, openbox sees the strings after xml processing has been done, so this doesn't make any difference. Note also that your syntax is incorrect, to specify a hex unicode codepoint, you say &#x7E;, otherwise it is a decimal value, in which case E is an invalid character.

> How can I get Openbox to give a command a '~' without expanding it!

Questions end with "?", not "!".

I'll fix this for 3.4.8 so '~' is only expanded when the bullet points are true.
Comment 2 Anthony Thyssen 2009-07-05 21:37:51 EDT
| > A '~' character should only be expanded when....
| >   * Not in quotes
| >   * and has white space in front of it.  
|       or is at the start of a string
| ...  
| > Any other '~' should not be expanded  
| 
| I'll fix this for 3.4.8 so '~' is only expanded when the bullet points are
| true.
|   
Thank you.  can you tell me which version it will be in?


| > I attempted to use the standard XML handling for  &tilde;  or   &#7E;  but
| > these also do not work!  
|  
So I was later told from the mail list.  My current workaround (until
the patch comes through)

        <command>bash -c "xte 'usleep 500000' \\\
               'str http://www.cit.gu.edu.au/'`printf '\176'`'anthony/'"
        </command>

Which as you can see is not particularly nice.

Thanks again.
Comment 3 Mikachu 2009-07-05 21:40:56 EDT
(In reply to comment #2)

> | I'll fix this for 3.4.8 so '~' is only expanded when the bullet points are
> | true.
> |   
> Thank you.  can you tell me which version it will be in?

If that didn't do the trick, I don't think I can. :)